Вы находитесь на странице: 1из 3

Stat5307 HW

November 13, 2017

Problem 3.9:
Generate n = 100 observations from each of the three models discussed in Problem,3.8. Compute the sample
ACF for each model and compare it to the theoretical values. Compute the sample PACF for each of the
generated series and compare the sample ACFs and PACFs with the general results given in Table 3.1.

#Theoretical Values:
#ARMA(1,1)
acf.arma=ARMAacf(ar = .6, ma = .9, lag.max = 20, pacf = FALSE)
pacf.arma=ARMAacf(ar = .6, ma = .9, lag.max = 20, pacf = TRUE)
#ARMA(1,0)
acf.ar=ARMAacf(ar = .6, ma = 0, lag.max = 20, pacf = FALSE)
pacf.ar=ARMAacf(ar = .6, ma = 0, lag.max = 20, pacf = TRUE)
#ARMA(0,1)
acf.ma=ARMAacf(ar = 0, ma = .9, lag.max = 20, pacf = FALSE)
pacf.ma=ARMAacf(ar = 0, ma = .9, lag.max = 20, pacf = TRUE)
par(mfrow=c(2,3))
plot(acf.arma, type ='h', main="ACF of ARMA(1,1)")
abline(h=0)
plot(acf.ar, type ='h', main="ACF of ARMA(1,0) - AR(1)")
abline(h=0)
plot(acf.ma, type ='h', main="ACF of ARMA(0,1)- MA(1)")
abline(h=0)
plot(pacf.arma, type ='h', main="PACF of ARMA(1,1)")
abline(h=0)
plot(pacf.ar, type ='h', main="PACF of ARMA(1,0)- AR(1)")
abline(h=0)
plot(pacf.ma, type ='h', main="PACF of ARMA(0,1) - MA(1)")
abline(h=0)

1
0.8
ACF of ARMA(1,1) ACF of ARMA(1,0) − AR(1) ACF of ARMA(0,1)− MA(1)

0.8

0.8
acf.arma

acf.ma
acf.ar
0.4

0.4

0.4
0.0

0.0

0.0
5 10 15 20 5 10 15 20 5 10 15 20

Index Index Index

PACF of ARMA(1,1) PACF of ARMA(1,0)− AR(1) PACF of ARMA(0,1) − MA(1)


0.8

0.6
0.4
pacf.arma

0.4

0.2
pacf.ma
pacf.ar
0.0

0.2

−0.2
−0.4

0.0

5 10 15 20 5 10 15 20 5 10 15 20

Index Index Index

#Sample Values n= 100


ARMA = arima.sim(n=100, list(order=c(1,0,1), ma=.9, ar=0.6)) #ARMA(1,1)
AR = arima.sim(n=100, list(order=c(1,0,0) , ar=0.6)) # ARMA(1,0) = AR(1)
MA = arima.sim(n=100, list(order=c(0,0,1), ma=.9)) # ARMA(0,1) = MA(1)
par(mfrow=c(2,3))
acf(ARMA, lag.max = 20)
acf(AR, lag.max = 20)
acf(MA, lag.max = 20)
pacf(ARMA, lag.max = 20)
pacf(AR, lag.max = 20)
pacf(MA, lag.max = 20)

2
Series ARMA Series AR Series MA
1.0

1.0

1.0
0.6

0.6

0.6
ACF

ACF

ACF
−0.2 0.2

0.2

0.2
−0.2

−0.2
0 5 10 15 20 0 5 10 15 20 0 5 10 15 20

Lag Lag Lag

Series ARMA Series AR Series MA


0.8

0.4

0.2 0.4
Partial ACF

Partial ACF

Partial ACF
0.4

0.2
0.0

−0.2 0.0

−0.2
−0.6

5 10 15 20 5 10 15 20 5 10 15 20

Lag Lag Lag

Comparision:
ARMA(1,1) model: both the theoretical and sample ACF and PACF values tails off.
AR(1) model: Theoretical ACF tails off and PACF cuts off after lag 1, sample ACF tails off and sample
PACF cuts off after lag 1.
MA(1) model: Theoretical ACF cuts off and PACF tails off, sample ACF cuts off after lag 1 and sample
PACF tails off.
In general, both theoretical and sample ACF and PACF’s are similar for all models, but as the sample size
get larger the sample ACF and PACF should become more similar to theoretical values.

Вам также может понравиться