Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- How to insert additional column to Least Squares Means Table in Effect Details?

Topic Options

- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Nov 11, 2017 8:21 PM
(2743 views)

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.

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

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

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

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

```
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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

Thank you very much Jim