【发布时间】:2016-04-19 03:24:58
【问题描述】:
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
model1 <- glm(counts ~ outcome + treatment, family = poisson())
model2 <- glm(counts ~ outcome, family = poisson())
print_params <- function(model){
cat("\nAIC:", model$aic,
"\nDeviance:", model$deviance)}
list_models <- list(model1,model2)
do.call("rbind", sapply(list_models, print_params, simplify = FALSE))
这给了我:
AIC: 56.76132
Deviance: 5.129141
AIC: 52.76132
Deviance: 5.129141NULL
我不确定我为什么会得到这个。还有其他方法吗?
【问题讨论】:
-
print_params返回NULL:rbind的结果有什么意义呢?
标签: r cat side-effects