자기상관
임대료는 해마다 비슷한 패턴을 보일까요? 로스앤젤레스의 임대료를 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
____