自相关
租金价格在按年同比比较时是否往往呈现相似的模式?如果拿洛杉矶的租金价格与其一年前的价格进行比较,是否会看到显著关系?换句话说,洛杉矶的租金价格是否表现出自相关?
已为您加载了一个包含洛杉矶租金的 NumPy 数组 la_rents,以及与每次测量对应的 dates。同时已加载 pandas(命名为 pd)、NumPy(命名为 np)、Matplotlib(命名为 plt)以及 SciPy 中的 stats 包。
本练习是课程的一部分
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
____