与此处类似,我正在使用 tidyr 对子组(年份和组的所有组合)进行一系列回归。
year <- rep(2014:2015, length.out = 10000)
group <- sample(c(0,1,2,3,4,5,6), replace=TRUE, size=10000)
value <- sample(10000, replace = T)
female <- sample(c(0,1), replace=TRUE, size=10000)
smoker <- sample(c(0,1), replace=TRUE, size=10000)
dta <- data.frame(year = year, group = group, value = value, female=female, smoker = smoker)
library(dplyr)
library(broom)
library(stargazer)
# create list of dfs
table_list <- dta %>%
group_by(year, group) %>%
group_split()
# apply the model to each df and produce stargazer result
model_list <- lapply(table_list, function(x) probitmfx(smoker ~ female, data = x))
stargazer(model_list, type = "text")
我收到一条错误消息
% Error: Unrecognized object type.
有人知道我该如何解决这个问题吗?