我正在尝试使用lm(poly)为某些点获取多项式回归,但对它返回的回归公式系数有一些疑问。
像这样的示例:
非常感谢!
像这样的示例:
x = seq(1,100) y = x ^ 2 + 3 * x + 7 fit = lm(y〜poly(x,2))结果是:
lm(formula = y〜poly(x,2))
系数:
(Intercept)poly(x,2)1 poly(x,2)2 3542 30021 7452为什么系数不是7,3,2?
非常感谢!
lm(y~x+I(x^2))
或lm(y~poly(x, 2, raw=TRUE))
。 - Ferdinand.kraft