開始使用免費開始

自我相關(Autocorrelation)

租金價格在逐年比較時,是否傾向呈現相似的走勢?如果你拿洛杉磯的租金價格與前一年的租金相比,會看到顯著的關係嗎?換句話說,洛杉磯的租金是否呈現自我相關?

已為你載入洛杉磯的租金 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
____
編輯並執行程式碼