0

R で一連のポアソン回帰を実行し、AIC に基づいてモデルのランク付けを行っています。ただし、結果としてこれが得られます。

 > 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

各モデルは個別にインターセプトの結果を提供しますが、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

family=gaussian(identity) で同じことをすると、結果が得られます。ポアソン回帰を行うと、AIC が機能しないのはなぜですか?

任意の助けをいただければ幸いです。

4

2 に答える 2

1

データやコードを見ないと、なぜ結果が得られているのかを理解するのは困難です (次回のヒント)。しかし、AIC(c) モデルの選択は間違いなくポアソン回帰で機能します。以下に例を示します。

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)
于 2015-03-07T03:11:47.383 に答える