User Manual

112 Section 4: Using Matrix Operations
112
and
.)(||
ˆ
||E
22
pn
F
bXy
For b 0. When the simpler model y = r is correct, both of these expectations equal σ
2
.
You can test the hypothesis that the simpler model is correct (against the alternative that the
original model is correct) by calculating the F ratio
)(||
ˆ
||
||
ˆ
||
2
2
pn
p
F
F
F
bXy
bX
F will tend to be larger when the original model is true (b 0) than when the simpler model
is true (b = 0). You reject the hypothesis when F is sufficiently large.
If the random errors have a normal distribution, the F ratio has a central F distribution with p
and (n p) degrees of freedom if b = 0, and a non central distribution if b 0. A statistical
test of the hypothesis (with probability α of incorrectly rejecting the hypothesis) is to reject
the hypothesis if the F ratio is larger than the 100α percentile of the central F distribution
with p and (n p) degrees of freedom; otherwise, accept the hypothesis.
The following program fits the linear model to a set of n data points x
i1
, x
i2
, …, x
ip
, y
i
by the
method of least-squares. The parameters b
1
, b
2
, …, b
p
are estimated by the solution
b
ˆ
to the
normal equations X
T
Xb = X
T
y. The program also estimates σ
2
and the parameter covariance
matrix Cov(
b
ˆ
). The regression and residual sums of squares (Reg SS and Res SS) and the
residuals are also calculated.
The program requires two matrices:
Matrix A: n × p with row i (x
i1
, x
i2
, …, x
ip
) for i = 1, 2, ... , n.
Matrix B: n × 1 with element i (y
i
) for i = 1, 2, ... , n.
The program output is:
Matrix A: unchanged.
Matrix B: n × 1 containing the residuals from the fit (y
i
1
b
ˆ
x
i1
p
b
ˆ
x
ip
)
for i = 1, 2, ... , n, where
i
b
ˆ
is the estimate for b
i
.
Matrix C: p × p covariance matrix of the parameter estimates.
Matrix D: p × 1 containing the parameter estimates
1
ˆ
b
, …,
p
b
ˆ
.
T-register: contains an estimate of σ
2
.
Y-register: contains the regression sum of squares (Reg SS).
X-register: contains the residual sum of squares (Res SS).