Categories &

Functions List

Function Reference: vartest2

statistics: h = vartest2 (x, y)
statistics: h = vartest2 (x, y, name, value)
statistics: [h, pval] = vartest2 (…)
statistics: [h, pval, ci] = vartest2 (…)
statistics: [h, pval, ci, stats] = vartest2 (…)

Two-sample F test for equal variances.

h = vartest2 (x, y) performs an F test of the hypothesis that the independent data in vectors x and y come from normal distributions with equal variance, against the alternative that they come from normal distributions with different variances. The result is h = 0 if the null hypothesis ("variance are equal") cannot be rejected at the 5% significance level, or h = 1 if the null hypothesis can be rejected at the 5% level.

x and y may also be matrices or N-D arrays. For matrices, vartest2 performs separate tests along each column and returns a vector of results. For N-D arrays, vartest2 works along the first non-singleton dimension and x and y must have the same size along all the remaining dimensions.

vartest treats NaNs as missing values, and ignores them.

[h, pval] = vartest (…) returns the p-value. That is the probability of observing the given result, or one more extreme, by chance if the null hypothesisis true.

[h, pval, ci] = vartest (…) returns a 100× (1 - alpha)% confidence interval for the true ratio var(X)/var(Y).

[h, pval, ci, stats] = vartest (…) returns a structure with the following fields:

fstatthe value of the test statistic
df1the numerator degrees of freedom of the test
df2the denominator degrees of freedom of the test

[…] = vartest (…, name, value), … specifies one or more of the following name/value pairs:

NameValue
"alpha"the significance level. Default is 0.05.
"dim"dimension to work along a matrix or an N-D array.
"tail"a string specifying the alternative hypothesis
"both"variance is not v (two-tailed, default)
"left"variance is less than v (left-tailed)
"right"variance is greater than v (right-tailed)

See also: ttest2, kstest2, bartlett_test, levene_test

Source Code: vartest2