Aan de slagGa gratis aan de slag

Linear regression with ols()

While sns.regplot() can display a linear regression trend line, it doesn't give you access to the intercept and slope as variables, or allow you to work with the model results as variables. That means that sometimes you'll need to run a linear regression yourself.

Time to run your first model!

taiwan_real_estate is available. TWD is an abbreviation for Taiwan dollars.

In addition, for this exercise and the remainder of the course, the following packages will be imported and aliased if necessary: matplotlib.pyplot as plt, seaborn as sns, and pandas as pd.

Deze oefening maakt deel uit van de cursus

Introduction to Regression with statsmodels in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Import the ols function
from ____ import ____

# Create the model object
mdl_price_vs_conv = ____(____, data=____)

# Fit the model
mdl_price_vs_conv = ____.____

# Print the parameters of the fitted model
print(____.____)
Code bewerken en uitvoeren