BookmarkSubscribeRSS Feed
lauren_eggett

Community Trekker

Joined:

Mar 3, 2015

create a formula that takes means over different variables

I have a bunch of categorical factors (like gender, age group, etc.) and a continuous response.  I'd like to take the means of the response but grouped for the categorical factors.  So any woman between the ages of 15 and 20, say, would be averaged separately from men 60-65.  And I would like these means saved to a column.  Is there a way to do that?  Sorry, if this is an easy answer...I'm very new to jmp.

1 ACCEPTED SOLUTION

Accepted Solutions
ms

Super User

Joined:

Jun 23, 2011

Solution

Re: create a formula that takes means over different variables

If you want the means in your original table a column formula may be a better option, especially if your data will change.

Add a new column with a formula like

Col Mean(:height, :sex, :age)

where :height is the continuos response and :sex and :age represent optional grouping columns.

8 REPLIES
Craige_Hales

Staff

Joined:

Mar 21, 2013

Re: create a formula that takes means over different variables

start with Tables->Summary, which will produce a new table.  If you like what you get, there is a Source script (red triangle) you can use in JSL.

8213_summary.PNG

Craige
lauren_eggett

Community Trekker

Joined:

Mar 3, 2015

Re: create a formula that takes means over different variables

I can use that to get my means but I don't know how to take that information and put it back into my original data table as a column.  I have over 4k rows so manually entering the means is not possible.

Kevin_Anderson

Community Trekker

Joined:

Jun 5, 2014

Re: create a formula that takes means over different variables

Hi, Lauren.  Everyone was new to JMP at one time... 

Go to Table -> Join and join the new table with the original by matching the AGE column.

Craige_Hales

Staff

Joined:

Mar 21, 2013

Re: create a formula that takes means over different variables

Tables->Join does the job of matching up the rows from the short and long tables, using a column you specify to match them.  Again, there will be a script in the joined table if you need it for JSL.

Craige
Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

Re: create a formula that takes means over different variables

Here's a neat, hidden trick in JMP – you can drag a column from a summary table back to the source table to auto-join it. Just remember to pause for a beat after clicking at the top of the summary column.

-Jeff

-Jeff
ms

Super User

Joined:

Jun 23, 2011

Solution

Re: create a formula that takes means over different variables

If you want the means in your original table a column formula may be a better option, especially if your data will change.

Add a new column with a formula like

Col Mean(:height, :sex, :age)

where :height is the continuos response and :sex and :age represent optional grouping columns.

Craige_Hales

Staff

Joined:

Mar 21, 2013

Re: create a formula that takes means over different variables

way better

Craige
lauren_eggett

Community Trekker

Joined:

Mar 3, 2015

Re: create a formula that takes means over different variables

Thank you!  That was very easy.