vartest

Hypothesis test for the variance of a sample.

Syntax

[h,pvalue,ci] = vartest(x,v)

[h,pvalue,ci] = vartest(x,v,name,value)

Inputs

x
Data sample to be tested.
Type: double
Dimension: vector | matrix
v
Hypothesis variance.
Type: double
Dimension: scalar
name
Name of an option whose value follows. Multiple name/value pairs are allowed. The supported options are alpha and dim.
alpha is the level of significance (default: 0.05).
dim is the dimension on which the test is performed (default: first non-singular dimension).
Type: string
value
Value for the preceeding option name.
Type: double | integer
Dimension: scalar

Outputs

h
0 if the null hypothesis is accepted. 1 if the null hypothesis is rejected.
p_value
The p-value of the test.
ci
A 100*(1-alpha)% confidence interval for the population variance.

Example

Vector vartest example.

x = [7.3 9.4 5.9 6.5 5.5 7 5.3 7.3 2.6 8.7 8.1 2.5 3.9 1.4 0.2 4 6 6.1 10.3 1.2]
[h,pvalue,ci] = vartest(x,16)
h = 0
pvalue = 0.069951
ci = [Matrix] 1 x 2
4.6075 16.995

Comments

vartest is a 1 sample Chi-squared test and assumes that the sample comes from a normally distributed population. The null hypothesis is that the hypothesized variance is the population variance.