midR

How does linear regression work in R?

Updated May 24, 2026

Short answer

lm() is used to build linear regression models.

Deep explanation

It estimates relationships between dependent and independent variables.

Real-world example

Predicting sales based on advertising spend.

Common mistakes

  • Ignoring assumptions of regression.

Follow-up questions

  • What are regression assumptions?
  • What is R-squared?

More R interview questions

View all →