Exercise

Autocorrelation

Do rent prices tend to show a similar pattern when compared year-over-year? If you take the rent prices in Los Angeles and compare them to rent prices one year in the past, will you see a significant relationship? In other words, do rent prices in Los Angeles demonstrate autocorrelation?

A NumPy array of rents has been loaded for Los Angeles (la_rents), as well as the dates associated with each measurement, have been loaded for you. The packages pandas as pd, NumPy as np, Matplotlib as plt, and the stats package from SciPy have all been loaded as well.

Instructions 1/2

undefined XP
    1
    2
  • Select all but the first twelve rents (to exclude the first year) from la_rents.
  • Select all but the last twelve rents (to exclude the last year) from la_rents.
  • Compute the Pearson correlation coefficient R between these two lists.
  • Check if the p-value is significant at the 5% level.