Re: [R] logLIk(lme(...))?

2023-08-29 Thread Spencer Graves
I found my problem: The following function gave llGp1, llGp2 and ll22: logLik_lm <- function(object){ res <- resid(object) n <- length(res) s2MLE <- sum(res^2)/n lglk <- (-n/2)*(log(2*pi*s2MLE)+1) lglk } logLik(fitGp1) logLik(fitGp1)-logLik_lm(fitGp1) llGp1 - logLik_lm(fitGp1)

[R] logLIk(lme(...))?

2023-08-29 Thread Spencer Graves
Hello, all: I have a dataset with 2 groups. I want to estimate 2 means and 2 standard deviations. I naively think I should be able to use lme to do that, e.g., lme(y~gp, random=y~1|gp, method='ML'). I think I should get the same answer as from lm(y~1, ...) within each level of group.