# Polynomial regression models return different values: `lm(dist ~ speed+I(speed^2), data=cars)` and `lm(dist ~ poly(speed, degree = 2), data = cars)`

Advertisements Using the cars data in R, I would like to create a polynomial regression model with varying degree values. Through research online I have found two methods of creating these models: library(tidyverse) data(cars) # method 1 polyreg_deg2 <- lm(dist ~ speed+I(speed^2), data=cars) # method 2 polyreg_deg2_again <- lm(dist ~ poly(speed, degree = 2), data… Read More Polynomial regression models return different values: `lm(dist ~ speed+I(speed^2), data=cars)` and `lm(dist ~ poly(speed, degree = 2), data = cars)`