r - 是否有可能在 R 中使用估算数据获得仅交互模型?
问题描述
我想指定一个模型,该模型仅在使用 R 的回归中包含交互项(两个分类变量之间)。
使用 MICE 估算数据。
模型看起来像:
fit=with(data=imp, lm(Y~A*B))
相对于:
fit=with(data=imp, lm(Y~A+B+A*B))
当然,两个模型都产生相同的输出,包括所有级别的分类变量的两个主效应和交互效应。
有什么方法可以调用 INTERCEPT ONLY 模型,以便我可以获得 R 中术语的 LR 卡方?
很高兴提供任何其他必要的信息
更新输出
fit=with(data=imp, lm(Y~A+B+A*B))
est se t df Pr(>|t|)
(Intercept) 0.3425228 0.1762006 1.9439361 255.8431 0.0529994367
A2 -0.1345402 0.2227383 -0.6040284 341.5315 0.5462257933
A3 -0.6581980 0.1999631 -3.2915965 279.1284 0.0011243787
A4 -0.5027917 0.2059671 -2.4411255 339.3560 0.0151521258
A5 -0.4467593 0.2774011 -1.6105175 247.5980 0.1085590048
B2 -0.6132881 0.3177545 -1.9300690 309.3768 0.0545122193
A2:B2 0.8859492 0.4109083 2.1560752 339.6231 0.0317795829
A3:B2 1.2385945 0.3724444 3.3255827 331.7505 0.0009811451
A4:B2 1.0152149 0.3903675 2.6006649 312.3651 0.0097468231
A5:B2 0.9094596 0.4441705 2.0475463 307.5421 0.0414537211
使用建议的代码更新:
fit=with(data=imp, lm(Y~A:B))
- A 是 5 级变量,B 是二进制 (0, 1)
- A:B 确实遗漏了主要影响并产生了所有级别的分类预测变量(而不是 n-1)
问题:
使用 A:B 时,summary(pool(fit)) 不起作用;因此为每个估算数据生成单独的输出。问题:当只调用 A:B 时,有没有可能的方法来汇集所有估算集?
## summary of imputation 20 : Call: lm(formula = Y ~ A:B) Residuals: Min 1Q Median 3Q Max -2.1975 -0.6907 -0.1208 0.5958 3.9214 Coefficients: (1 not defined because of singularities) Estimate Std. Error t value Pr(>|t|) (Intercept) 0.12818 0.21814 0.588 0.5571 A1:B0 0.17252 0.27345 0.631 0.5285 A2:B0 0.07246 0.25964 0.279 0.7803 A3:B0 -0.46319 0.23698 -1.955 0.0513 . A4:B0 -0.32374 0.24517 -1.320 0.1874 A5:B0 -0.27642 0.29536 -0.936 0.3499 A1:B1 -0.45623 0.33321 -1.369 0.1717 A2:B1 0.35042 0.30480 1.150 0.2510 A3:B1 0.21691 0.27491 0.789 0.4306 A4:B1 0.13749 0.29015 0.474 0.6359 A5:B1 NA NA NA NA --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.9755 on 400 degrees of freedom Multiple R-squared: 0.08071, Adjusted R-squared: 0.06003 F-statistic: 3.902 on 9 and 400 DF, p-value: 9.099e-05
解决方案
推荐阅读
- php - 如何在邮递员请求之前检查正确的网址
- javascript - 无法执行方法数组javascript
- tfsbuild - 使用 Visual Studio 构建 TFS 2015 XAML
- ironpython - 如何使用 IronPython 从 Spotfire 中表的所有列中获取值
- android - 如何在不影响性能的情况下在布局中扩展多个 XML 文件。(约 70 种布局)
- angularjs - 剑道自动完成动态数据源(AngularJS,剑道 ui)
- django - Django 在管理页面上显示模型图像
- r - 来自 R 输出的神经网络方程
- ruby-on-rails - rails 电子邮件预览/策略指令:“style-src 'unsafe-inline'”
- javascript - 我缺少什么 javascript 代码来使我的模态在按下时打开?