← R Programming learning path
R Programming · Module 8 of 10

Regression and modelling

Build linear and logistic models.

📖 Key ideas

  1. lm(salary ~ experience, data = df) fits a linear regression.
  2. summary(model) shows coefficients and R-squared.
  3. predict(model, newdata) makes predictions.
  4. glm(..., family = binomial) fits logistic regression.
  5. tidymodels and caret offer full ML workflows.
💡 Real-life example: Regression draws the best straight road through scattered houses (data points).
lm()Linear model
R-squaredShare of variation explained
glm()Generalised linear model
predict()Makes predictions