www.gusucode.com > stats 源码程序 matlab案例代码 > stats/TestGroupedDataforEqualVariancesExample.m

    %% Test Grouped Data for Equal Variances  

%% 
% Load the sample data. 
load carsmall

%% 
% Test the null hypothesis that the variances in miles per gallon (|MPG|)
% are equal across different model years. 
vartestn(MPG,Model_Year)       

%%
% The high $p$-value, |p = 0.83269|, indicates that |vartestn| does not
% reject the null hypothesis that the variances in miles per gallon (|MPG|)
% are equal across different model years.