www.gusucode.com > stats 源码程序 matlab案例代码 > stats/PairedSampletTestExample.m
%% Paired-Sample t-Test %% % Load the sample data. Create vectors containing the first and second columns % of the data matrix to represent students’ grades on two exams. load examgrades x = grades(:,1); y = grades(:,2); %% % Test the null hypothesis that the pairwise difference between data vectors % |x| and |y| has a mean equal to zero. [h,p] = ttest(x,y) %% % The returned value of |h = 0| indicates that |ttest| does not reject the % null hypothesis at the default 5% significance level.