load mcdata;
n=length(mcdata);
sigma=7.8;
M=1000; % number of Monte Carlo trials
n=length(mcdata);
sigma=7.8;
M=1000; % number of Monte Carlo trials
%start simulation to get sample
Tm = zeros(1,M);
for i=1:M
xs = sigma*randn(1,n)+454;
Tm(i)=mean(xs);
end
tobs = mean(mcdata);
ind=find(Tm <= tobs);
pvalhat=length(ind)/M
Tm = zeros(1,M);
for i=1:M
xs = sigma*randn(1,n)+454;
Tm(i)=mean(xs);
end
tobs = mean(mcdata);
ind=find(Tm <= tobs);
pvalhat=length(ind)/M
pvalhat =
0.0060
If the significant level $\alpha=0.05$, this estimated p-value is less than the $\alpha$. We would reject the H0.
No comments:
Post a Comment