cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
Samira
Level III

Cohen's d

Hello

I conducted one-way ANOVA to compare the average of a variable across 3 groups. The reviewer of my paper asked for Cohen's d test for measuring the effect size. How can I get this measure in JMP? I am using JMP pro V17

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Cohen's d

Cohen's d is not directly available in JMP 17.  However, it is in JMP 18 under

     Analyze=>Fit Y by X=>Means/Anova/Pooled t

In JMP 17 it has to be calculated using JSL.  Here is an example script that generates Cohen's d for all pairs of groups

txnelson_0-1741867641431.png

or

txnelson_1-1741867701505.png

Names Default To Here( 1 );
dt = open("$SAMPLE_DATA/big class.jmp");

var = "height";
grp = "sex";
Eval(
	Parse(
		"Summarize(
		dt,
		bygp = by( :" || grp || " ),
		stds = Std Dev( :" || var
		 || " ),
		ns = Count( :" || var || " ),
		means = Mean( :" || var || " )
	);"
	)
);

nw = New Window( "Cohen's d", vlb = V List Box() );
For( i = 1, i <= N Items( bygp ) - 1, i++,
	For( k = i + 1, k <= N Items( bygp ), k++,
		pooled = Sqrt(
			(stds[i] ^ 2 * (ns[i] - 1) + stds[k] ^ 2 * (ns[k] - 1)) / (ns[i] + ns[k] - 2)
		);
		dif = Abs( means[i] - means[k] );
		cohen = (dif / pooled);
		stats = Matrix( dif ) |/ Matrix( pooled ) |/ Matrix( cohen );
		compare = {};
		insert into( compare, bygp[i] || " vs. " || bygp[k]);
		ob = Outline Box( grp || "=" || bygp[i] || " vs. " || grp || "=" || bygp[k],
			Table Box(
				String Col Box( "", compare ),
				String Col Box( "", {"Difference", "Pooled Std Dev", "Cohen's d"} ),
				Number Col Box( "", stats )
			)
		);
		vlb << append( ob );
	)
);
Jim

View solution in original post

MRB3855
Super User

Re: Cohen's d

Hi @Samira : FWIW, for 2 or more groups in the ANOVA, the RMSE (Root Mean Squared Error) is the pooled SD. 

 

 

View solution in original post

5 REPLIES 5
txnelson
Super User

Re: Cohen's d

Cohen's d is not directly available in JMP 17.  However, it is in JMP 18 under

     Analyze=>Fit Y by X=>Means/Anova/Pooled t

In JMP 17 it has to be calculated using JSL.  Here is an example script that generates Cohen's d for all pairs of groups

txnelson_0-1741867641431.png

or

txnelson_1-1741867701505.png

Names Default To Here( 1 );
dt = open("$SAMPLE_DATA/big class.jmp");

var = "height";
grp = "sex";
Eval(
	Parse(
		"Summarize(
		dt,
		bygp = by( :" || grp || " ),
		stds = Std Dev( :" || var
		 || " ),
		ns = Count( :" || var || " ),
		means = Mean( :" || var || " )
	);"
	)
);

nw = New Window( "Cohen's d", vlb = V List Box() );
For( i = 1, i <= N Items( bygp ) - 1, i++,
	For( k = i + 1, k <= N Items( bygp ), k++,
		pooled = Sqrt(
			(stds[i] ^ 2 * (ns[i] - 1) + stds[k] ^ 2 * (ns[k] - 1)) / (ns[i] + ns[k] - 2)
		);
		dif = Abs( means[i] - means[k] );
		cohen = (dif / pooled);
		stats = Matrix( dif ) |/ Matrix( pooled ) |/ Matrix( cohen );
		compare = {};
		insert into( compare, bygp[i] || " vs. " || bygp[k]);
		ob = Outline Box( grp || "=" || bygp[i] || " vs. " || grp || "=" || bygp[k],
			Table Box(
				String Col Box( "", compare ),
				String Col Box( "", {"Difference", "Pooled Std Dev", "Cohen's d"} ),
				Number Col Box( "", stats )
			)
		);
		vlb << append( ob );
	)
);
Jim
Samira
Level III

Re: Cohen's d

Thanks 

It was helpful. I wonder if there is a way to get it in JMP 18 for 3 groups, not 2. pooled t is only available when comparing means in 2 groups, however, in my case, I conducted one-way ANOVA to compare means of 3 groups

Victor_G
Super User

Re: Cohen's d

Hi @Samira,

 

Outside of 2 groups, this option is not possible with JMP 18 natively. You can have a look at the Wish list, this need has already been raised and acknowledged : Cohen's d for "Fit Y by X" 

Let's hope for a release in a future 18.X version or JMP 19.

Victor GUILLER

"It is not unusual for a well-designed experiment to analyze itself" (Box, Hunter and Hunter)
MRB3855
Super User

Re: Cohen's d

Hi @Samira : FWIW, for 2 or more groups in the ANOVA, the RMSE (Root Mean Squared Error) is the pooled SD. 

 

 

Samira
Level III

Re: Cohen's d

Thanks

This helped me a lot to calculate Cohen's d manually. For more clarification, I found RMSE in the summary of fit table.

Recommended Articles