在R中使用stepaic或可比较的功能,估计最合适的LM输出并估算以获取摘要



来自新的R用户的简单问题 - 我正在尝试在几个不同的回归模型中使用stepaic,我想找出如何根据输出来保存/估算回归来自Stepaic的最合适的"通话"。有没有办法做到这一点?谢谢,感谢任何帮助。

从stepaic返回的值具有" AOV"one_answers" LM",因此它将响应lm的普通结果会响应的所有功能。

library(MASS)   # running first example on the help page:
quine.hi <- aov(log(Days + 2.5) ~ .^4, quine)
quine.nxt <- update(quine.hi, . ~ . - Eth:Sex:Age:Lrn)
quine.stp <- stepAIC(quine.nxt,
    scope = list(upper = ~Eth*Sex*Age*Lrn, lower = ~1),
    trace = FALSE)

因此,这是其类值,然后是print -ED在控制台上的外观,尽管显然不是所有的组件。您可以使用names查找这些信息,并使用summary获取更多信息:

> class(quine.stp)
[1] "aov" "lm" 
> quine.stp
Call:
   aov(formula = log(Days + 2.5) ~ Eth + Sex + Age + Lrn + Eth:Sex + 
    Eth:Age + Eth:Lrn + Sex:Age + Sex:Lrn + Age:Lrn + Eth:Sex:Lrn + 
    Eth:Age:Lrn, data = quine)
Terms:
                     Eth      Sex      Age      Lrn  Eth:Sex  Eth:Age  Eth:Lrn
Sum of Squares  10.68203  0.62388  3.76424  0.65290  0.01533  5.98964  0.01246
Deg. of Freedom        1        1        3        1        1        3        1
                 Sex:Age  Sex:Lrn  Age:Lrn Eth:Sex:Lrn Eth:Age:Lrn Residuals
Sum of Squares   8.68925  0.57977  2.38640     4.69558     2.09602  66.59962
Deg. of Freedom        3        1        2           1           2       125
Residual standard error: 0.7299294
2 out of 23 effects not estimable
Estimated effects may be unbalanced

谢谢您的上述答复,这非常有用!我也找到了一个快速简便的解决方案,它是使用lm.beta库,该库存储具有低p值的系数。

最新更新