Description Usage Arguments Details Value References Examples
Likelihood-ratio test for the estimated variance components (or other dipersion parameters) in hglm
.
1 |
hglm.obj1 |
a fitted |
hglm.obj2 |
optional, another fitted |
When hglm.obj2 = NULL
, all the random effects variance components in hglm.obj1
are tested against
the null model with only fixed effects. The degree of freedom is determined by comparing the number of random
effects terms in hglm.obj1
and hglm.obj2
or the null fixed-effects-only model. Note that the likelihood-
ratio test statistic for variance estimates, which are bounded above zero, follows a 50:50 mixture distribution
of chi-square with 0 and 1 degree of freedom (Self and Liang 1987 JASA).
Printout summary of the likelihood-ratio test results. Test statistic, p-value, etc. are returned.
Self, S. G., & Liang, K.-Y. (1987). Asymptotic Properties of Maximum Likelihood Estimators and Likelihood Ratio Tests Under Nonstandard Conditions. Journal of the American Statistical Association, 82(398), 605-610.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | require(hglm)
## Not run:
set.seed(911)
x1 <- rnorm(100)
x2 <- rnorm(100)
x3 <- rnorm(100)
z1 <- factor(rep(LETTERS[1:10], rep(10, 10)))
z2 <- factor(rep(letters[1:5], rep(20, 5)))
Z1 <- model.matrix(~ 0 + z1)
Z2 <- model.matrix(~ 0 + z2)
u1 <- rnorm(10, 0, sqrt(2))
u2 <- rnorm(5, 0, sqrt(3))
y <- 1 + 2*x1 + 3*x2 + Z1%*%u1 + Z2%*%u2 + rnorm(100, 0, sqrt(exp(x3)))
dd <- data.frame(x1 = x1, x2 = x2, x3 = x3, z1 = z1, z2 = z2, y = y)
m20 <- hglm(X = cbind(rep(1, 100), x1, x2), y = y, Z = Z1,
calc.like = TRUE)
lrt(m20)
m21 <- hglm(X = cbind(rep(1, 100), x1, x2), y = y, Z = cbind(Z1, Z2),
RandC = c(10, 5), calc.like = TRUE)
lrt(m20, m21)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.