kyoung
2008-Mar-04 18:11 UTC
[R] using "logLik" with AIC to compare models with different error
Hi there, I?d like to use AIC to compare between models with different error distributions (eg: Dick 2004, Sileshi 2004, Burnham and Anderson 2002), namely a normal, Poisson and negative binomial. I realize there are differing views whether this is valid or not from reading past R help postings; however, for my purpose I think AIC is more appropriate rather than something such as a Chi-sq or G-statistic as I don?t need to know whether the fit is statistically significant or not, rather I want to know which model is the best given my data. The data I?m working on are counts per station (7 stations in total for each model), and originally I used a simplistic glm model: Model.p<-glm(count~station,poisson) Model.n<-glm(count~station,gaussian) And from the MASS package (v 7.2-30) Model.nb<-glm.nb(count~station) I then extracted the log-likelihood using ?logLik(model)?, from which I calculated AIC (by hand). However, after reviewing more of the R help postings and associated help pages for the functions, I have the following questions: 1- the ?glm? function doesn?t use MLE to fit the model, so is the associated ?logLik? extracted valid? 2- If it is valid, does it calculate the full likelihood, or are the constants dropped? (this is not clear in the ?glm or ?loglik files) 3- if neither are valid, are there alternatives? For example, I?ve seen that the MASS package also has a ?fit.distr? function with an associated ?logLik? method, but can I use the log-likelihood extracted using this method to calculate AIC and compare between distributions (in the manner that I want using the ?glm? function)? if so, are the log-likelihood given complete or have the constants been dropped? Any help and suggestions would be appreciated! Kelly Young kyoung at uvic.ca M.Sc Candidate, Dept. Biology Fisheries Oceanography Research Lab University of Victoria .?.><((((?>