vartest2

Hypothesis test for the variances of two samples.

Syntax

[h,pvalue,ci] = vartest2(x,y)

[h,pvalue,ci] = vartest2(x,y,name,value)

Inputs

x,y
Data samples to be tested.
Type: double
Dimension: vector | matrix
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 ratio of population variances (x to y).

Example

Vector vartest2 example.

x = [11.9 18.2 7.9 9.6 6.7 11.2 5.9 12.1 -2 16.3 14.3 -2.4 1.7 -5.6 -9.1 2.2 8.2 8.4 21 -6.1]
y = [16.6 -0.4 7 8.8 6.3 11.2 9.2 9.8 11.9 7.4 12.1 9.8 13 13 -4.6 17.7 15.7 13.6 6.7 11.8]
[h,p_value,ci] = vartest2(x,y)
h = 0
pvalue = 0.054256
ci = [Matrix] 1 x 2
0.98297 6.2742

Comments

vartest2 is a 2 sample F test and assumes that the samples comes from normally distributed populations. The null hypothesis is that the two population variances are equal.