# Finding predictions from a linear model

I'm trying to educate myself about predictive analytics and am using R to generate a linear model with the following data.

age     <- c(23,   19,   25,   10,9, 12,   11, 8, 13)
steroid <- c(27.1, 22.1, 21.9, 10.7,  7.4, 18.8, 14.7, 5.7)
gpa     <- c( 2.1,  2.9,  2.8,  3.5,  3.2,  3.9,  2.8, 2.6)
sample  <- data.frame(age, steroid, gpa)
fit2    <- lm(steroid~age+gpa)
summary(fit2)
newdata <- data.frame(age=15, gpa=3.2)
predict(fit2, newdata, interval="predict")  # I want the fitted / predicted value


From the summary for the linear model, I have information on the coefficients associated with each predictor. However, I want to go further and find the predicted probability of information from this data. So for someone who is 13 and has a GPA of 3.3, what's the predicted probability of them ranking high on the steroid scale? What about for someone who is age 10? etc.

I understand explanatory modeling and have no problem implementing that in R, I just have issues with using R to construct meaningful predictive analytics. If you have any insights on this, feel free to share.

• Your age variable has fewer values than steroid or gpa. That means R will recycle 23, 19 (add them on to the end of age to make it equal length). You should be sure you want that. (I would bet you don't.) – gung - Reinstate Monica Aug 28 '13 at 2:59
• Regarding your main question, you need to clarify what "the predicted probability of them ranking high" means. – gung - Reinstate Monica Aug 28 '13 at 3:00