stats::lm() uses ordinary least squares to fit models with numeric outcomes.


For this engine, there is a single mode: regression

Tuning Parameters

This engine has no tuning parameters.

Translation from parsnip to the original package

linear_reg() %>% 
  set_engine("lm") %>% 

## Linear Regression Model Specification (regression)
## Computational engine: lm 
## Model fit template:
## stats::lm(formula = missing_arg(), data = missing_arg(), weights = missing_arg())

Preprocessing requirements

Factor/categorical predictors need to be converted to numeric values (e.g., dummy or indicator variables) for this engine. When using the formula method via fit.model_spec(), parsnip will convert factor columns to indicators.


The “Fitting and Predicting with parsnip” article contains examples for linear_reg() with the "lm" engine.


  • Kuhn, M, and K Johnson. 2013. Applied Predictive Modeling. Springer.