r - R中带有“ldpy”的多重线性回归问题
问题描述
我正在尝试用 R 计算多元线性回归,我想在数据框中获得结果。我必须使用过滤器,因为我需要计算对不同国家/地区的回归:
## No controls. ("unadjusted" pay gap.)
model1 <- dlply(data, 'Pais', function(df)
lm(log_total ~ male, data = df)
## Apply coef to each model and return a data frame
df1 <- ldply(model1, coef)
model2 <- dlply(data, 'Pais', function(df)
lm(log_total ~ male + age_bin, data = df))
df2 <- ldply(model2, coef)
### Adding all controls. ("adjusted" pay gap.)
model3 <- dlply(data, 'Pais', function(df)
lm(log_total ~ male + + age_bin + dept + seniority + jobTitle, data = df))
df3 <- ldply(model3, coef)
我在模型 3 中遇到问题,因为我没有获得 df3 并且我不知道如何解决问题..
非常感谢。
解决方案
推荐阅读
- postgresql - 将 postgres 表数据导出到 shape 文件以构建 OSRM 集群
- flutter - Flutter – 如何解决删除问题 TextInputFormatter
- vb.net - 派生类对象的基类引用
- java - 夏令时差一小时
- ios - UIBezierPath 绘制的三角形视图颜色不变
- microsoft-graph-api - MS 图形用户有多个名为“日历”的日历
- javascript - 使用javascript的asp.net核心下拉列表中的默认值具有双引号时无法设置值
- php - Laravel JSON 到数组
- c - 根据大小重命名和移动我的文件并不总是在 c 中工作。为什么?
- reactjs - 反应查询如何处理搜索