Re: [R] Log-likelihood function

From: Robert A LaBudde <>
Date: Wed, 02 May 2007 11:08:56 -0400

At 07:30 AM 5/2/2007, Doxastic wrote:
>Thanks. I used this and it gave me the same result as the "logLik" function.
>The reason I ask is the SAS output gives me a loglik = 1089. R gives me
>-298.09583. Both for my reduced model. For the saturated (or complex)
>model, SAS gives me an loglik = 1143. R gives me -298.1993. The problem is
>these give two very different pictures about whether I can drop the
>interaction. However, I think the residual deviance in the R output is
>equal to G^2. So, I can just take the difference between those two. If I
>do this, I get a difference with an interpretation similar to that of what
>comes from SAS. So I think I'll just go with that. But who knows if I'm
>right (not me)?

Some comments:

  1. Use summary() on your glm() object to get a fuller display of post-fit statistics, including the starting ("null") and residual deviances.
  2. The "deviance" is - 2 L, where L = ln(likelihood).
  3. To test two nested models for the difference in covariates, subtract the two residual deviances and two d.f. and perform a chi-square test. This can be done nicely by anova() on the two glm() objects.
  4. Check the coefficients in your SAS and R models and make sure you are performing the same fit in both cases.

Robert A. LaBudde, PhD, PAS, Dpl. ACAFS e-mail:
Least Cost Formulations, Ltd.            URL:
824 Timberlake Drive                     Tel: 757-467-0954
Virginia Beach, VA 23464-3239            Fax: 757-467-2947

"Vere scire est per causas scire" mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 02 May 2007 - 15:16:02 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 Wed 02 May 2007 - 16:31:05 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.