exactLRT or
exactRLRT.LRTSim(X, Z, q, sqrt.Sigma, seed = NA, nsim = 10000,
log.grid.hi = 8, log.grid.lo = -10, gridlength = 200,
parallel = c("no", "multicore", "snow"), ncpus = 1L,
cl = NULL)set.seednsim realizations of $y$ drawn under the null
hypothesis. log.grid.hi and log.grid.lo are
the lower and upper limits of this grid on the log scale.
gridlength is the number of points on the grid.
These are just wrapper functions for the underlying C
code. Scheipl, F. (2007) Testing for nonparametric terms and
random effects in structured additive regression.
Diploma thesis.
Scheipl, F., Greven, S. and Kuechenhoff, H (2008) Size and power of tests for a zero random effect variance or polynomial regression in additive and linear mixed models, Computational Statistics & Data Analysis, 52(7):3283-3299
exactLRT, exactRLRT for testslibrary(lme4)
g <- rep(1:10, e = 10)
x <- rnorm(100)
y <- 0.1 * x + rnorm(100)
m <- lmer(y ~ x + (1|g), REML=FALSE)
m0 <- lm(y ~ 1)
(obs.LRT <- 2*(logLik(m)-logLik(m0)))
X <- getME(m,"X")
Z <- t(as.matrix(getME(m,"Zt")))
sim.LRT <- LRTSim(X, Z, 1, diag(10))
(pval <- mean(sim.LRT > obs.LRT))Run the code above in your browser using DataLab