Hi, I'm trying to compare models, one of which has all parameters fixed using offsets. The log-likelihoods seem reasonble in all cases except the model in which there are no free parameters (model3 in the toy example below). Any help would be appreciated.
Cheers, Jarrod x<-rnorm(100) y<-rnorm(100, 1+x) model1<-lm(y~x) logLik(model1) sum(dnorm(y, predict(model1), summary(model1)$sigma,log=TRUE)) # no offset - in agreement model2<-lm(y~offset(rep(1,100))+x-1) logLik(model2) sum(dnorm(y, predict(model2),summary(model2)$sigma,log=TRUE)) # offset and free parameters - in agreement model3<-lm(y~offset(rep(1,100))+offset(x)-1) logLik(model3) sum(dnorm(y, predict(model3),summary(model3)$sigma,log=TRUE)) # offset only - discrepancy sum(predict(model3)-c(1+x)) # yet predict is correct ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.