exactLRT               package:RLRsim               R Documentation

_L_i_k_e_l_i_h_o_o_d _R_a_t_i_o _T_e_s_t_s _f_o_r _s_i_m_p_l_e _l_i_n_e_a_r _m_i_x_e_d _m_o_d_e_l_s

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

     This function provides an exact likelihood ratio test based on
     simulated values from the finite sample distribution for
     simultaneous testing of the presence of the variance component and
     some restrictions of the fixed effects in a simple linear mixed
     model with known correlation structure of the random effect and
     i.i.d. errors.

_U_s_a_g_e:

     exactLRT(m, m0, seed = NA, nsim = 5000, log.grid.hi = 8,
         log.grid.lo = -10, gridlength = 200, print.p = TRUE, return.sample = FALSE)

_A_r_g_u_m_e_n_t_s:

       m: The fitted model under the alternative; of class 'lme',
          'lmer' or  'spm'

      m0: The fitted model under the null hypothesis; of class 'lm'

    seed: Specify a seed for 'set.seed' 

    nsim: Number of values to simulate 

log.grid.hi: Lower value of the grid on the log scale. See 'exactLRT'. 

log.grid.lo: Lower value of the grid on the log scale. See 'exactLRT'. 

gridlength: Length of the grid. See 'exactLRT'.  

 print.p: print table with observed variance ratio, observed test
          statistic -2log LR and p-value?

return.sample: return simulated sample?

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

     The model under the alternative must be a linear mixed model
     y=X*beta+Z*b+epsilon with a _single_ random effect b with known
     correlation structure and error terms that are i.i.d. The
     hypothesis to be tested must be of the form

            H0: beta_1=beta0_1,..,beta_q=beta0_q, Var(b)=0

     versus

     H0: beta_1 neq beta0_1,..or..,beta_q neq beta0_q ot Var(b)>0

     The exact finite sample  distribution of the likelihood ratio test
     statistic that is simulated from was derived by Crainiceanu &
     Ruppert (2004).

_V_a_l_u_e:

     If 'return.sample = FALSE', the p-value. Else a list with
     components 

       p: p-value for the observed test statistic

  sample: the simulated sample of test statistics under the null

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

     Fabian Scheipl

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

     Crainiceanu, C. and Ruppert, D. (2004) Likelihood ratio tests in
     linear mixed models with one variance component, _Journal of the
     Royal Statistical Society: Series B_,*66*,165-185.

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

     'LRTSim' for the underlying simulation algorithm; 'RLRTSim' and
     'exactRLRT' for restricted likelihood based tests

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

     library(nlme);
     data(Orthodont);

     ##test for Sex:Age interaction and Subject-Intercept
     mA<-lme(distance ~ Sex * I(age - 11), random = ~ 1| Subject,
         data = Orthodont, method = "ML")
     m0<-lm(distance ~ Sex + I(age - 11), data = Orthodont)
     summary(mA)
     summary(m0)
     exactLRT(m = mA, m0 = m0)

     library(SemiPar);
     data(janka);
     attach(janka);
     mA <- spm(I(log(hardness)) ~ f(dens, basis = "trunc.poly", degree = 2),
         spar.method = "ML")
     m0 <- lm(I(log(hardness))~ dens)

     ####test for linear trend vs. smooth alternative
     ## Not run: exactLRT(m = mA, m0 = m0)

