Geoscience Reference
In-Depth Information
clear
load('organicmatter_five.mat');
We again compare the calculated Fcalc value with the critical Fcrit value at a
5% signii cance level, using the function finv to compute Fcrit .
s1 = std(corg1);
s2 = std(corg2);
df1 = length(corg1) - 1;
df2 = length(corg2) - 1;
if s1 > s2
slarger = s1;
ssmaller = s2;
else
slarger = s2;
ssmaller = s1;
end
Fcalc = slarger^2 / ssmaller^2
Fcrit = finv(1-0.05/2,df1,df2)
and get
Fcalc =
3.4967
Fcrit =
1.6741
Since the Fcalc value calculated from the data is now larger than the critical
Fcrit value, we can reject the null hypothesis. h e variances are therefore
dif erent at a 5% signii cance level.
Alternatively, we can apply the function vartest2(x,y,alpha) , performing
a two-sample F -test on the two independent samples corg1 and corg2 at an
alpha=0.05 or a 5% signii cance level.
[h,p,ci,stats] = vartest2(corg1,corg2,0.05)
yields
h =
1
p =
3.4153e-06
ci =
2.0887
Search WWH ::




Custom Search