Displaying 1 result from an estimated 1 matches for "lmepblm".
2023 Aug 29
1
logLIk(lme(...))?
...hink I should get
the same answer as from lm(y~1, ...) within each level of group. I can
get the same means, but I don't know how to extract the within-gp
standard deviations, and the sum of logLik for the latter two does not
equal the former.
TOY EXAMPLE:
library(nlme)
set.seed(1)
lmePblm <- data.frame(y=c(rnorm(5, 1, 2), rnorm(5,3,5)),
gp=factor(rep(1:2, each=5)))
fit22 <- lme(y~gp, lmePblm, random=~1|gp, method='ML')
fitGp1 <- lm(y~1, lmePblm[lmePblm$gp==1, ])
fitGp2 <- lm(y~1, lmePblm[lmePblm$gp==2, ])
(ll22 <- logLik(fit22))...