Exercise

Significance of Difference of Estimates

A line plot with error bars gives you a rough idea of trends, but are the year-to-year differences statistically significant? In this exercise, you will determine significance of changing median home prices in Philadelphia. You will evaluate the differences from year to year between 2011 and 2017.

The formula for the two-sample Z-statistic is:

$$Z = \frac{x_1 - x_2}{\sqrt{SE_{x_1}^2 + SE_{x_2}^2}}$$

A DataFrame philly is available with columns median_home_value, median_home_value_moe, and year.

pandas is imported as pd, and the sqrt function has been imported from the numpy module.

Instructions

100 XP
  • Set x1 to the current year median home value, and x2 to the median home value for the prior year (current year minus 1)
  • Set se_x1 to the current year MOE of the median home value divided by Z_CRIT, and se_x2 to the same calculation for the prior year
  • Use Python's ternary operator (result1 if condition else result2) to return the empty string if the absolute value of z is greater than Z_CRIT, and otherwise return "not "