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.
本练习是课程的一部分
Foundations of Inference in Python
交互式实操练习
通过完成这段示例代码来试试这个练习。
# 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
____