Introduction to R Programming

Simple Linear Regression

Equation: yi = a + bxi + ei

(Check assumption after testing)

Assumptions of the Simple Linear Regression Model:

  1. linear relationship between x and the expected value of y
  2. independence between any given (xi, yi) pair and any given (xj, yj) pair
  3. error terms e is normally distributed
  4. error terms for all values of x has equal variance


  5. Interpretation:

    We estimate that for every 1 unit increase in the age, the expected lung capacity will increase by 0.54485.


    More Linear Regression Output

    • Predicted values for observed data

                        predict(mod) 

    • Residuals 

                        resid(mod)

              Residuals are actual error terms from the estimated line. residuals = yi - estimated yi

Multiple Linear Regression

R Diagnostic Plots - Checking Regression Assumptions

Diagnostic plots:

  • Residuals vs. Fitted
  • Normal Q-Q
  • Scale-Location
  • Residuals vs. Leverage
Marriott Library Eccles Library Quinney Law Library