在AICcmodavg中使用aictab函数计算QAICc(计数,小的和过度分散的数据集)

时间:2019-03-25 05:17:42

标签: r statistics glm

我对使用AIC进行模型选择非常陌生。我有一个很小的数据集(n / K <40,其中n =样本大小,K =要估计的参数数量),并且计数数据过于分散。通过阅读文献,建议我使用QAICc进行模型选择(Burnham&Anderson,2001)。但是,当我从 AICcmodavg 包中调用 aictab 函数时,只得到了AICc。我不确定我是否了解R文档以获得QAICc。

有人知道如何为每个候选集模型获取QAICc吗?

代码

library(dplyr)
library(MASS)
library(AICcmodavg)

# Produce dummy table to simulate real data
set.seed(323)
dt <- tibble(site_ID = 1:75,
      no_cars = sample(0:300, size = 75, replace = T),
      site_type = sample(c("historic", "rural", "urban"), 75, T),
      road_type = sample(c("non-maintained", "sealed", "unsealed"), 75, T))

# Generate candidate model set
# Question: what is the best model to explain the number of vehicles that  
# access our sites? This is an oversimplification of the real data
# Response variable is the number of cars and predictor variables are  
# the type of site and the type of road
# Global model: no_cars ~ site_type.historic + road_type_non-maintained
m1 <- glm.nb(formula = "no_cars ~ 1", data = dt)
m2 <- glm.nb(formula = "no_cars ~ site_type", data = dt)
m3 <- glm.nb(formula = "no_cars ~ road_type", data = dt)
m4 <- glm.nb(formula = "no_cars ~ site_type + road_type", data = dt)

# List the models, name them and convert them into glm
ms_nb <- list(null = m1, type = m2, road = m3, type_road = m4)
ms_glm <- lapply(ms_nb, glm.convert)

# aictab table
aictbl <- aictab(cand.set = ms_glm, second.ord = TRUE, sort = TRUE)

0 个答案:

没有答案