StatsTTest
StatsTTest [/ALPH=alpha /CI /DFM=m /MEAN=meanV /PAIR /TAIL=n /T=k /Z /Q] wave1 [, wave2 ]
The StatsTTest operation performs two kinds of T-tests: the first compares the mean of a distribution with a specified mean value (/MEAN) and the second compares the means of the two distributions contained in wave1 and wave2, which must contain at least two data points, can be any real numeric type, and can have an arbitrary number of dimensions. Output is to the W_StatsTTest wave in the current data folder or optionally to a table.
Flags
| /ALPH=val | Sets the significance level (default val =0.05). | ||||||||||
| /CI | Computes the confidence intervals for the mean(s). | ||||||||||
| /DEST=tWave | Specify the output wave for the T-Test. If you do not specify this flag, the operation saves the output in the wave W_StatsTTest in the current data folder. | ||||||||||
| This flag was added in Igor Pro 10.00. | |||||||||||
| /DFM=m | Specifies method for calculating the degrees of freedom. | ||||||||||
| |||||||||||
| /FREE | Creates 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. | |||||||||||
| /MEAN=meanV | Compares meanV with the mean of the distribution in wave1. Outputs are the number of points in the wave, the degrees of freedom (accounting for any NaNs), the average, standard deviation (σ), | ||||||||||
| the statistic | |||||||||||
| and the critical value, which depends on /TAIL. | |||||||||||
| /PAIR | Specifies that the input waves are pairs and computes the difference of each pair of data to get the average difference and the standard error of the difference . The t statistic is the ratio of the two | ||||||||||
| In this case H0 is that the difference is zero. | |||||||||||
| This mode does not support /CI and /DFM. | |||||||||||
| /Q | No results printed in the history area. | ||||||||||
| /T=k | Displays results in a table. k specifies the table behavior when it is closed. | ||||||||||
| |||||||||||
| 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. | |||||||||||
| /TAIL=tailCode | Specifies H0. | ||||||||||
| |||||||||||
| When performing paired tests using /PAIR: | |||||||||||
| |||||||||||
| Here µd is the mean of the difference population. | |||||||||||
| /Z | Ignores errors. V_flag will be set to -1 for any error and to zero otherwise. | ||||||||||
Details
When comparing the mean of a single distribution with a hypothesized mean value, you should use /MEAN and only one wave (wave1 ). If you use two waves StatsTTest performs the T-test for the means of the corresponding distributions (which is incompatible with /MEAN).
When comparing the means of two distributions, the default t-statistic is computed from Welch's approximate t:
where
are variances, ni are the number of samples and
are the averages of the respective waves. This expression is appropriate when the number of points and the variances of the two waves are different. If you want to compute the t-statistic using pooled variance you can use the /AEVR flag. In this case the pooled variance is given by
and the t-statistic is
The different test are:
| H0 | Rejection Condition |
|---|---|
| µ1=µ2 | |t| >= Tc(alpha,ν) |
| µ1>µ2 | t <= Tc(alpha, ν) |
| µ1<µ2 | t >= Tc(alpha, ν) |
Tc is the critical value and ν is the effective number of degrees of freedom (see /DFM flag). When accounting for possibly unequal variances, ν is given by
The critical values (Tc) are computed by numerically by solving for the argument at which the cumulative distribution function (CDF) equals the appropriate values for the tests. The CDF is given by
To get the critical value for the upper one-tail test we solve F(x)=1-alpha. For the lower one-tail test we solve for x the equation F(x)=alpha. In the two-tailed test the lower critical value is a solution for F(x)=alpha/2 and the upper critical value is a solution for F(x)=1-alpha/2.
The T-test assumes that both samples are randomly taken from normally distributed populations.
See Also
Statistical Analysis, StatsStudentPDF, StatsStudentCDF, StatsInvStudentCDF
References
Zar, J.H., Biostatistical Analysis, 4th ed., 929 pp., Prentice Hall, Englewood Cliffs, New Jersey, 1999. See in particular Section 8.1.