Subscribe Bookmark RSS Feed

Formula for grouped statistics

guilhem

Community Trekker

Joined:

Jul 16, 2015

Hi

I think it's trivial but I've only started to learn JSL syntax and I'm struggling with this one.

Saying I have a column "myValues" that contains my numeric values and a column "myGroups" that is a categorical variable to group my values together. What formula can I use in a third column to get the mean of "myValues" group by group.

E.g.

myValuesmyGroupsmyMeans
1A2
2A2
3A2
4B5
5B5
6B5
7C7.5
8C7.5
9D9

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Use the following formula: Col Mean(:myValues, :myGroups)

7 REPLIES
Solution

Use the following formula: Col Mean(:myValues, :myGroups)

guilhem

Community Trekker

Joined:

Jul 16, 2015

Thanks!

ram_asra_gmail_

Community Trekker

Joined:

Mar 21, 2013

Can it give only one unique value, instead of repeated data points?

ron_horne

Super User

Joined:

Jun 23, 2011

hi ram.asra@gmail.com,

for unique values try using Table Summary.

by the way, summarizing the table and then updating the original table can produce the same result as guilhem​ was asking for just without the formula.

ron

ram_asra_gmail_

Community Trekker

Joined:

Mar 21, 2013

Hi Ron,

yes, that would produce the same result. so i was asking if JMP can have non repeated data functionality in col mean( my values, mygrps).

Thanks

ram

ron_horne

Super User

Joined:

Jun 23, 2011

if you give an example perhaps i can understand better what you are looking for.

ms

Super User

Joined:

Jun 23, 2011

The "ColStat" fumctions is mainly useful in column formulas and cannot return non-repeated values as far as I know.

But Summarize() can. Example:

Summatize(g = group(:mygrps), m = Mean(my values))

Where m is matrix of the mean at each level of g, a list of group names (as strings). Excluded rows are not included.