[R] Log-likelihood function

Robert A LaBudde ral at lcfltd.com
Wed May 2 17:08:56 CEST 2007


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: ral at lcfltd.com
Least Cost Formulations, Ltd.            URL: http://lcfltd.com/
824 Timberlake Drive                     Tel: 757-467-0954
Virginia Beach, VA 23464-3239            Fax: 757-467-2947

"Vere scire est per causas scire"



More information about the R-help mailing list