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

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 (Alumni) ms
Super User (Alumni)

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.

View solution in original post

8 REPLIES 8
Craige_Hales
Super User

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

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
Level VI

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
Super User

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 Community Manager

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 (Alumni) ms
Super User (Alumni)

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
Super User

Re: create a formula that takes means over different variables

way better

Craige

Re: create a formula that takes means over different variables

Thank you!  That was very easy.