1. 学习
  2. /
  3. 课程
  4. /
  5. Intermediate Regression with statsmodels in Python

Connected

练习

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.

说明 1 / 共 2 个

undefined XP
    1
    2
  • Get the coefficients from mdl_price_vs_both, assigning to coeffs.
  • Look at coeffs and see which coefficient corresponds to which element.
  • Assign each of the elements of coeffs to the appropriate variable: ic_15_30, ic_30_45, slope, and ic_0_15, in the right order.