Output from imlinv3.sas

Source
0 Graphs

```NOTE: Capture of log output started.
```
```NOTE: %INCLUDE (level 1) file n:\psy6140\examples\iml\imlinv3.sas is file
n:\psy6140\examples\iml\imlinv3.sas.```
```644  +title 'IMLINV3: Generailzed inverse of a matrix';
645  +proc iml;```
`IML Ready`
```646  +   reset print log fuzz fw=6;
647  +*-- Construct a square, singular matrix [Timm, EX. 1.7.3];
648  +A = {4 4 -2, 4 4 -2, -2 -2 10};```
```                A             3 rows      3 cols    (numeric)

4      4     -2
4      4     -2
-2     -2     10

```
`649  +r = det(A);`
```                R             1 row       1 col     (numeric)

0

```
```650  +*-- rank is 2, so inv(A) wont work;
651  +r = echelon(A);```
```                R             3 rows      3 cols    (numeric)

1      1      0
0      0      1
0      0      0

```
`652  +r = inv(A);`
`ERROR: (execution) Matrix should be non-singular.`
``` operation : INV      at line   652 column   8
operands  : A

A             3 rows      3 cols    (numeric)

4      4     -2
4      4     -2
-2     -2     10

statement : ASSIGN          at line   652 column   1```
```653  +*-- Generalized inverse does exist for any  matrix
654  +    (but unlike ordinary inverse is not unique);
655  +AI = ginv(A);```
```                AI            3 rows      3 cols    (numeric)

0.0694 0.0694 0.0278
0.0694 0.0694 0.0278
0.0278 0.0278 0.1111

```
```656  +*--PROPERTIES OF GENERALIZED INVERSE (Moore-Penrose inverse);
657  +r = A * AI * A;```
```                R             3 rows      3 cols    (numeric)

4      4     -2
4      4     -2
-2     -2     10

```
`658  +r = AI * A * AI;`
```                R             3 rows      3 cols    (numeric)

0.0694 0.0694 0.0278
0.0694 0.0694 0.0278
0.0278 0.0278 0.1111

```
```659  +*--Both (A*AI) and (AI*A) are symmetric, but A * AI ^= AI * A ^= I;
660  +r = A * AI;```
```                R             3 rows      3 cols    (numeric)

0.5    0.5      0
0.5    0.5      0
0      0      1

```
`661  +r = AI * A;`
```                R             3 rows      3 cols    (numeric)

0.5    0.5      0
0.5    0.5      0
0      0      1

```
```662  +*--For a rectangular matrix, inv(A'A)*A' is the ginv of
663  +*  A if (A'A)- is ginv of (A'A) [TIMM: EX 1.6.11];
664  +A = J(4,1) || {1 0, 1 0, 0 1, 0 1};```
```                A             4 rows      3 cols    (numeric)

1      1      0
1      1      0
1      0      1
1      0      1

```
`665  +AA= t(A) *  A;`
```                AA            3 rows      3 cols    (numeric)

4      2      2
2      2      0
2      0      2

```
`666  +AAI= ginv(AA);`
```                AAI           3 rows      3 cols    (numeric)

0.1111 0.0556 0.0556
0.0556 0.2778 -0.222
0.0556 -0.222 0.2778

```
```667  +*--ginv of A is AAI * A';
668  +AI = AAI  *  t(A);```
```                AI            3 rows      4 cols    (numeric)

0.1667 0.1667 0.1667 0.1667
0.3333 0.3333 -0.167 -0.167
-0.167 -0.167 0.3333 0.3333

```
`669  +r = A * AI * A;`
```                R             4 rows      3 cols    (numeric)

1      1      0
1      1      0
1      0      1
1      0      1

```
`670  +r = AI * A * AI;`
```                R             3 rows      4 cols    (numeric)

0.1667 0.1667 0.1667 0.1667
0.3333 0.3333 -0.167 -0.167
-0.167 -0.167 0.3333 0.3333

```
`671  +quit;`
`Exiting IML.`
```NOTE: The PROCEDURE IML used 0.17 seconds.

```
`672  +`
`NOTE: %INCLUDE (level 1) ending.`