首页 > 解决方案 > 是否有可能在 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))

问题:

标签: rregressioninteractionchi-squaredimputation

解决方案


推荐阅读