【发布时间】:2014-05-19 18:37:35
【问题描述】:
在 R 逐步前向回归中,我指定了一个最小模型和一组要添加(或不添加)的变量:
min.model = lm(y ~ 1)
fwd.model = step(min.model, direction='forward', scope=(~ x1 + x2 + x3 + ...))
有没有办法指定使用矩阵/data.frame 中的所有变量,所以我不必枚举它们?
举例说明我想做什么,但它们不起作用:
# 1
fwd.model = step(min.model, direction='forward', scope=(~ ., data=my.data.frame))
# 2
min.model = lm(y ~ 1, data=my.data.frame)
fwd.model = step(min.model, direction='forward', scope=(~ .))
【问题讨论】:
标签: r regression