13 Solutions for Selected Exercises
247
n=1; m=N-4;
Fval=(chi2_p-chi2_q)/(chi2_q/m)
xhat=n*Fval/(m+n*Fval)
p_tail=1-betainc(xhat,n/2,m/2)
There are N = 51 data points, such that m = 47. The values are χ q = 51 by construction from part c), χ p = 52.24, which results in the value ˆ
f = 1.14 that is used
to prepare the right-hand plot in Fig. 13.6.
Exercise 7.6
The test results are stored in the array x and analyzed in the following code snippet,
which calculates the sample average and variance from (7.24) and then uses A(ˆ t, ν)
from (7.34) to calculate the 90% confidence interval.
X=mean(x); dx=x-X;
S=sqrt((1/(n-1))*sum(dx.ˆ2));
tt=X/(S/sqrt(n));
A=@(that,nu)1-betainc(nu./(nu+that.ˆ2),nu/2,0.5);
g=@(t)A(t,nu)-0.90;
% 90 % confidence
that=fzero(g,[0,20]); %
=2.13
mu1=X-that*S/sqrt(n); % lower bound =12.7
mu2=X+that*S/sqrt(n); % upper bound =17.7
The returned values are shown in the code.
Exercise 8.1
After reading the data from file and inspecting that the trend is indeed a straight line,
we determine the parameters of the line and subtract it from the data. Inspection of
the residual oscillation shows that the period is between 45 and 50. Testing several
values reveals the 47 is the likely period and differencing provides the residuals. The
following code snippet illustrates the procedure.
A=[x,ones(n,1)];
p=inv(A’*A)*A’*y
plot(x,y,’*’,x,polyval(p,x),’r’)
y2=y-polyval(p,x);
figure; plot(x,y2); title(’After removing the trend’)
figure; y3=y2(48:end)-y2(1:end-47);
subplot(2,1,1); plot(y3); title(’Residuals’)
subplot(2,1,2); histogram(y3,30)
Exercise 8.2
After reading in the data file, we calculate γ 0 and the auto-covariances γ j from (8.8).
In the end we divide by γ 0 to determine the autocorrelations ρ j , whose values we
display in a histogram.
Précédent

- 254/292

Suivant