exactLRT {RLRsim} | R Documentation |
Likelihood Ratio Tests for simple linear mixed models
Description
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.
Usage
exactLRT(
m,
m0,
seed = NA,
nsim = 10000,
log.grid.hi = 8,
log.grid.lo = -10,
gridlength = 200,
parallel = c("no", "multicore", "snow"),
ncpus = 1L,
cl = NULL
)
Arguments
m |
The fitted model under the alternative; of class |
m0 |
The fitted model under the null hypothesis; of class |
seed |
Specify a seed for |
nsim |
Number of values to simulate |
log.grid.hi |
Lower value of the grid on the log scale. See
|
log.grid.lo |
Lower value of the grid on the log scale. See
|
gridlength |
Length of the grid. See |
parallel |
The type of parallel operation to be used (if any). If missing, the default is "no parallelization"). |
ncpus |
integer: number of processes to be used in parallel operation: typically one would chose this to the number of available CPUs. Defaults to 1, i.e., no parallelization. |
cl |
An optional parallel or snow cluster for use if parallel = "snow". If not supplied, a cluster on the local machine is created for the duration of the call. |
Details
The model under the alternative must be a linear mixed model
y=X\beta+Zb+\varepsilon
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
H_0:
\beta_{p+1-q}=\beta^0_{p+1-q},\dots,\beta_{p}=\beta^0_{p};\quad
Var(b)=0
versus
H_A:\;
\beta_{p+1-q}\neq \beta^0_{p+1-q}\;\mbox{or}\dots
\mbox{or}\;\beta_{p}\neq
\beta^0_{p}\;\;\mbox{or}\;Var(b)>0
We use the exact finite sample distribution of the likelihood ratio test statistic as derived by Crainiceanu & Ruppert (2004).
Value
A list of class htest
containing the following components:
-
statistic
the observed likelihood ratio -
p
p-value for the observed test statistic -
method
a character string indicating what type of test was performed and how many values were simulated to determine the critical value -
sample
the samples from the null distribution returned byLRTSim
Author(s)
Fabian Scheipl, updates for lme4.0-compatibility by Ben Bolker
References
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.
See Also
LRTSim
for the underlying simulation algorithm;
RLRTSim
and exactRLRT
for restricted likelihood
based tests
Examples
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)