Function Repository Resource:

HedgesG

Source Notebook

Computes the Hedges g statistic measuring an "effects size" difference between two lists of data

Contributed by: Seth J. Chandler

ResourceFunction["HedgesG"][{lst1,lst2}]

computes the "effects size" difference between two sets of data lst1 and lst2 by dividing the difference of the means of each set by the pooled standard deviation of both sets of data.

Details and Options

The function will not evaluate unless lst1 and lst2 each have a length greater than one.

Examples

Basic Examples (2) 

Compute the Hedges g statistic for two lists of data:

In[1]:=
ResourceFunction["HedgesG"][{{2, 4, 6}, {3, 6, 9, 12}}]
Out[1]=

Compute the Hedges g statistic of symbolic data, assuming that the elements of the data are real:

In[2]:=
ResourceFunction["HedgesG"][{Array[y, {3}], Array[z, 4]}] /. Conjugate[n_] :> n // FullSimplify
Out[2]=

Scope (1) 

The function can work on complex values, although its meaning in that case is unclear:

In[3]:=
ResourceFunction[
 "HedgesG"][{{-2 I, -3 - 5 I, -2 + 5 I}, {-5 - 3 I, -2 + 3 I, -4 - 2 I, -1}}]
Out[3]=

Applications (1) 

Find the interval in which x must fall in order for the Hedges g statistic to exceed 0.8 (this provides a measure of when two sets of data have large differences between them):

In[4]:=
Labeled[Plot[
  ResourceFunction["HedgesG"][{{3, 6, 9, x}, {2, 3, 4}}], {x, 0, 60}, Epilog -> InfiniteLine[{{0, 0.8}, {1, 0.8}}]], ResourceFunction["HedgesG"][{{3, 6, 9, x}, {2, 3, 4}}] > 4/5 // Reduce[#, x, Reals] &]
Out[4]=

Properties and Relations (2) 

The pooled standard deviation of two data samples is the difference in the means of the two samples divided by their Hedges' g statistic:

In[5]:=
With[{data = {{2, 4, 6}, {3, 6, 9, 12}}}, ResourceFunction["PooledStandardDeviation"][data] == {1, -1} . Mean /@ data/ResourceFunction["HedgesG"][data]]
Out[5]=

The Hedges' g statistic of two lists is the negative of the Hedges g statistic of the same lists in the reverse order:

In[6]:=
With[{data = {{2, 4, 6}, {3, 6, 9, 12}}}, ResourceFunction["HedgesG"][
   data] == -ResourceFunction["HedgesG"][Reverse[data]]]
Out[6]=

Possible Issues (2) 

The function will not evaluate unless each inner list has a length greater than 1:

In[7]:=
ResourceFunction["HedgesG"][{{1}, {2, 3, 4}}]
Out[7]=

The function will not evaluate if there are more than two inner lists:

In[8]:=
ResourceFunction["HedgesG"][{{1, 2, 3}, {4, 5, 6}, {7, 8, 9, 10}}]
Out[8]=

Publisher

Seth J. Chandler

Version History

  • 1.0.0 – 02 January 2020

Related Resources

License Information