Re: [R] log likelihood and deviance

From: Arnaud Le Rouzic <lerouzic_at_legs.cnrs-gif.fr>
Date: Sun, 06 Jun 2010 10:02:45 +0200

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.



R-help_at_r-project.org 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. Received on Sun 06 Jun 2010 - 10:38:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 06 Jun 2010 - 11:10:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive