Home Articles

在Anova表中对多元线性回归分组回归量

Asked
Viewed 1663 times
0

我在R上运行回归

fbReg <- lm(y~x2+x7+x8,table.b1)

然后我运行Anova表来分析回归的重要性

anova(fbReg)

Analysis of Variance Table

Response: y
          Df  Sum Sq Mean Sq F value    Pr(>F)    
x2         1  76.193  76.193  26.172 3.100e-05 ***
x7         1 139.501 139.501  47.918 3.698e-07 ***
x8         1  41.400  41.400  14.221 0.0009378 ***
Residuals 24  69.870   2.911                      
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

我有什么办法可以让我的anova表加上x2,x7,x8的所有平方和,而不是将它们分开 .

基本上,让anova表看起来像这样

df  SS       MS         FvAL   PR(>F)
Regression        3   257.094   ETC....
Error(Residual)  24  69.870    ETC.....

谢谢

1 Answer

  • 2

    为了说明我的评论:

    > lm2 <- lm(Fertility ~ Catholic+Education+Agriculture, data = swiss)
    
    > lm1 <- lm(Fertility ~ 1, data = swiss)
    
    > anova(lm1,lm2)
    Analysis of Variance Table
    
    Model 1: Fertility ~ 1
    Model 2: Fertility ~ Catholic + Education + Agriculture
      Res.Df    RSS Df Sum of Sq      F    Pr(>F)    
    1     46 7178.0                                  
    2     43 2567.9  3    4610.1 25.732 1.089e-09 ***
    ---
    Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    

Related