BookmarkSubscribe
Choose Language Hide Translation Bar
guilhem
Community Trekker

Formula for grouped statistics

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

Re: Formula for grouped statistics

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

7 REPLIES 7
pmroz
Super User

Re: Formula for grouped statistics

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

guilhem
Community Trekker

Re: Formula for grouped statistics

Thanks!

0 Kudos
ram_asra_gmail_
Community Trekker

Re: Formula for grouped statistics

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

0 Kudos
ron_horne
Super User

Re: Formula for grouped statistics

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

Re: Formula for grouped statistics

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

0 Kudos
ron_horne
Super User

Re: Formula for grouped statistics

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

0 Kudos
ms
Super User ms
Super User

Re: Formula for grouped statistics

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.

0 Kudos