Hi,
I have a following problem. I would like to add a variable^2 into OLS model in R. However, in the output the squared variable disappears.
See following simple code:
df <- data.frame(dep = c(20,203,404,502,304,24,25),
name = c("A","A","A","B","B","B","B" ) ,
indep = c(5,7,1,10,6,8,15))
formula = dep ~ indep + indep**2
summary(lm(formula, df))
Call:
lm(formula = formula, data = df)
Residuals:
1 2 3 4 5 6 7
-227.45 -15.02 97.70 328.12 71.27 -179.31 -75.31
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 321.02 163.22 1.967 0.106
indep -14.71 19.31 -0.762 0.481
Residual standard error: 205.9 on 5 degrees of freedom
How is it possible? I want to have estimates of indep, but also indep^2.
Thank you.