BookmarkSubscribe
Choose Language Hide Translation Bar
johnmoore
Community Trekker

How do I create a shaded confidence interval on a Graph Builder plot?

I would like to compare some results to a standard depletion curves.  I would like to plot the expected value curve and shade the area between the two confidence interval curves.  Does anyone know how I could do this?

 

Many thanks,

 

John

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
gzmorgan0
Super User

Re: How do I create a shaded confidence interval on a Graph Builder plot?

@johnmoore 

Since @markbailey said he was busy, I thought I'd add another option:

  1. If you have columns for the standard and Prediction of the Mean Curve or the Prediction of the Individual values you can use Graph Builder Area element to build your graphic.
  2. You could also use a column transform to create the temporary columns, this is a little bit messier since the prediction curves require the Std Error formula which is a bit messy in a transform formula. Note the standard formula should limit the prediction range and use the proper degrees of freedom based upon the standard.  

The example and script below are provided as a simple example of GraphBuilder features using option#1

image.png

 

 

Names Default to Here(1);
//Note the Elements order is important, the last one will be on top, the first in the background

dt = open("c:\temp\BigClass_StandardCI.jmp");

gb = dt << Graph Builder(
	Size( 534, 454 ),
	Show Control Panel( 0 ),
	Variables(
		X( :height ),
		Y( :Standard ),
		Y( :Lower 95% Standard, Position( 1 ) ),
		Y( :Upper 95% Standard, Position( 1 ) ),
		Y( :New Curve, Position( 1 ) ),
		Y( :weight, Position( 1 ) )
	),
	Elements(
		Line( X, Y( 1 ), Legend( 1 ) ),
		Area( X, Y( 2 ), Y( 3 ), Legend( 2 ), Area Style( "Range" ) ),
		Points( X, Y( 5 ), Legend( 3 ) ),
		Line Of Fit( X, Y( 4 ), Legend( 4 ) )
	),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				1,
				Level Name( 0, "Standard", Item ID( "Mean(Standard)", 1 ) ),
				Properties( 0, {Line Width( 3 )}, Item ID( "Mean(Standard)", 1 ) )
			), Legend Model(
				2,
				Properties(
					0,
					{Transparency( 0.4 )},
					Item ID(
						"Mean(Lower 95% Standard)..Mean(Upper 95% Standard)",
						1
					)
				)
			), Legend Model(
				4,
				Properties( 0, {Line Width( 3 )}, Item ID( "New Curve", 1 ) )
			)}
		),
		Dispatch(
			{},
			"Y title",
			TextEditBox,
			{Set Text( "Weight Curve vs Standard" )}
		),
		Dispatch(
			{},
			"400",
			LegendBox,
			{Legend Position( {1, [0], 2, [-1], 3, [2], 4, [1, -3]} ),
			Position( {0, -1, 2, 1, -3} )}
		)
	)
);
5 REPLIES 5
NG
NG
Community Trekker

Re: How do I create a shaded confidence interval on a Graph Builder plot?

There are two ways.

 

1) On the left, check the box for "Prediction"

2) Right click the plot --> line of fit --> click "Prediction"

johnmoore
Community Trekker

Re: How do I create a shaded confidence interval on a Graph Builder plot?

NG,

Thanks for your reply.  The standard curves I would like to reference would be formula columns that are independent of the data I am plotting against.  So in the background of the graph I would like to show the standard expected value curve as well as the upper and lower confidence limits the standard curve.  In front of this I would like to plot the data so that we can see how "is" compares to what "ought to be"

 

John

0 Kudos

Re: How do I create a shaded confidence interval on a Graph Builder plot?

I'm too busy at the moment to work on a complete solution, but not too busy to 'get the ball rolling.'

 

If the formulae are independent of the data and pre-determined, then it might be possible to add one or more graphics scripts to the frame box in Graph Builder to provide the visual reference that you want. I don't know if the graphics script is run before or after Graph Builder plots its own graphical elements.

Learn it once, use it forever!
0 Kudos
gzmorgan0
Super User

Re: How do I create a shaded confidence interval on a Graph Builder plot?

@johnmoore 

Since @markbailey said he was busy, I thought I'd add another option:

  1. If you have columns for the standard and Prediction of the Mean Curve or the Prediction of the Individual values you can use Graph Builder Area element to build your graphic.
  2. You could also use a column transform to create the temporary columns, this is a little bit messier since the prediction curves require the Std Error formula which is a bit messy in a transform formula. Note the standard formula should limit the prediction range and use the proper degrees of freedom based upon the standard.  

The example and script below are provided as a simple example of GraphBuilder features using option#1

image.png

 

 

Names Default to Here(1);
//Note the Elements order is important, the last one will be on top, the first in the background

dt = open("c:\temp\BigClass_StandardCI.jmp");

gb = dt << Graph Builder(
	Size( 534, 454 ),
	Show Control Panel( 0 ),
	Variables(
		X( :height ),
		Y( :Standard ),
		Y( :Lower 95% Standard, Position( 1 ) ),
		Y( :Upper 95% Standard, Position( 1 ) ),
		Y( :New Curve, Position( 1 ) ),
		Y( :weight, Position( 1 ) )
	),
	Elements(
		Line( X, Y( 1 ), Legend( 1 ) ),
		Area( X, Y( 2 ), Y( 3 ), Legend( 2 ), Area Style( "Range" ) ),
		Points( X, Y( 5 ), Legend( 3 ) ),
		Line Of Fit( X, Y( 4 ), Legend( 4 ) )
	),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				1,
				Level Name( 0, "Standard", Item ID( "Mean(Standard)", 1 ) ),
				Properties( 0, {Line Width( 3 )}, Item ID( "Mean(Standard)", 1 ) )
			), Legend Model(
				2,
				Properties(
					0,
					{Transparency( 0.4 )},
					Item ID(
						"Mean(Lower 95% Standard)..Mean(Upper 95% Standard)",
						1
					)
				)
			), Legend Model(
				4,
				Properties( 0, {Line Width( 3 )}, Item ID( "New Curve", 1 ) )
			)}
		),
		Dispatch(
			{},
			"Y title",
			TextEditBox,
			{Set Text( "Weight Curve vs Standard" )}
		),
		Dispatch(
			{},
			"400",
			LegendBox,
			{Legend Position( {1, [0], 2, [-1], 3, [2], 4, [1, -3]} ),
			Position( {0, -1, 2, 1, -3} )}
		)
	)
);
Highlighted
johnmoore
Community Trekker

Re: How do I create a shaded confidence interval on a Graph Builder plot?

Georgia,

 

Thanks so much!  That was exactly what I needed.

 

John

0 Kudos