[英]Multiple Regression using R
Good morning everyone! 大家,早安! I am learning R but I'm facing more than one difficulty by doing this! 我正在学习R,但是这样做却面临多个困难! I have this problem: Using the file wm1.txt in the package alr3, I have to estimate the parameters of this model: E(Y|X=x) = beta_0 + beta_1 x + beta_2 x^2 我有这个问题:使用包alr3中的wm1.txt文件,我必须估算该模型的参数:E(Y | X = x)= beta_0 + beta_1 x + beta_2 x ^ 2
...the problem is: how can I find beta2? ...问题是:如何找到beta2? I know that it is not linear function and I also could find b1 and b2 but now that I see this b2 I am lost.. What commands should I use? 我知道这不是线性函数,我也可以找到b1和b2,但是现在我看到这个b2我迷路了。我应该使用什么命令?
Thanks 谢谢
Use the I
operator to inhibit interpretation of x^2
in your regression formula: 使用I
运算符禁止对回归公式中x^2
解释:
library(alr3)
data(wm1)
lm(RSpd ~ CSpd + I(CSpd^2), data= wm1)
Output: 输出:
> lm(RSpd ~ CSpd + I(CSpd^2), data= wm1)
Call:
lm(formula = RSpd ~ CSpd + I(CSpd^2), data = wm1)
Coefficients:
(Intercept) CSpd I(CSpd^2)
1.073476 0.729228 0.001331
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.