Visualizing three numeric variables
There are also some "flat" alternatives to 3D plots that provide easier interpretation, though they require a little thinking about to make. A good approach is plotting the two numeric explanatory variables on the x- and y-axis of a scatter plot, and coloring the points according to the response variable.
taiwan_real_estate
is available.
Diese Übung ist Teil des Kurses
Intermediate Regression with statsmodels in Python
Anleitung zur Übung
- Calculate the square-root of the distance to the nearest MRT stop as
sqrt_dist_to_mrt_m
. - With the
taiwan_real_estate
dataset, draw a scatter plot ofsqrt_dist_to_mrt_m
versus the number of nearby convenience stores, colored by house price.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Transform dist_to_mrt_m to sqrt_dist_to_mrt_m
taiwan_real_estate["sqrt_dist_to_mrt_m"] = ____
# Draw a scatter plot of sqrt_dist_to_mrt_m vs. n_convenience colored by price_twd_msq
____
# Show the plot
plt.show()