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

    %% One-Sided z-Test  

%% 
% Load the sample data. Create a vector containing the first column of the
% students' exam grades data. 
load examgrades
x = grades(:,1);  

%% 
% Test the null hypothesis that the data comes from a normal distribution
% with mean |m = 65| and standard deviation |sigma = 10|, against the alternative
% that the mean is greater than 65. 
[h,p] = ztest(x,65,10,'Tail','right') 

%%
% The returned value of |h = 1| indicates that |ztest| rejects the null
% hypothesis at the default 5% significance level, in favor of the alternative
% hypothesis that the population mean is greater than 65.