Simple Linear Regression describes the relationship between two variables:
- A predictor variable X
- A response variable Y
The goal is to fit a straight line through the data that best explains how Y changes as X changes.
Simple Linear Regression describes the relationship between two variables:
The goal is to fit a straight line through the data that best explains how Y changes as X changes.
The regression line takes the form:
Y = \(\beta_0\) + \(\beta_1\) X + \(\varepsilon\)
Can we predict an NBA player’s points per game from their minutes per game?
# fit the regression model model <- lm(PointsPerGame ~ MinutesPerGame, data = nba) # view the results summary(model)
## ## Call: ## lm(formula = PointsPerGame ~ MinutesPerGame, data = nba) ## ## Residuals: ## Min 1Q Median 3Q Max ## -9.1653 -1.6110 0.3389 1.8049 8.0497 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 2.02597 0.97949 2.068 0.0419 * ## MinutesPerGame 0.57680 0.03704 15.574 <2e-16 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 2.822 on 78 degrees of freedom ## Multiple R-squared: 0.7567, Adjusted R-squared: 0.7535 ## F-statistic: 242.5 on 1 and 78 DF, p-value: < 2.2e-16
The fitted model is:
\[Points = 2.03 + 0.58 \times \text{Minutes}\]