How to I rewrite this code library(ISLR) data(Auto) fit <- lm(mpg ~ horsepower, data = Auto) summary(fit) with a python code
I tried typing the above code in Jupyter notebook but instead, I got error messages
How to I rewrite this code library(ISLR) data(Auto) fit <- lm(mpg ~ horsepower, data = Auto) summary(fit) with a python code
I tried typing the above code in Jupyter notebook but instead, I got error messages
If you do wish to switch to using Python, see this answer to 'What is the equivalent of R's lm function for fitting simple linear regressions in python?'. That also includes the equivalent to the line summary(fit)
.
Also related is here or here or here or R vs Python: Linear Regression.