### Function Reference: `vartest`

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

One-sample test of variance.

`h = vartest (x, v)` performs a chi-square test of the hypothesis that the data in the vector x come from a normal distribution with variance v, against the alternative that x comes from a normal distribution with a different variance. The result is h = 0 if the null hypothesis ("variance is V") cannot be rejected at the 5% significance level, or h = 1 if the null hypothesis can be rejected at the 5% level.

x may also be a matrix or an N-D array. For matrices, `vartest` performs separate tests along each column of x, and returns a vector of results. For N-D arrays, `vartest` works along the first non-singleton dimension of x. v must be a scalar.

`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 variance.

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

| `chisqstat` | the value of the test statistic
| `df` | the degrees of freedom of the test

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

| Name | Value
--- | --- | ---
| `"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: ttest, ztest, kstest

Source Code: vartest