Search code examples
rregressionglmmodel-comparison

Poisson regression AIC table


I am carrying out a series of poisson regression in R and then ranking my ranking my models based on AIC. however I get this as a result:

 > aictab(cand.set = Cand.models, sort = TRUE)

  Model selection based on AICc :

     K AICc Delta_AICc AICcWt Cum.Wt   LL
Mod7 4  Inf        NaN    NaN     NA -Inf
Mod6 3  Inf        NaN    NaN     NA -Inf
Mod5 3  Inf        NaN    NaN     NA -Inf
Mod4 3  Inf        NaN    NaN     NA -Inf
Mod3 2  Inf        NaN    NaN     NA -Inf
Mod2 2  Inf        NaN    NaN     NA -Inf
Mod1 2  Inf        NaN    NaN     NA -Inf

Each model separately gives results on intercepts but not on AIC...

> Cand.models[[1]]

Call:  glm(formula = D ~ A, family = poisson(), data = d)

Coefficients:
(Intercept)        Slope  
   -0.17356      0.07058  

Degrees of Freedom: 251 Total (i.e. Null);  250 Residual
Null Deviance:      55.35 
Residual Deviance: 54.99    AIC: Inf

When I do the same thing with family=gaussian(identity) I get results. How come the AIC wont work when I do poisson regression?

any help would be appreciated.


Solution

  • It is hard to understand why you are getting the results you are without seeing your data or code (tip for next time). But AIC(c) model selection definitely can work with Poisson regression - below is an example:

    library(AICcmodavg)
    
    # make some dummy data (taken from: http://stats.stackexchange.com/questions/11096/how-to-interpret-coefficients-in-a-poisson-regression)
    treatment     <- factor(rep(c(1, 2), c(43, 41)), 
                        levels = c(1, 2),
                        labels = c("placebo", "treated"))
    improved      <- factor(rep(c(1, 2, 3, 1, 2, 3), c(29, 7, 7, 13, 7, 21)),
                        levels = c(1, 2, 3),
                        labels = c("none", "some", "marked"))    
    numberofdrugs <- rpois(84, 10) + 1    
    healthvalue   <- rpois(84, 5)   
    y             <- data.frame(healthvalue, numberofdrugs, treatment, improved)
    
    
    # Model selection using AICc
    # setup a list of candidate models
    Cand.models <- list( )
    
    Cand.models[[1]] <- glm(healthvalue~numberofdrugs+treatment+improved, data=y, family=poisson)
    Cand.models[[2]] <- glm(healthvalue~treatment, data=y, family=poisson)
    
    # create a vector of names to trace back models in set
    Modnames <- paste("mod", 1:length(Cand.models), sep = " ")
    
    # generate AICc table
    aictab(cand.set = Cand.models, modnames = Modnames, sort = TRUE)