Fit and diagnose regression models in R
8 steps · about 2 h 30 min · Intermediate
- 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.
- 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.
- 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.
- 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.
- Predictions and confidence vs prediction intervals (reference, R stats Manual, 15 min)
Distinguish mean confidence intervals from individual prediction intervals when scoring new observations.
- 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.
- Comparing candidate models with AIC and BIC (reference, R stats Manual, 15 min)
Compare non-nested and nested model specifications while penalizing unnecessary complexity.
- 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.