O'Reilly logo

R Statistical Application Development by Example Beginner's Guide by Prabhanjan Narayanachar Tattar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – limitations of linear regression models

A linear regression model is built for the dataset with a binary output. The model is used to predict the probabilities for some cases, which shows the limitations:

  1. Load the dataset from the RSADBE package with data(sat).
  2. Visualize the scatter plot of Pass against Sat with plot(sat$Sat, sat$Pass,xlab="SAT Score", ylab = "Final Result").
  3. Fit the simple linear regression model with passlm <- lm(Pass~Sat, data=sat) and obtain its summary by summary(passlm). Add the fitted regression line to the scatter plot using abline(passlm).
  4. Make a prediction for students with SAT-M scores of 400 and 700 by using the R code predict(passlm,newdata=list(Sat=400)) and predict( passlm, newdata=list(Sat=700),interval="prediction") ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required