search for: fit22

Displaying 2 results from an estimated 2 matches for "fit22".

Did you mean: fit2
2023 Aug 29
1
logLIk(lme(...))?
...t 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)) (llGp1 <- logLik(fitGp1)) (llGp2 <- logLik(fitGp2)) # Why isn't (ll22 = llGp1+llGp2)? (ll22 -...
2023 Aug 31
1
simulating future observations from heteroscedastic fits
...follows: (DF3_2 <- data.frame(y=c(1:3, 10*(1:3)), gp=factor(rep(1:2, e=3)))) # I want to fit 4 models # and simulate future observations from all 4: fit11 <- lm(y~1, DF3_2) fit21 <- lm(y~gp, DF3_2) library(nlme) (fit12 <- lme(y~1, data=DF3_2, random=~1|gp)) (fit22 <- lme(y~gp, data=DF3_2, random=~1|gp)) library(lme4) (fit12r <- lmer(y~1+(1|gp), data=DF3_2, REML=FALSE)) (fit22r <- lmer(y~gp+(1|gp), data=DF3_2, REML=FALSE)) # I can simulate what I want for fit11 and fit21 # as follows: simPred <- function(object, nSims=2){ pred <- predict(o...