[R] log likelihood and deviance

Arnaud Le Rouzic lerouzic at legs.cnrs-gif.fr
Sun Jun 6 10:02:45 CEST 2010


Hi,
> If we know the residual of the model, how could we calculate the Log
> likelihood?
It depends on the model (lm? glm? nls?). Why not using directly the 
logLik function?

x <- rnorm(100, 10)
y <- rnorm(100, 10)
model1 <- lm(y ~ x)
logLik(model1)
model2 <- glm(y ~ x, family=gaussian)
logLik(model2)
model3 <- glm(y ~ x, family=Gamma)
logLik(model3)

Cheers,

Arnaud.



More information about the R-help mailing list