Function Repository Resource:

PooledStandardDeviation

Source Notebook

Compute the pooled standard deviation of multiple lists of data

Contributed by: Seth J. Chandler

ResourceFunction["PooledStandardDeviation"][{l1,l2,}]

computes a weighted norm of the standard deviations of each list li in which the weights are proportionate to the lengths of the constituent lists minus one.

Details and Options

ResourceFunction["PooledStandardDeviation"] will not evaluate unless each list li has length greater than 1.

Examples

Basic Examples (2) 

Compute the pooled standard deviation of two lists of data:

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

Compute the pooled standard deviation of symbolic data, assuming that the elements of the data are real:

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

Scope (2) 

PooledStandardDeviation can work on collections of any finite length:

In[3]:=
ResourceFunction[
 "PooledStandardDeviation"][{{12, 14, 16}, {1, 20, 3, 6, 15, 16, 17}, {14, 3, 10, 15, 13}, {11, 7}, {11, 19, 18, 5, 7, 5, 3}}]
Out[3]=

PooledStandardDeviation can work on complex values:

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

Applications (1) 

Compute Hedge’s g statistic, which makes use of the pooled standard deviation to measure the effect size for the difference between means:

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

Properties and Relations (2) 

The pooled variance, which can be computed using the resource function PooledVariance, can also be computed by taking the square of the pooled standard deviation. Indeed, this is precisely how PooledStandardDeviation performs its computation:

In[6]:=
With[{data = {{2, 4, 6}, {3, 6, 9, 12}}}, {ResourceFunction[
   "PooledStandardDeviation"][data]^2, ResourceFunction["PooledVariance"][data]}]
Out[6]=

The pooled standard deviation of a collection is not the same as the standard deviation of the flattened collection, even if the lengths of all the elements of the collection are the same:

In[7]:=
With[{data = {{1, 2, 3}, {1, 2, 3}}}, {ResourceFunction[
   "PooledStandardDeviation"][data], StandardDeviation[Flatten[data]]}]
Out[7]=

Possible Issues (1) 

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

In[8]:=
ResourceFunction["PooledStandardDeviation"][{{1}, {2, 3, 4}}]
Out[8]=

Publisher

Seth J. Chandler

Version History

  • 1.0.0 – 27 December 2019

Related Resources

License Information