我想在使用R的回归中指定仅包含交互项(在两个分类变量之间)的模型 .

使用MICE估算数据 .

模型看起来像:

fit=with(data=imp, lm(Y~A*B))

而不是:

fit=with(data=imp, lm(Y~A+B+A*B))

当然,两种模型都产生相同的输出,包括所有级别的分类变量的两个主要效果和交互效应 .

有没有办法调用一个仅限INTERCEPT模型,这样我就能在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)

  • 答: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