Pvalue.norm.sim(n = 50, mu = 0, mu0 = 0, sigma = 1, sigma0 = sigma,
test= c("z", "t"), alternative = c("two.sided", "less", "greater", "<>",
"!=", "<", "="">"), alpha = 0.05, B = 10000)
Pvalue.binom.sim(n=100, p=0.5, p0=0.5, test=c('exact','approx'),
alternative=c('two.sided', 'less', 'greater',
'<>','!=','<','>'),
alpha=0.05, B=1000)
run.Pvalue.norm.sim()
run.Pvalue.binom.sim()','>",>
B
samples from either a normal or
binomial distribution, then compute the P-values for the test of
significance on each sample and plot the P-values.
The run.Pvalue.norm.sim
and run.Pvalue.binom.sim
functions are GUI wrappers for the other 2 functions allowing you to
change the parameters and click on "refresh" to run a new set of
simulations.
Using NA
for sigma0
will result in the sample standard
deviations being used (leave blank in the GUI).
When the simulation conditions and the hypothesized values match, the
distributions of the p-values will be approximately uniform.
Changing the parameter of interest will show the idea of power.
Changing the other parameters can show the effects of assumptions not
being met.t.test
, z.test
,
binom.test
, prop.test
, tkexamp
if(interactive()) {
run.Pvalue.norm.sim()
run.Pvalue.binom.sim()
}
Run the code above in your browser using DataLab