Visualizing predictions
The prediction DataFrame you created contains a column of explanatory variable values and a column of response variable values. That means you can plot it on the same scatter plot of response versus explanatory data values.
prediction_data is available. The code for the plot you created using sns.regplot() in Chapter 1 is shown.
Deze oefening maakt deel uit van de cursus
Introduction to Regression with statsmodels in Python
Oefeninstructies
- Create a new figure to plot multiple layers.
- Extend the plotting code to add points for the predictions in
prediction_data. Color the points red. - Display the layered plot.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Create a new figure, fig
fig = ____
sns.regplot(x="n_convenience",
y="price_twd_msq",
data=taiwan_real_estate,
ci=None)
# Add a scatter plot layer to the regplot
sns.____(____)
# Show the layered plot
plt.____()