[R] behaviour of logLik and lme
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Apr 19 14:36:53 CEST 2005
On Tue, 19 Apr 2005, Dr. Peter Schlattmann wrote:
> when performing a meta analysis I have two results obtained with logLik
> and lme, which I do not quite understand.
> The first result concerns logLik
>
> m0<-glm(or~1,family=gaussian(),data=temp,weights=1./var)
>
> logLik(m0)
> `log Lik.' -7.10697 (df=2)
>
> For comparison direct calculation of the log likelihood gives:
>
> ll<-sum(log(dnorm(temp$or,fitted(m0),sqrt(temp$var))))
>> ll
> [1] -33.19137
>
> Does logLik omit constants or how can this discrepancy be explained?
Simply that logLik.glm uses the correct direct calculation.
Hint: what do weights mean in a glm (see McCullagh & Nelder, 1989, p.29 as
I recall)? They do not appear in your `direct calculation'.
[...]
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list