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.
This exercise is part of the course
Foundations of Inference in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Select all but the first twelve rents
la_rents_initial = ____
# Select all but the last twelve rents (12 month lag)
la_rents_lag = ____
# Compute the correlation between the initial values and the lagged values
____
# Check if the p-value is significant at the 5% level
____