ComeçarComece de graça

Visualizing multiple models

In the last two exercises, you ran models for each category of house ages separately, then calculated predictions for each model. Now it's time to visualize those predictions to see how they compare.

When you use sns.lmplot() with the hue argument set to the categorical variable, you get multiple trend lines, each with their own slope. This is in contrast with the parallel slopes model you saw in Chapter 1, where all models had the same slope.

taiwan_real_estate is available. prediction_data is loaded as a concatenated DataFrame of all house ages.

Este exercício faz parte do curso

Intermediate Regression with statsmodels in Python

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Plot the trend lines of price_twd_msq vs. n_convenience for each house age category
____(x=____,
     y=____,
     data=____,
     hue=____,
     ci=____,
     legend_out=False)

plt.show()
Editar e executar o código