Subscribe Bookmark RSS Feed
ryan_lekivetz

Joined:

Nov 1, 2013

Drawing 95% confidence intervals for parameter estimates from Fit Model

In my recent blog entry discussing the results of my adventures with hard-boiled eggs, one reader had asked how I created the figures with the confidence intervals for the parameter estimates from Fit Model. I typically use Graph Builder whenever I can for visualization, and the graph below with the parameter estimates for attractiveness of the eggs as the response was no exception.

 

GB_eggs1

 

Seeing that I needed a few extra steps to produce this graph, it seemed worthwhile to write a blog explaining how I did this. The biggest piece is being able to use Graph Builder, giving me the flexibility to add the customization I may want.

 

Getting the Values Out of Fit Model

 

I’ll assume that the model has already been fit using Fit Model; in this example, I’m using attractiveness of the egg as a response. You can find the data set on the JMP File Exchange. Our first step is to get the confidence interval for the parameter estimates. Right-click on the table under Parameter Estimates, select Columns and choose to add the Lower 95% to the table, and then repeat for the upper 95%. Alternatively, you could click the red triangle at the beginning of the report, and choose Regression Reports -> Show All Confidence Intervals.

 

GB_eggs2

 

Another right-click on that table gives us the option to “Make into Data Table,” which is what we choose. This data table contains a row for each term in the model, as well as the columns from the parameter estimates in Fit Model – particularly the lower and upper bounds. It’s this data table that we’ll use to create the graph.

 

In Graph Builder, you can move Term to the Y-axis on the left (I could put it on the X axis, but the length of the term names looks better on the Y), select Lower 95% and Upper 95%, and move these to the X-axis.

 

Drawing the Confidence Intervals

 

To get the intervals, I do the following:

 

 

 

  • Right-click in the graph, and choose Add-> Bar.

 

 

  • On the left-hand side, go to the Bar section, and change Bar style from “Side by side” to Interval (see figure below). Alternatively, a right-click on the graph, and Bar->Bar Style-> Interval.

 

 

  • On the top of Graph Builder, de-select the "Points" button to be left with just the intervals.

 

 

GB_eggs3

 

At this point, your graph should look something like this:

 

GB_eggs4

 

Adjusting the Ordering of the Terms

 

If you look at the graph, you’ll notice that the terms have been placed in alphabetical order, and not the order we had in the parameter estimates. There’s also the Intercept term, which you may or may not be interested in including. If we go back to the data table and exclude the intercept row, Graph Builder will update the graph automatically.

 

If you want the terms to appear in the same order as the original table, you can head back to the parameter estimates data table (while leaving Graph Builder open):

 

 

 

  • Right-click on the Term column and select “Column Info.”

 

 

  • From the Column Properties drop-down, select “Value Ordering.”

 

 

  • Rearrange the Term labels to the desired order.

 

 

  • Choose to reverse this after it’s all done (the top term on the Y-axis in Graph Builder corresponds to the largest value).

 

 

  • Click Apply.

 

 

Graph Builder will update itself with the new order for terms!

 

What if you didn’t care that the order matched up the parameter estimates table? For instance, maybe you prefer to have the terms sorted by the actual estimate. This is even easier – simply select Estimate and drag it to the right of the Y-axis.

 

GB_eggs5

 

Getting the Reference Line at 0

 

Adding the reference line is easy enough:

 

 

 

  • Double-click on the X-axis where the values are (or right-click and choose Axis Settings).

 

 

  • Under Reference Lines, select a color, and click the Add button.

 

 

  • Click OK.

 

 

Final Thoughts

 

You can even add points at center of the intervals (i.e., the estimate) by adding the estimate column to the X-axis by selecting it and moving it there. The axes and title can now be adjusted with a simple double-click. There are plenty of options in Graph Builder to customize it to your liking. Hopefully, you found this blog post useful!