Introduction to Regression with statsmodels in Python
Maarten Van den Broeck
Content Developer at DataCamp
The $y$ value at the point when $x$ is zero.
The amount the $y$ value increases if you increase $x$ by one.
$y = \text{intercept} + \text{slope} * x$
from statsmodels.formula.api import ols
mdl_payment_vs_claims = ols("total_payment_sek ~ n_claims", data=swedish_motor_insurance)
mdl_payment_vs_claims = mdl_payment_vs_claims.fit()
print(mdl_payment_vs_claims.params)
Intercept 19.994486
n_claims 3.413824
dtype: float64
Intercept 19.994486
n_claims 3.413824
dtype: float64
$\text{total\_payment\_sek} = 19.99 + 3.41 * \text{n\_claims}$
Introduction to Regression with statsmodels in Python