[R] Log-likelihood function

2007-05-02 Thread Doxastic
I've computed a loglinear model on a categorical dataset. I would like to test whether an interaction can be dropped by comparing the log-likelihoods from two models(the model with the interaction vs. the model without). Since R does not immediately print the log-likelihood when I use the glm

Re: [R] Log-likelihood function

2007-05-02 Thread Prof Brian Ripley
I think you need to learn about deviances, which R does print. Log-likelihoods are only defined up to additive constants. In this case the conventional constant differs if you view this as a Poisson or as a product-multinomial log-linear model, and R gives you the log-likelihood for a Poisson

Re: [R] Log-likelihood function

2007-05-02 Thread Doxastic
You're right. I do need to learn more. I never learned null/residual deviance. I know the deviance is equivalent to an anova decompostion. But I've never dealt with it seperated like this. I understand deviance as the difference between two model's log-likelihood difference between them

Re: [R] Log-likelihood function

2007-05-02 Thread Ross Darnell
Alternatively generate the log-likelihood using the sum(dpois(y, fitted(model), log = TRUE)) Regards Ross Darnell Doxastic wrote: You're right. I do need to learn more. I never learned null/residual deviance. I know the deviance is equivalent to an anova decompostion. But I've

Re: [R] Log-likelihood function

2007-05-02 Thread Doxastic
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

Re: [R] Log-likelihood function

2007-05-02 Thread Robert A LaBudde
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.