cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Juli
New Member

Reporting of data from LSMeans Differences Student's t

Hi all,

I am trying to make a report with specific data from the table of LSMeans Differences Student's t:

Juli_0-1731921303275.png

I would like a table with one of the formats as below: 

Juli_1-1731921761984.png

Juli_0-1731923239812.png

 

 

Sadly, I cannot get it to print correctly for the mean and it cannot take data from the bigger table. I get the below

Juli_3-1731922050015.png

 

I have tried the following code, where I have altered the '17' to numbers from 1-30 and nothing works - 17 is for a different outline box:

 

 

sd = Open( "test_table.jmp" );

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 )}}}
),
Where( :ID == "A1" ),
SendToReport(
Dispatch(
{"Test value ID=A1"},
"Whole Model",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Test value ID=A1", "Person"},
"Leverage Plot",
OutlineBox,
{Close( 1 )}
)
)
);

report(Fitmod) [Outline Box( 2 )] << Close( 0 );
reportFitmod = Fitmod << Report;

sumfit = reportFitmod[Outline Box( 17 )][Number Col Box( 1 )] << Get as Matrix; meandiff = sumfit[1]; lowerCL = sumfit[3]; upperCL = sumfit[4];

term = reportFitmod[Outline Box( 13 )][String Col Box( 1 )] << Get();

est = reportFitmod[Outline Box( 13 )][Number Col Box( 1 )] << Get as Matrix;

dvalues = [];
dvalues = meandiff |/ lowerCL |/ upperCL ;
sfactor = term[2];

dlg = New Window( "Custom Report",
Outline Box( "Selected Values",
Lineup Box( N Col( 2 ),
Text Box( "Factor of Interest: " ),
Text Box( sfactor ), ),
tb = Table Box(

String Col Box( " ",
{"Mean difference: ", "Upper limit: ", "Lower limit: "}
),
Spacer Box( Size( 30, 30 ) ),
,
Spacer Box( Size( 0, 30 ) ),
,
Table Box(
CloneTerm,
Spacer Box( Size( 10, 0 ) ),
,
Number Col Box( "Estimate", est ),
Spacer Box( Size( 10, 0 ) ),
,
Number Col Box( "Mean difference", meandiff)
)
)
);

tb << Set Shade Headings( 0 ); // Turn off shaded table headings.
tb << Set Heading Column Borders( 0 ); // Turn off table column borders.

 

 

How do you report the data from the bigger table?

 

Best regards

 

 

 

 

3 REPLIES 3
txnelson
Super User

Re: Reporting of data from LSMeans Differences Student's t

Welcome to the JMP Community.

I think there is a mix up between the data table you attached and the script you attached.  The references in the script to the columns to be analyzed do not match the columns in the attached data table.

If you can provide the correct attachments I am sure the Community will be able to assist you in your efforts.

Jim
Juli
New Member

Re: Reporting of data from LSMeans Differences Student's t

Dear Jim,

I apologize for the mix-up. Thank you for letting me know. I have attached the correct script now. 

Julie

txnelson
Super User

Re: Reporting of data from LSMeans Differences Student's t

This may give you a leg up on getting your final product.  It produces

txnelson_0-1731940502918.png

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 )}}}
	),
	Where( :ID == "A1" ),
	SendToReport(
		Dispatch( {"Test value ID=A1"}, "Whole Model", OutlineBox, {Close( 1 )} ),
		Dispatch( {"Test value ID=A1", "Person"}, "Leverage Plot", OutlineBox, {Close( 1 )} )
	)
);
Report( Fitmod )[Outline Box( 2 )] << Close( 0 );
reportFitmod = Fitmod << Report;
sumfit = reportFitmod[Outline Box( "Least Squares Means Table" )][Number Col Box( 1 )] << Get as Matrix; 
// Get data from CrossTab table
crossTab = reportFitmod[Outline Box( "LSMeans Differences Student's t" )][CrosstabBox( 1 )] << get as matrix;
// Get Where clause variable
whereCol = Word( 2, ((reportFitmod << parent)[Text Box( 1 )]) << get text, ":=)" );
whereVal = {};
Eval( Parse( "insert into(whereVal," || Word( 2, ((reportFitmod << parent)[Text Box( 1 )]) << get text, "=)" ) || ");" ) );
meandiff = Round( Abs( crossTab[1, 2] ), 4 );
lowerCL = Round( Abs( crossTab[3, 2] ), 3 );
upperCL = Round( Abs( crossTab[4, 2] ), 3 );
term = reportFitmod[Outline Box( "Least Squares Means Table" )][String Col Box( 1 )] << Get();
est = reportFitmod[Outline Box( "Least Squares Means Table" )][Number Col Box( 1 )] << Get as Matrix;
testValue = {};
Insert Into( testValue, (Substr( reportFitmod[Outline Box( 1 )] << get title, 10 )) );
dif = {};
Insert Into( dif, Char( meandiff ) || " [" || Char( lowerCL ) || ";" || Char( upperCL ) || "]" );

dlg = New Window( "Custom Report",
	Outline Box( "Selected Values",
		Lineup Box( N Col( 2 ), Text Box( "Factor of Interest: " ), Text Box( sfactor ) ),
		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], sumfit[1] ),
			Number Col Box( "Mean, " || term[2], sumfit[2] ),
			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 );

 

 

Jim