Aan de slagGa gratis aan de slag

Visualizing parallel slopes model predictions

To make sure you've got the right predictions from the previous exercise, you can add them to a seaborn plot. To visualize multiple regression predictions, you use the same procedure as with linear regression: draw a scatter plot with a trend line and add a second layer of prediction points on the same plot. As you've seen in a previous exercise, seaborn can't plot the parallel slopes model directly. Therefore, you'll first re-extract the model coefficients before you plot the prediction points.

taiwan_real_estate and prediction_data are available, and mdl_price_vs_both is available as a fitted model.

Deze oefening maakt deel uit van de cursus

Intermediate Regression with statsmodels in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Extract the model coefficients, coeffs
coeffs = ____

# Print coeffs
print(coeffs)

# Assign each of the coeffs
____, ____, ____, ____  = ____
Code bewerken en uitvoeren