%meantest.m
%   Mean test without known variance %To test whether the average Percentage
%of Success (POS) %obtained using the method A is the outcome %of the random variable with mean 90 
A=[92.7526 90.138 88.0929 89.6350 89.1519 ... 
    89.2352 88.8723 90.0782 92.1066 89.2842 ... 
    89.7195 91.1665 91.2128 90.4855 91.0260 ...
    90.8707 89.6182 90.4289 89.7009 89.1001];
%Obtain the outcome of the random variable T (ttest) with %zero mean and
%variance 1 as follows. 
M=mean(A); 
V=var(A);
ttest=(M-90)/sqrt(V/20);
%As the number of outcomes is lesser than $30$ and Z %follows $t$ distribution with order 19 
c=cumsum((pdf('t',-5:0.1:5,19)/10)); 
t=-5:0.1:5; 
plot(t,c); 
%Locating 0.05 significant level (95% confident level) %is the value at which the cumulative distribution is %0.05 and 0.95 
[p1,q1]=find((c-0.05)>0);
[p2,q2]=find((c-0.95)>0);
hold on 
plot([t(q1(1)) t(q1(1))],[0 c(q1(1))],'-r*')
hold on 
plot([t(q2(1)) t(q2(1))],[0 c(q2(1))],'-r*')
%The Null Hypotheis is structured such that the %mean is equal to 90 %We reject the Hypotheis if ttest is greater than t(q1(1)) %or less than t(q2(1)) 
if((ttest<t(q1(1)))|(ttest>t(q2(1)))) 
    disp('Reject the Null Hypothesis (i.e., mean is equal to 90)') 
else
    disp('Accept the Null Hypothesis (i.e., mean is equal to 90)') 
end
