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

    %% Ansari-Bradley One-Sided Hypothesis Test  

%% 
% Load the sample data. Create data vectors of miles per gallon (|MPG|)
% measurements for the model years 1982 and 1976. 
load carsmall
x = MPG(Model_Year==82);
y = MPG(Model_Year==76);  

%% 
% Test the null hypothesis that the miles per gallon measured in cars from
% 1982 and 1976 have equal variances, against the alternative hypothesis
% that the variance of cars from 1982 is greater than that of cars from 1976. 
[h,p,stats] = ansaribradley(x,y,'Tail','right') 

%%
% The returned value of |h = 0| indicates that |ansaribradley| does not
% reject the null hypothesis that the variance in miles per gallon is the
% same for the two model years, when the alternative is that the variance
% of cars from 1982 is greater than that of cars from 1976.