| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Statistics Toolbox |
| Contents | Index |
| Learn more about Statistics Toolbox |
H = vartest(X,V)
H = vartest(X,V,alpha)
H = vartest(X,V,alpha,tail)
[H,P] = vartest(...)
[H,P,CI] = vartest(...)
[H,P,CI,STATS] = vartest(...)
[...] = vartest(X,V,alpha,tail,dim)
H = vartest(X,V) performs a chi-square test of the hypothesis that the data in the vector X comes 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-dimensional array. For matrices, vartest performs separate tests along each column of X, and returns a row vector of results. For n-dimensional arrays, vartest works along the first nonsingleton dimension of X. V must be a scalar.
H = vartest(X,V,alpha) performs the test at the significance level (100*alpha)%. alpha has a default value of 0.05 and must be a scalar.
H = vartest(X,V,alpha,tail) performs the test against the alternative hypothesis specified by tail, where tail is a single string from the following choices:
'both' — Variance is not V (two-tailed test). This is the default.
'right' — Variance is greater than V (right-tailed test).
'left' — Variance is less than V (left-tailed test).
[H,P] = vartest(...) returns the p-value, i.e., the probability of observing the given result, or one more extreme, by chance if the null hypothesis is true. Small values of P cast doubt on the validity of the null hypothesis.
[H,P,CI] = vartest(...) returns a 100*(1-alpha)% confidence interval for the true variance.
[H,P,CI,STATS] = vartest(...) returns the structure STATS with the following fields:
'chisqstat' — Value of the test statistic
'df' — Degrees of freedom of the test
[...] = vartest(X,V,alpha,tail,dim) works along dimension dim of X. Pass in [] for alpha or tail to use their default values.
Determine whether the standard deviation is significantly different from 7?
load carsmall
[h,p,ci] = vartest(MPG,7^2)
![]() | VarNames property (TreeBagger) | vartest2 | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |