Skip to main content

StatsVariancesTest

StatsVariancesTest [/ALPH=val /Q/Z/METH=m /WSTR=strList ] [wave1, wave2,... wave100 ]

The StatsVariancesTest operation performs Bartlett's or Levene's test to determine if wave variances are equal. Output is to the W_StatsVariancesTest wave in the current data folder or optionally to a table.

Flags

/ALPH=valSets the significance level (default val =0.05).
/DEST=vWaveSpecify the output wave for the variances test. If you do not specify this flag, the operation saves the output in the wave W_StatsVariancesTest in the current data folder.
This flag was added in Igor Pro 10.00.
/FREECreates the specified destination wave as a free wave.
/FREE is allowed only in functions, and only if the destination waves are simple names or wave reference structure fields.
See Free Waves for more discussion.
The /FREE flag was added in Igor Pro 10.00.
/METH=mSpecifies the test type.
m =0:Bartlett test (default).
m =1:Levene's test using the mean.
m =2:Modified Levene's test using the median.
m =3:Modified Levene's test using the 10% trimmed mean.
/QNo results printed in the history area.
/T=kDisplays results in a table. k specifies the table behavior when it is closed.
k =0:Normal with dialog (default).
k =1:Kills with no dialog.
k =2:Disables killing.
The table is associated with the test, not the data. If you repeat the test, it will update any existing table with the new results.
/WSTR=waveListString
Specifies a string containing a semicolon-separated list of waves that contain sample data. Use waveListString instead of listing each wave after the flags.
/ZIgnores errors. V_flag will be set to -1 for any error and to zero otherwise.

Details

All tests define the null hypothesis by

H0:σ12=σ22==σk2,\displaystyle H_{0}: \quad \sigma_{1}^{2}=\sigma_{2}^{2}=\ldots=\sigma_{k}^{2},

agains the alternative

Ha:σi2σj2 for at least one ij.\displaystyle H_{a}: \quad \sigma_{i}^{2} \neq \sigma_{j}^{2} \text { for at least one } i \neq j .

Bartlett's test computes:

T=(nk)ln(σw2)i=1k(ni1)ln(σi2)1+13(k1)[i=1k1ni11Nk].T=\frac{(n-k) \ln \left(\sigma_{w}^{2}\right)-\displaystyle \sum_{i=1}^{k}\left(n_{i}-1\right) \ln \left(\sigma_{i}^{2}\right)}{1+\displaystyle \frac{1}{3(k-1)}\left[\sum_{i=1}^{k} \frac{1}{n_{i}-1}-\frac{1}{N-k}\right]} .

where

σi2\displaystyle \sigma_{i}^{2}

is the variance of the i th wave, N is the sum of the points of all the waves, ni is the number of points in wave i, and k is the number of waves. The weighted variance is given by

σw2=i=1k(ni1)σi2Nk\displaystyle \sigma_{w}^{2}=\sum_{i=1}^{k} \frac{\left(n_{i}-1\right) \sigma_{i}^{2}}{N-k}

H0 is rejected if T is greater than the critical value taken from the

χ2\displaystyle \chi^{2}

distribution computed by solving for x:

1alpha=1gammq(k12,x2).\displaystyle 1- { alpha }=1-{ gammq }\left(\frac{k-1}{2}, \frac{x}{2}\right) .

Levene's test computes:

W=(Nk)i=1kni(ZˉiZˉ)2(k1)i=1kj=1k(ZijZˉi)2,W=\frac{(N-k) \displaystyle \sum_{i=1}^{k} n_{i}\left(\bar{Z}_{i}-\bar{Z}\right)^{2}}{(k-1) \displaystyle \sum_{i=1}^{k} \sum_{j=1}^{k}\left(Z_{i j}-\bar{Z}_{i}\right)^{2}},

where

Zij=YijYˉi,Zˉi=1nij=1kZij,Zˉ=1Ni=1kj=1kZij.\begin{array}{l} Z_{i j}=\left|Y_{i j}-\bar{Y}_{i}\right|, \\ \\ \displaystyle \bar{Z}_{i}=\frac{1}{n_{i}} \sum_{j=1}^{k} Z_{i j}, \\ \\ \displaystyle \bar{Z}=\frac{1}{N} \sum_{i=1}^{k} \sum_{j=1}^{k} Z_{i j} . \end{array} Yˉi\displaystyle \bar{Y}_{i}

depends on /METH.

H0 is rejected if W is greater than the critical value from the F distribution computed by solving for x:

1 alpha =1 betai (v22,v12,v2v2+v1x).\displaystyle 1-\text { alpha }=1-\text { betai }\left(\frac{v_{2}}{2}, \frac{v_{1}}{2}, \frac{v_{2}}{v_{2}+v_{1} x}\right) .

References

NIST/SEMATECH, Bartlett's Test, in NIST/SEMATECH e-Handbook of Statistical Methods, http://www.itl.nist.gov/div898/handbook/eda/section3/eda357.htm, 2005.

See Also

Statistical Analysis

Demos

Open Variances-Test Demo.pxp