MChtest-package           package:MChtest           R Documentation

_M_o_n_t_e _C_a_r_l_o _h_y_p_o_t_h_e_s_i_s _t_e_s_t_s _a_l_l_o_w_i_n_g _s_e_q_u_e_n_t_i_a_l _s_t_o_p_p_i_n_g

_D_e_s_c_r_i_p_t_i_o_n:

     The package performs Monte Carlo hypothesis tests. It allows a
     couple of different sequential  stopping boundaries (a truncated
     sequential probability ratio test boundary and a boundary proposed
      by Besag and Clifford, 1991). Gives valid p-values and confidence
     intervals on p-values.

_D_e_t_a_i_l_s:


       Package:  MChtest
       Type:     Package
       Version:  1.0
       Date:     2007-03-02
       License:  GPL

     Use 'MCbound' to create sequential stopping boundaries. These may
     take considerable set-up time, but once the  stopping boundary is
     calculated then it can be used in 'MCtest' to save time in
     computation of Monte Carlo  hypothesis tests. The idea of the
     truncated sequential probability ratio test boundary is that it
     takes many resamples if  the true p-value (i.e., the one from an
     infinite resample size) is close to the significance level (e.g.,
     0.05),  but takes much fewer if the true p-value is far from the
     significance level.

_A_u_t_h_o_r(_s):

     Michael P. Fay

     Maintainer: Michael Fay <mfay@niaid.nih.gov>

_R_e_f_e_r_e_n_c_e_s:

     Besag, J. and Clifford, P. (1991). Sequential Monte Carlo
     p-values. Biometrika. 78: 301-304.

     Fay, M.P., Kim, H-J. and Hachey, M. (2007). Using truncated
     sequential probability ratio test boundaries  for Monte Carlo
     implementation of hypothesis tests. (to appear Journal of
     Computational and Graphical Statistics).

_S_e_e _A_l_s_o:

     Precalculated MCbound: 'MCbound.precalc1'

_E_x_a_m_p_l_e_s:

     ## Create a stopping boundary
     ##### May take a long time if Nmax is large
     B<-MCbound("tsprt",c(alpha0=.001,beta0=.01,Nmax=99,p0=.04,p1=.06))
     ## do Monte Carlo  test
     x<-data.frame(y=1:100,z=rnorm(100),group=c(rep(1,50),rep(2,50)))
     stat<-function(x){ cor(x[,1],x[,2]) }
     ### nonparametric bootstrap test on correlation between y and z
     ### low p-value means that such a large correlation unlikely due to chance
     resamp<-function(x){ n<-dim(x)[[1]] ; x[sample(1:n,replace=TRUE),] }
     MCtest(x,stat,resamp,bound=B) 
     ## Package comes with a large precalculated MC bound as the default
     ## the precalculated bound is good for testing at the 0.05 level
     MCtest(x,stat,resamp)

