始める無料で始める

自己相関

家賃は前年比で似たパターンを示す傾向があるのでしょうか?ロサンゼルスの家賃を、1年前の家賃と比較すると、有意な関係が見られますか?言い換えると、ロサンゼルスの家賃には自己相関が見られるでしょうか?

ロサンゼルスの家賃を表す 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
____
コードを編集して実行