I am looking for just the value of the B1(newx)
linear model coefficient, not the name. I just want the 0.5 value. I do not want the name "newx".
newx <- c(0.5,1.5,2.5)
newy <- c(2,3,4)
out <- lm(newy ~ newx)
out
looks like:
Call:
lm(formula = newy ~ newx)
Coefficients:
(Intercept) newx
1.5 1.0
I arrived here. But now I am stuck.
out$coefficients["newx"]
newx
1.0
as.numeric(out$coefficients["newx"])
– Hershelhershellnewx
(2) instead of the name likeout[[1]][[2]]
. – Spinneret