Subscribe Bookmark RSS Feed

Is it possible to create an overlay plot representing confidence intervals?

myriam_alexande

Community Trekker

Joined:

Nov 22, 2015

I have lower bound and upper bound of the confidence interval for each estimate already available in my data, I just want to draw it using JMP. All the blogs I have found are regarding generating and drawing confidence intervals with JMP. Any help would be very welcome, thank you very much.

6 REPLIES
ian_jmp

Staff

Joined:

Jun 23, 2011

One way would be to use the 'Range Plot' option in Overlay Plot. To se an example, do 'File > New > New Script', cut and paste the code below, then do 'Edit > Run Script':

// Fudge some data

dt = Open("$SAMPLE_DATA/Big Class.jmp");

UCIcol = dt << NewColumn("Weight UCI", Numeric, Continuous, Formula(:Weight + RandomNormal(10, 1)));

LCIcol = dt << NewColumn("Weight LCI", Numeric, Continuous, Formula(:Weight - RandomNormal(10, 1)));

// Use 'Range Plot' option in Overlay (add a 'Row()' variable to play the x role)

op = dt << Overlay Plot(

X( Transform Column( "Row", Ordinal, Formula( Row() ) ) ),

Y( :Weight UCI, :Weight LCI ),

Range Plot( 1 ),

Show Points( 0 ),

SendToReport(

Dispatch( {}, "Overlay Plot Graph", FrameBox, {Frame Size( 688, 243 )} )

)

);

myriam_alexande

Community Trekker

Joined:

Nov 22, 2015

Hi Ian,

Thank you for your help. I am a new JMP user and so far have only been

using the menu options to generate graphs, manipulating all my data and

running models first in SAS. To create the overlay graph, I import by my

results dataset into JMP and select in menu bar "Graph" then "Overlay

plot". Is it possible to draw confidence interval using this menu, or

please could you explain to me how practically to run the code you sent me

earlier?

Thank you,

Myriam Alexander

ian_jmp

Staff

Joined:

Jun 23, 2011

Hello Myriam,

I'm sure you'll soon get used to JMP.

If you do want to run the code above, then the instructions to do that precede it. The first line to cut starts with '// Fudge . . . ' (the '//' actually denotes a comment line).

But, yes, it's easy to do it interactively. In the Overlay Plot launch dialog, assign the two columns with the upper and lower limits to the 'Y' role, and then the column you want to the 'X' role. When you hit OK, the report appears. Go to the little red triangle at the top of the report (in the 'Overlay Plot' outline node) to select the options you need. You should see 'Range Plot' as one of these.

pmroz

Super User

Joined:

Jun 23, 2011

Hello Myriam,

You might find it easier using Graph Builder.  Suppose you have a table with the following columns: X, Y, LCL and UCL.  Bring up GB on this table.  Drag X to the X axis.  Highlight Y, LCL, UCL and drag to the Y axis.  Click the icon for points, and then shift click the icon for vertical bars.  Right-click inside the graph and select Bar > Bar Style > Interval.  Then, under Points (left side) click on Variables and deselect LCL and UCL.  Under Bar click on Variables and deselect Y.  Should look like this:

10525_GB Confidence Intervals.png

If you run the code shown below inside a script window you'll get the final result.  Uses JMP 11 btw.

New Table( "Untitled",

      Add Rows( 10 ), New Column( "X", Numeric, Continuous, Format( "Best", 12 ),

            Set Values( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] )

      ),

      New Column( "Y", Numeric, Continuous, Format( "Best", 12 ),

            Set Values( [2, 5, 3, 6, 4, 7, 5, 8, 6, 9] )

      ),

      New Column( "LCL", Numeric, Continuous, Format( "Best", 12 ),

            Set Values( [1, 3, 2, 2, 2, 5, 3, 7, 5, 7] )

      ),

      New Column( "UCL", Numeric, Continuous, Format( "Best", 12 ),

            Set Values( [3, 8, 5, 8, 6, 9, 8, 9, 7, 10] )

      )

);

Graph Builder(

      Show Control Panel( 0 ),

      Variables( X( :X ), Y( :Y ), Y( :LCL, Position( 1 ) ), Y( :UCL, Position( 1 ) )

      ),

      Elements(

            Points( X, Y( 1 ), Legend( 4 ), Jitter( 1 ) ),

            Bar( X, Y( 2 ), Y( 3 ), Legend( 5 ), Bar Style( "Interval" ),

                  Summary Statistic( "Mean" )

            )

      )

);

myriam_alexande

Community Trekker

Joined:

Nov 22, 2015

Thank you very much for this step by step explanation, this answers my

question.

Best wishes,

Myriam Alexander

ian_jmp

Staff

Joined:

Jun 23, 2011

Indeed, as Peter says Graph Builder may be a better choice - Possibly I over interpreted the 'overlay plot' in the title of the thread.

As a relative newcomer to JMP, you should be aware that there are almost always many ways to get things done - That's one of its charms . . .