248
13 Solutions for Selected Exercises
y=dlmread(’ex8_2.dat’); n=length(y);
gamma0=y’*y/n;
m=30; % maximum coefficients
acf=zeros(1,m);
for j=1:m
acf(j)=y(1:end-j)’*y(j+1:end); (8.8)
end
acf=acf/n; rho=acf/gamma0; bar(rho(1:m))
Only ρ 1 and ρ 2 are significantly above the noise level, which indicates that the data
come from a MA(2) process.
Exercise 8.3
After loading the data and calculating the autocorrelations ρ j in the same way as in
Exercise 8.2, we calculate the PACF in the following code snippet, which construct
the matrix from (8.21) for increasing size k. Then it solves for the coefficients φ j
and always records the highest coefficient φ j j as the PACF.
pacf(1)=rho(1);
for j=2:m
% up to some maximum, say m=4
a=eye(j);
for k=1:j % loop over lines
a(k,k+1:j)=rho(1:j-k);
a(k+1:j,k)=rho(1:j-k)’;
end
b=a\rho(1:j)’; % (8.22)
pacf(j)=b(j);
end
Plotting the PACF shows that the data is generated by an AR(3) process that has only
φ 3 significantly different from zero.
Exercise 8.4
The analysis follows the Box-Jenkins procedure outlined in Sect. 8.6 and the code
closely follows the code already shown in Exercises 8.1 to 8.3. As a result of the
analysis, shown on the left-hand side in Fig. 13.7, the residuals can be described by
an AR(2) process, despite the PACF having significant components at positions 12
and 13, albeit with opposite signs, which suggests they are an artefact of the noise.
In the spirit of building parsimonious models, we dare to ignore them, because the
model fits the data reasonably well, as shown on the right-hand side in Fig. 13.7.
Exercise 8.5
We use the following code snippet to symbolically evaluate the coefficients. Here we
treat the symbolic variable x as the lag operator, which was denoted ˆ
L in Sect. 8.7.
Précédent

- 255/292

Suivant