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

    %% Test for Equal Variances Using the Brown-Forsythe Test  

%% 
% Load the sample data. 
load examgrades

%% 
% Test the null hypothesis that the variances are equal across the five
% columns of data in the students’ exam grades matrix, |grades|, using the
% Brown-Forsythe test. Suppress the display of the summary table of statistics
% and the box plot. 
[p,stats] = vartestn(grades,'TestType','BrownForsythe','Display','off') 

%%
% The small $p$-value, |p = 1.3121e-06|, indicates that |vartestn| rejects
% the null hypothesis that the variances are equal across all five columns,
% in favor of the alternative hypothesis that at least one column has a
% different variance.