- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: create a formula that takes means over different variables
way better
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: create a formula that takes means over different variables
Thank you! That was very easy.