![](https://assets.isu.pub/document-structure/230101182555-1179cabb6e9ce02cd5c0b77a54fb27cf/v1/462ec9072d57b5ffbac6eab7f038e043.jpeg?width=720&quality=85%2C50)
1 minute read
Naive Bayes������������������������������������������������������������������������������������������������������������������
Chapter 6 ■ SuperviSed Learning
## Call: ## lm(formula = dist ~ speed + I(speed^2), data = .) ## ## Residuals: ## Min 1Q Median 3Q Max ## -28.720 -9.184 -3.188 4.628 45.152 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 2.47014 14.81716 0.167 0.868 ## speed 0.91329 2.03422 0.449 0.656 ## I(speed^2) 0.09996 0.06597 1.515 0.136 ## ## Residual standard error: 15.18 on 47 degrees of freedom ## Multiple R-squared: 0.6673, Adjusted R-squared: 0.6532
Advertisement
Figure 6-7. The cars data fitted to a second degree polynomial
## F-statistic: 47.14 on 2 and 47 DF, p-value: 5.852e-12
Or we can plot it like this (see Figure 6-7):
cars %>% ggplot(aes(x = speed, y = dist)) + geom_point() + geom_smooth(method = "lm", formula = y ~ x + I(x^2))
This is a slightly better fitting model, but that wasn’t the point. You can see how you can transform data in a formula to have different features to give to your fitting algorithms.
144