Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

ST534 HW1 solution

1.1

library(astsa)

## Warning: package 'astsa' was built under R version 3.4.3


data("EQ5")
data("EXP6")
ts.plot(EQ5, EXP6, col=c(1,2), lty=c(1,2),
main="Earthquake vs. Explosion")
legend("bottomleft", legend=c("Earthquake", "Explosion"),
col=c(1,2), lty=c(1,2), cex=0.6)

Earthquake vs. Explosion


0.4
0.2
0.0
−0.4 −0.2

Earthquake
Explosion

0 500 1000 1500 2000

Time
Overall, the earthquake and explosion have the similiar fluctuation in the phase P and phase S. Also, their
maximal amplitude tend to be equal.
In phase P, the earthquake and explosion have smaller amplitudes, while in phase S, the amplitudes for both
are much larger.

1.2

(a)

1
s1 = c(rep(0,100), 10*exp(-(1:100)/20)*cos(2*pi*1:100/4))
x1 = s1 + rnorm(200, 0, 1)
plot.ts(x1)
5
x1

0
−5

0 50 100 150 200

Time

(b)

s2 = c(rep(0,100), 10*exp(-(1:100)/200)*cos(2*pi*1:100/4))
x2 = s2 + rnorm(200, 0, 1)
plot.ts(x2)

2
10
5
x2

0
−5
−10

0 50 100 150 200

Time

(c)

We found that the modulating function in (b) decays way slower than that of (a) and produces a longer
signal.

1.7
When h = 0, we have
2
γ(t, t) = Cov(wt−1 + 2wt + wt+1 , wt−1 + 2wt + wt+1 ) = E(wt−1 ) + 4E(wt2 ) + E(wt+1
2 2
) = 6σw

When h = ±1, we have

γ(t, t + 1) = Cov(wt−1 + 2wt + wt+1 , wt + 2wt+1 + wt+2 ) = 2E(wt2 ) + 2E(wt+1


2 2
) = 4σw

When h = ±2, we have


2 2
γ(t, t + 2) = Cov(wt−1 + 2wt + wt+1 , wt+1 + 2wt+2 + wt+3 ) = E(wt+1 ) = σw

When |h| ≥ 3, we have γ(t, t + h) = 0


Therefore, we write the autocovariance function

3
 2

 6σw h=0
4σ 2

h=±1
w
γ(t, t + h) = 2


 σ w h=±2
0 |h| ≥ 3

The autocorrelation function


γ(t, t + h)
ρh =
γ(t, t)
so we have



1 h=0
2

h=±1
ρ(h) = 3
1
 h=±2
6


0 |h| ≥ 3

TrueAcf <- c(1,2/3,1/6,rep(0,7)); Lag <- seq(0,9)


plot(Lag, TrueAcf, type="h", main="True ACF", col="red",
ylim=c(-0.2,1), xlab="Lag")
abline(h=0)

True ACF
1.0
0.8
0.6
TrueAcf

0.4
0.2
−0.2

0 2 4 6 8

Lag

4
1.8

(a)

x1 = δ + w 1
x2 = 2δ + w1 + w2
x3 = 3δ + w1 + w2 + w3

Pt−1 Pt
If xt−1 = (t − 1)δ + k=1 wk , then xt = δ + xt−1 + wt = tδ + k=1 wk By induction, we have

t
X
xt = tδ + wk
k=1

(b)

We calculate the mean function

t
X
E(xt ) = E(δt + wk ) = δt
k=1

Without loss of generality, we consider s ≤ t, then we find the autocovariance function

Xs t
X
γ(s, t) = Cov(xs , xt ) = E[(xs − δs)(xt − δt)] = E( wi wj )
i=1 j=1

= E[(w1 + . . . + ws )(w1 + . . . + ws + ws+1 + . . . + wt )]


Xs
= E(wi2 ) = sσw 2

i=1

(c)

xt is not stationary since the mean function is not constant and the autocovariance function does not depend
on the lag h = |s − t|.

(d)

From (b), we know that

r
2
(t − 1)σw t−1
ρx (t − 1, t) = p p =
(t − 1)σw2 2
tσw t

q
t−1
When t → ∞, t → 1, which implies that the series will change very slowly as time increasing.

You might also like