I have modified the JSL to be able to handle multiple levels of ID.
Names Default To Here( 1 );
sd = //Open( "test_table.jmp" );
Data Table( "test_table " );
Fitmod = Fit Model(
Y( :"Test value"n ),
Effects( :Person ),
Random Effects( :Day[:Person] ),
NoBounds( 0 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Effect Leverage" ),
Run(
:"Test value"n << {Summary of Fit( 1 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ),
Scaled Estimates( 0 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ), Plot Effect Leverage( 1 ),
Plot Residual by Normal Quantiles( 0 ), {:Person << {LSMeans Student's t( 0.05 )}}}
),
by( :ID ),
SendToReport(
Dispatch( {"Test value ID=A1"}, "Whole Model", OutlineBox, {Close( 1 )} ),
Dispatch( {"Test value ID=A1", "Person"}, "Leverage Plot", OutlineBox, {Close( 1 )} )
)
);
// Set the lists for the storage of the data from the by groups
whereVal = testValue = dif = sumfit1 = sumfit2 = {};
// Loop across each by group and gather the data
For Each( {rpt, group}, Fitmod,
// Point to the current report
reportFitmod = Fitmod[group] << Report;
// Get the means for the 2 levels
sumfit = reportFitmod[Outline Box( "Least Squares Means Table" )][Number Col Box( 1 )] << Get as Matrix;
Insert Into( sumfit1, sumfit[1] );
Insert Into( sumfit2, sumfit[2] );
term = reportFitmod[Outline Box( "Least Squares Means Table" )][String Col Box( 1 )] << Get();
// Get By Group column
whereCol = Word( 1, (reportFitmod[Outline Box( 1 )] << get title), "=)" );
Insert Into( whereVal, Word( 2, (reportFitmod[Outline Box( 1 )] << get title), "=)" ) );
// Get data from CrossTab table
crossTab = reportFitmod[Outline Box( "LSMeans Differences Student's t" )][CrosstabBox( 1 )] <<
get as matrix;
meandiff = Round( Abs( crossTab[1, 2] ), 4 );
lowerCL = Round( Abs( crossTab[3, 2] ), 3 );
upperCL = Round( Abs( crossTab[4, 2] ), 3 );
// Get the Response variable name
Insert Into( testValue, (Substr( (reportFitmod << topparent)[Outline Box( 1 )] << get title, 10 )) );
// Create the Differeence in mean and CL string
Insert Into( dif, Char( meandiff ) || " [" || Char( lowerCL ) || ";" || Char( upperCL ) || "]" );
);
// Create the table
dlg = New Window( "Custom Report",
Outline Box( "Selected Values",
Lineup Box( N Col( 2 ), Text Box( "Factor of Interest: " ), Text Box( term[1] ) ),
Spacer Box( size( 0, 10 ) ),
tb = Table Box(
String Col Box( "Test Value", testvalue ),
String Col Box( whereCol, whereVal ),
Number Col Box( "Mean, " || term[1], sumfit1 ),
Number Col Box( "Mean, " || term[2], sumfit2 ),
String Col Box( "Difference in mean and CI", dif )
)
)
);
tb << Set Shade Headings( 0 ); // Turn off shaded table headings.
tb << Set Column Borders( 1 ); // Turn off table column borders.
tb << Set row Borders( 1 );
tb << border( 1 );
Your job now is to study the script, and learn what it does. The script works for the sample data table and Fit Model you specified. However, different data tables with different columns and different Fit Model executions may not work with the JSL that generates the report output. You will need to become knowledgeable enough to modify the script to meet your needs.
Good references for this is the Scripting Guide and the Scripting Index, available under the Help pull down menu in JMP.
Of course, the JMP Discussion Community will be there to assist you with your learning of the script.
Jim