cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Kynda
Level III

How to insert additional column to Least Squares Means Table in Effect Details?

I want to find the means of my each level of my design experiment. But in the report I only get Least Suare of Means.

Picture1.png 

How can I get the means of each level, is there any possibility to add additional colum to this table and get means?

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to insert additional column to Least Squares Means Table in Effect Details?

The script I included in my last response would not be added to the Fit Model.  It is a script that would be run instead of the model.  However, given your response, I suggest that what you do, is rather than working towards adding the means to the existing table, that you run a separate JMP Platform to generate the desired means.  If you run the Tablulate Platform, you can generate the means.  Below is an example, using the sample data that I have been using for the examples I have provided you.  The Tabulate Platform can be found in JMP at:

     Analyze==>Tabulate

Here are the results

kynda3.PNG

Or if you really want to add the means to the LSMeans table, below is a script that you would have to modify based upon the columns you are running in your model, and then run the script to add the means to the output.

The Script:

// Calculate the means
Summarize(bygroup = by( :sex, :age ), TheMeans = Mean( :Weight ) );
// Append the calculated means to the display table
Window("big class - Fit Least Squares")["Sex*Age"]["Least Squares Means Table"][Table Box( 1 )] <<
append( Number Col Box( "Means", Eval( TheMeans ) ) );

What would have to be changed are the refernces to the columns.  In my Example, the Columns: sex, age and weight would have to be changes to your columns.

Secondly, the Window reference of "big class - Fit Least Squares"  would have to be changed to the output window name from your analysis.  This is taken directly from the output display's window name at the top left area of the output

Kynda2.PNG

Once the changes to this simple script are made, you just need to run it, and it will add the means to your interaction MeansSquare table

Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: How to insert additional column to Least Squares Means Table in Effect Details?

There is not an interactive option for adding the means to the table you are referencing, however there is a pretty simple script that can add it in

Kynda.PNG

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
fm = dt << Fit Model(
	Y( :weight ),
	Effects( :age, :sex, :sex * :age ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),
	Run(
		:weight << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ),
		Lack of Fit( 0 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
		Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
		Plot Effect Leverage( 1 ), Box Cox Y Transformation( 0 )}
	),
	SendToReport(
		Dispatch(
			{"Response weight", "sex*age"},
			"Least Squares Means Table",
			OutlineBox,
			{Close( 0 )}
		)
	)
);
// Calculate the means
Summarize( dt, bygroup = by( :sex, :age ), TheMeans = Mean( :Weight ) );
// Append the calculated means to the display table
Report( fm )["Sex*Age"]["Least Squares Means Table"][Table Box( 1 )] <<
append( Number Col Box( "Means", Eval( TheMeans ) ) );

 

Jim
Kynda
Level III

Re: How to insert additional column to Least Squares Means Table in Effect Details?

Thank you @txnelson for the promt reply.

Unfortunately I'm not a computer guy.

If possible could you please guide me how can I add this script to my model (I mean where I have to write this commands?)

 

Thank you, This will help me for all my analysis.

Kind Regards

 

 

txnelson
Super User

Re: How to insert additional column to Least Squares Means Table in Effect Details?

The script I included in my last response would not be added to the Fit Model.  It is a script that would be run instead of the model.  However, given your response, I suggest that what you do, is rather than working towards adding the means to the existing table, that you run a separate JMP Platform to generate the desired means.  If you run the Tablulate Platform, you can generate the means.  Below is an example, using the sample data that I have been using for the examples I have provided you.  The Tabulate Platform can be found in JMP at:

     Analyze==>Tabulate

Here are the results

kynda3.PNG

Or if you really want to add the means to the LSMeans table, below is a script that you would have to modify based upon the columns you are running in your model, and then run the script to add the means to the output.

The Script:

// Calculate the means
Summarize(bygroup = by( :sex, :age ), TheMeans = Mean( :Weight ) );
// Append the calculated means to the display table
Window("big class - Fit Least Squares")["Sex*Age"]["Least Squares Means Table"][Table Box( 1 )] <<
append( Number Col Box( "Means", Eval( TheMeans ) ) );

What would have to be changed are the refernces to the columns.  In my Example, the Columns: sex, age and weight would have to be changes to your columns.

Secondly, the Window reference of "big class - Fit Least Squares"  would have to be changed to the output window name from your analysis.  This is taken directly from the output display's window name at the top left area of the output

Kynda2.PNG

Once the changes to this simple script are made, you just need to run it, and it will add the means to your interaction MeansSquare table

Jim
Kynda
Level III

Re: How to insert additional column to Least Squares Means Table in Effect Details?

Thank you very much Jim