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.
Questo esercizio fa parte del corso
Introduction to Regression with statsmodels in Python
Istruzioni dell'esercizio
- 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.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# 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.____()