ie 515 hw5.docx

advertisement
IE 515 HW5 zhao wu
4.
(a)
wt<-rnorm(100,sd=1)
xt<-filter(wt,c(-0.9,1),method="recursive")
xt
Time Series:
Start = 1
End = 100
Frequency = 1
[1] -1.694916e+00 2.375257e+00 -5.046482e+00 8.391622e+00 -1.239976e+01
[6] 1.885781e+01 -2.978510e+01 4.515143e+01 -6.989720e+01 1.092269e+02
[11] -1.683124e+02 2.597000e+02 -4.033238e+02 6.218653e+02 -9.625739e+02
[16] 1.488356e+03 -2.302937e+03 3.562370e+03 -5.508752e+03 8.519270e+03
[21] -1.317528e+04 2.037695e+04 -3.151369e+04 4.874016e+04 -7.538182e+04
[26] 1.165839e+05 -1.803079e+05 2.788611e+05 -4.312835e+05 6.670176e+05
[31] -1.031598e+06 1.595456e+06 -2.467507e+06 3.816213e+06 -5.902098e+06
[36] 9.128105e+06 -1.411739e+07 2.183376e+07 -3.376777e+07 5.222476e+07
[41] -8.077005e+07 1.249178e+08 -1.931961e+08 2.987943e+08 -4.621109e+08
[46] 7.146941e+08 -1.105336e+09 1.709496e+09 -2.643882e+09 4.088990e+09
[51] -6.323973e+09 9.780566e+09 -1.512648e+10 2.339440e+10 -3.618144e+10
[56] 5.595770e+10 -8.654337e+10 1.338467e+11 -2.070054e+11 3.201516e+11
[61] -4.951419e+11 7.657793e+11 -1.184343e+12 1.831688e+12 -2.832863e+12
[66] 4.381265e+12 -6.776001e+12 1.047967e+13 -1.620770e+13 2.506660e+13
[71] -3.876764e+13 5.995747e+13 -9.272936e+13 1.434139e+14 -2.218019e+14
[76] 3.430356e+14 -5.305339e+14 8.205160e+14 -1.268998e+15 1.962614e+15
[81] -3.035351e+15 4.694431e+15 -7.260339e+15 1.122874e+16 -1.736620e+16
[86] 2.685832e+16 -4.153869e+16 6.424313e+16 -9.935751e+16 1.536649e+17
[91] -2.376559e+17 3.675552e+17 -5.684556e+17 8.791652e+17 -1.359704e+18
[96] 2.102899e+18 -3.252314e+18 5.029981e+18 -7.779297e+18 1.203135e+19
(b)
v <-filter(xt, sides=1, rep(1,4)/4,method="convolution")
v
Time Series:
Start = 1
End = 100
Frequency = 1
[1]
NA
NA
NA
2.450798e+00 -3.733856e+00 5.456096e+00 -8.918265e+00
[11] -2.095784e+01
3.267931e+01 -5.067733e+01
1.860809e+02 -2.888223e+02 4.463040e+02 -6.902405e+02
[21] -1.650598e+03
2.553048e+03 -3.948187e+03
1.460713e+04 -2.259142e+04 3.493881e+04 -5.403661e+04
[31] -1.292506e+05
1.998980e+05 -3.091579e+05
1.006370e+00
1.367400e+01
7.748227e+01
1.067488e+03
6.107035e+03
8.357183e+04
4.781409e+05
-1.669841e+00
-1.210831e+02
-9.444600e+03
-7.394842e+05
IE 515 HW5 zhao wu
1.143678e+06 -1.768794e+06 2.735593e+06 -4.230826e+06
[41] -1.011983e+07
1.565118e+07 -2.420589e+07
8.954534e+07 -1.384895e+08 2.141859e+08 -3.312569e+08
[51] -7.923423e+08
1.225425e+09 -1.895225e+09
7.011043e+09 -1.084318e+10 1.676990e+10 -2.593609e+10
[61] -6.203724e+10
9.594590e+10 -1.483886e+11
5.489367e+11 -8.489777e+11 1.313017e+12 -2.030693e+12
[71] -4.857269e+12
7.512182e+12 -1.161823e+13
4.297956e+13 -6.647157e+13 1.028040e+14 -1.589951e+14
[81] -3.803048e+14
5.881739e+14 -9.096613e+14
3.365128e+15 -5.204459e+15 8.049141e+15 -1.244869e+16
[91] -2.977635e+16
4.605167e+16 -7.122285e+16
2.634761e+17 -4.074884e+17 6.302157e+17 -9.746825e+17
>
6.543336e+06
3.743649e+07
5.123171e+08
2.931128e+09
4.011239e+10
2.294956e+11
3.140640e+12
1.796859e+13
2.458996e+14
1.406869e+15
1.925296e+16
1.101522e+17
1.507430e+18
-5.789873e+07
-4.533240e+09
-3.549346e+11
-2.778996e+13
-2.175843e+15
-1.703599e+17
-5e+18
0e+00
xt
5e+18
1e+19
(c)
plot.ts(xt)
lines.ts(v,lty=2)
0
20
40
60
80
100
Time
(d)
From t=0 to t=85, Xt is around 0; For t >= 85, Xt starts to flipping up and down and the absolute
value of Xt grows extremely fast.
By applying the moving average filter, the graph looks much smoother, and the oscillation would
be slower.
IE 515 HW5 zhao wu
(e)
acf(xt)
-0.5
0.0
ACF
0.5
1.0
Series xt
0
5
10
15
20
Lag
acf(xt)
Autocorrelations of series ‘xt’, by lag
0
1
2
3
4
5
6
7
8
9
10
1.000 -0.647 0.418 -0.270 0.175 -0.113 0.073 -0.047 0.030 -0.020 0.013
For h=0, by the given formula, it’s obviously that ACF(0)=1.
For h=1, since 𝑋𝑡 = −0.9 ∗ 𝑋𝑡−1 + 𝑊𝑡 , we can see that 𝑋𝑡 and 𝑋𝑡−1 are negatively correlated,
that’s why ACF(1)=-0.647.
For h=2, since 𝑋𝑡 = −0.9 ∗ 𝑋𝑡−1 + 𝑊𝑡 = 0.81 ∗ 𝑋𝑡−2 − 0.9 ∗ 𝑊𝑡−1 + 𝑊𝑡 , we can see that 𝑋𝑡
and 𝑋𝑡−2 are positively correlated, that’s why ACF(2)=0.418.
For h=3, since 𝑋𝑡 = −0.9 ∗ 𝑋𝑡−1 + 𝑊𝑡 = 0.81 ∗ 𝑋𝑡−2 − 0.9 ∗ 𝑊𝑡−1 + 𝑊𝑡 = −0.729 ∗ 𝑋𝑡−3 + ⋯
So again 𝑋𝑡 and 𝑋𝑡−3 are negatively correlated but this time the absolute value of coefficient is
smaller, thus the absolute value of ACF(3) is less than the absolute value of ACF(1) and the sign is
negative.
For the same reason, the absolute value of ACF(4) is less than the absolute value of ACF(2) and
the sign is positive.
Download