Fit and diagnose regression models in R

8 steps · about 2 h 30 min · Intermediate

  1. Model formulae in R (interactions, offsets and I()) (reference, R stats Manual, 20 min)

    Learn how R's formula operators encode main effects, interactions, nesting and arithmetic transforms before fitting any model.

  2. Fitting linear models with lm() (reference, R stats Manual, 20 min)

    Fit ordinary least squares models, handle weights and missing-value actions, and understand the returned lm object.

  3. Summarizing linear model fits with summary.lm() (reference, R stats Manual, 15 min)

    Read coefficient estimates, standard errors, residual standard error and adjusted R-squared accurately.

  4. Diagnostic plots for linear models with plot.lm() (reference, R stats Manual, 20 min)

    Check residuals vs fitted, Q-Q normality, scale-location variance and Cook's distance leverage points.

  5. Predictions and confidence vs prediction intervals (reference, R stats Manual, 15 min)

    Distinguish mean confidence intervals from individual prediction intervals when scoring new observations.

  6. Fitting generalized linear models with glm() (reference, R stats Manual, 25 min)

    Extend regression to binary, count and positive skewed outcomes by choosing the right family and link function.

  7. Comparing candidate models with AIC and BIC (reference, R stats Manual, 15 min)

    Compare non-nested and nested model specifications while penalizing unnecessary complexity.

  8. Converting model outputs to tidy tibbles with broom (guide, Tidymodels Broom, 20 min)

    Use tidy(), glance() and augment() to turn model summaries and diagnostics into reproducible data frames for reporting.