Subscribe Bookmark RSS Feed

Accessing summary statistics from the output of the Fit Model platform

Hi,

Can anybody tell me how to reference the tables of summary statistics that are created by the Fit Model platform, but to do it in such a way that the resulting script is robust against upgrades in JMP?

In the past I've done this sort of thing:

// Open a simple data table;

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

// Fit a model to it;

fmo = Fit Model(

                Y( :Height ),

                Effects( :Sex ),

                Personality( Standard Least Squares ),

                Emphasis( Minimal Report ),

                Run(

                                :Height << {Lack of Fit( 0 ), Plot Actual by Predicted( 0 ),

                                Plot Regression( 0 ), Plot Residual by Predicted( 0 ),

                                Plot Effect Leverage( 0 )}

                )

);

// Send the resuting output to a report;

fmor = fmo << report;

// Display the tree structure of the report so I can see where the table box I actually want is;

fmor << show tree structure;

// Finally, transform that table box into a data table;

dtmeans = fmor[TableBox(5)] << make into data table;

In this particular instance I get away with the above in both JMP 10 and JMP 11 because the table number happens to be the same in both versions - but I know I can't in general rely on that to be the case, because the platform could have been upgraded in the more recent version.

What I therefore need to know is: how can I reference what I've above called "fmor[TableBox(5)]" using a name that is invariant to upgrades in JMP?  Does this table have a name?  If so, what is it?  Is it what appears in the tree structure to be called the "HelpKey"?

Many thanks for any help or examples received.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

If you know the name of the relevant response variable you can first find the relevant parent display box using the same apporach:

// Open a simple data table;

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

Ys = {:Height, :Weight};

// Fit a model to it;

fmo = Fit Model(

  Y( Eval( Ys ) ),

  Effects( :Sex ),

  Personality( Standard Least Squares ),

  Emphasis( Minimal Report ),

  Run(

  :Height << {Lack of Fit( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ),

  Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 )}

  )

);

// Find the LSM table of second response (Weight) using wildcard;

dtmeans = (Report( fmo )[Outline Box( "?" || (Ys[2] << get name) )][Outline Box( "Least Squares Means Table" )] << child()) << make into data table;

4 REPLIES

I think I've found a way, after reading through MS's suggestions under the "Deleting Report Tables" thread - the following works:

report(fmo)["Least Squares Means Table"][1] << make into data table;

I'm assuming the "[1]" picks up the first object (which is a TableBox) within the structure named "Least Squares Means Table" - is that right?  And is this the best way to do it?

ms

Super User

Joined:

Jun 23, 2011

The below is independent of the db numbering, and probably more stable. However, there is no guarantee that future JMP versions will not change the name or structure of that outlinebox.

...

dtmeans = (fmor[Outline Box( "Least Squares Means Table" )] << child()) << make into data table;

...

Perfect!  One related question if I may: if I analyze more than a single response variable via that call to Fit Model, there will be as many Outline Boxes called "Least Squares Means Table" as there are variables being analyzed.  Is there any way to select the one I want other than doing the following:

dtmeans = (fmor[Outline Box( "Least Squares Means Table" )] << child()) << make combined data table

and then extracting the relevant one?  I tried indexing the Outline Box, but that doesn't work.

Many thanks - I'm almost there now.

Solution

If you know the name of the relevant response variable you can first find the relevant parent display box using the same apporach:

// Open a simple data table;

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

Ys = {:Height, :Weight};

// Fit a model to it;

fmo = Fit Model(

  Y( Eval( Ys ) ),

  Effects( :Sex ),

  Personality( Standard Least Squares ),

  Emphasis( Minimal Report ),

  Run(

  :Height << {Lack of Fit( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ),

  Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 )}

  )

);

// Find the LSM table of second response (Weight) using wildcard;

dtmeans = (Report( fmo )[Outline Box( "?" || (Ys[2] << get name) )][Outline Box( "Least Squares Means Table" )] << child()) << make into data table;