Page 222 - Computational Statistics Handbook with MATLAB
P. 222
Chapter 6: Monte Carlo Methods for Inferential Statistics 209
PROCEDURE - MONTE CARLO HYPOTHESIS TESTING (P-VALUE)
1. For a random sample of size n to be used in a statistical hypothesis
.
test, calculate the observed value of the test statistic, t o
2. Decide on a pseudo-population that reflects the characteristics of
the population under the null hypothesis.
3. Obtain a random sample of size n from the pseudo-population.
4. Calculate the value of the test statistic using the random sample in
step 3 and record it as . t i
, ,
5. Repeat steps 3 and 4 for M trials. We now have values t 1 … t M ,
that serve as an estimate of the distribution of the test statistic, T,
when the null hypothesis is true.
6. Estimate the p-value using the distribution found in step 5, using
the following.
Lower Tail Test:
# t i ≤( t o )
,
ˆ p-value = ---------------------; i = 1 … M
,
M
Upper Tail Test:
# t ≥( t )
ˆ p-value = ---------------------; i = 1 … M
,
,
o
i
M
ˆ
7. If p-value ≤ α , then reject the null hypothesis.
Example 6.7
We return to the situation in Example 6.6 and apply Monte Carlo simulation
to the p-value approach to hypothesis testing. Just to change things a bit, we
use the sample mean as our test statistic.
% Let's change the test statistic to xbar.
Tobs = mean(mcdata);
% Number of Monte Carlo trials.
M = 1000;
% Start the simulation.
Tm = zeros(1,M);
for i = 1:M
% Generate a random sample under H_0.
xs = sigma*randn(1,n) + 454;
Tm(i) = mean(xs);
end
© 2002 by Chapman & Hall/CRC