r - Simulating p-values for Chi-Squared Test using Monte-Carlo Method -
i'm trying write script in r allows aproximate simulation critical values (p-values) pearson chi squared test, taking different alpha values.
i know option in "chisq.test" exists, want know how simulation hand.
for example:
please check code @ http://www.biostat.wisc.edu/~kbroman/teaching/stat371/comp21.r (i don't know how put code properly)
if check last part ("p-value simulation"), you'll see way p-value obtained in script. want this, taking different alpha values.
thank much!
if have done simulation shown in script, , have derived vector of simulation values xsqsim, critical value alpha level of alpha approximately
quantile(xsqsim,1-alpha) you have little bit careful if have small sample, because critical value should value of test statistic q such probability of observed value being greater or equal to q equal alpha ...
Comments
Post a Comment