Autoregressive 모형 기초개념

2019-05-31

.

그림, 실습코드 등 학습자료 출처 : https://datascienceschool.net

1. Autoregressive 모델 개요

0

2. AR(1) 모델

1

2

3

%matplotlib inline
%config InlineBackend.figure_format = 'retina'

lag = np.arange(12)

plt.subplot(221)
acf = 0.9 ** lag
plt.stem(acf)
plt.xlim(-0.2, 11.2)
plt.ylim(-0.1, 1.1)

plt.subplot(222)
acf = 0.4 ** lag
plt.stem(acf)
plt.xlim(-0.2, 11.2)
plt.ylim(-0.1, 1.1)

plt.subplot(223)
acf = (-0.8) ** lag
plt.stem(acf)
plt.xlim(-0.2, 11.2)
plt.ylim(-1.1, 1.1)

plt.subplot(224)
acf = (-0.5) ** lag
plt.stem(acf)
plt.xlim(-0.2, 11.2)
plt.ylim(-1.1, 1.1)

plt.suptitle("example of auto-correlation function of AR(1) model")
plt.show()

Autoregressive 모형 기초개념_6_0

4

k-시차에 따라서 Yt 와 Yt−k는 지속적으로 강한 상관관계를 보인다. 그러다 점점 차수가 지날수록 서서히 작아진다.

3. AR(2) 모형

5

6

import statsmodels.api as sm

plt.subplot(221)
p1 = sm.tsa.ArmaProcess([1, -0.5, -0.25], [1])
plt.stem(p1.acf(11))
plt.xlim(-0.1, 10.1)

plt.subplot(222)
p1 = sm.tsa.ArmaProcess([1, -1, 0.25], [1])
plt.stem(p1.acf(11))
plt.xlim(-0.1, 10.1)

plt.subplot(223)
p1 = sm.tsa.ArmaProcess([1, -1.5, 0.75], [1])
plt.stem(p1.acf(11))
plt.xlim(-0.1, 10.1)

plt.subplot(224)
p1 = sm.tsa.ArmaProcess([1, -1, 0.6], [1])
plt.stem(p1.acf(11))
plt.xlim(-0.1, 10.1)

plt.suptitle("example of auto-correlation function of AR(2) model")
plt.show()

Autoregressive 모형 기초개념_11_0