Mata course: Accuracy 2

1. Solvers vs. inversion

Pretend we have a numeric method to solve

AX = B

for X. Then that method can be used to obtain the inversion of
A, because inv(A) = X such that

AX = I

Hence, we use our method, and substitute B=I.

2. Is using a solver for inversion inaccurate?

No.

The B=I matrix contains 0s and 1s only:

1. Multiplying by 0 introduces no loss of precision: 0*z = 0.

2. Multiplying by 1 introduces no loss of precision: 1*z = z.

3. Adding 0 introduces no loss of precision: 0+z = z.

4. Adding 1 could introduce a loss of precision, but such terms
seldom (never) arise.

3. Is using a solver for inversion efficient?

No.

We do lots of calculations, just to multiply them by 0, which we add to other
nonzsero terms, and we are often multiplying or dividing results by 1.

4. Solving versus inverting

We statistician's are often thought to think in terms of inverses, e.g.,

b = (X'X)^(-1)X'y

Numerical types look down on us, because better is

Solve (X'X)b = X'y for b

That is because solving requires fewer operations (additions, importantly)
than inverting X'X and then multiplying the result by
X'y.

There are k^2 additions in that last multiplication.

Inverses serve a purpose

It is from inverses that we statisticians obtain our variances.

The way Stata's -regress- works

1. Form X'X and X'y.

(Formed accurately, with means removed.)

2. Invert X'X.

Use (X'X)^(-1) for standard errors (variance matrix).

3. Solve (X'X)b = X'y to obtain b.

Do not use use (X'X)^(-1) from step (2).

Concerning collinearity, it is identified at step (2) and then the reduced
problem is solved in step (3).

Top