简体   繁体   中英

Multiple Regression using R

Good morning everyone! I am learning R but I'm facing more than one difficulty by doing this! 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

...the problem is: how can I find 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?

Thanks

Use the I operator to inhibit interpretation of x^2 in your regression formula:

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  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM