Dataplot Vol 2 Vol 1

# XTXINV MATRIX

Name:
XTXINV MATRIX (LET)
Type:
Let Subcommand
Purpose:
Compute the (X'X)-1 matrix.
Description:
The X-transpose X matrix is defined as:

XTXINV = (X'X)-1

The X matrix is typically a design matrix for a multiple linear regression.

The (X'X)-1 matrix is useful for many regression diagnostic computations. For example, the help for the FIT command describes the use of the (X'X)-1 matrix in generating partial regression plots, partial leverage plots, and variance inflation factors. It is also used to compute various intervals for multiple linear regression problems.

This command simplifies writing macros to compute these, as well as other, regression diagnostics. Although this matrix can be read in after performing a linear fit, this command simplifies its computation.

Syntax:
LET <mat2> = XTXINV MATRIX <mat1>               <SUBSET/EXCEPT/FOR qualification>
where <mat1> is the design matrix for which the (X'X)-1 matrix is to be computed;
<mat2> is a matrix where the resulting (X'X)-1 matrix is saved;
and where the <SUBSET/EXCEPT/FOR qualification> is optional (and rarely used in this context).
Examples:
LET XTXINV = XTXINV MATRIX X
Note:
Matrices are created with either the READ MATRIX, CREATE MATRIX, or the MATRIX DEFINITION command. Enter HELP CREATE MATRIX and HELP MATRIX DEFINITION and HELP READ MATRIX for details.
Note:
The columns of a matrix are accessible as variables by appending an index to the matrix name. For example, the 4x4 matrix C has columns C1, C2, C3, and C4. These columns can be operated on like any other DATAPLOT variable.
Note:
The maximum size matrix that DATAPLOT can handle is set when DATAPLOT is built on a particular site. Enter the command HELP MATRIX DIMENSION for details on the maximum size matrix that can be accomodated.
Default:
None
Synonyms:
None
Related Commands:
 FIT = Perform a least squares fit. CATCHER MATRIX = Compute the catcher matrix. PARTIAL REGRESSION PLOT = Compute the catcher matrix. VARIANCE INFLATION FACTORS = Compute variance inflation factors. CONDITION INDICES = Compute condition indices. MATRIX INVERSE = Compute a the inverse of a matrix.
Reference:
"Applied Linear Statistical Models", 3rd ed., Neter, Wasserman, and Kunter, 1990, Irwin.

"Applied Regression Analysis", 2nd ed., Draper and Smith, John Wiley, 1981.

"Residuals and Influence in Regression", Cook and Weisberg, Chapman and Hall, 1982.

"Regression Diagnostics", Belsley, Kuh, and Welsch, John Wiley, 1980.

Applications:
Regression Diagnostics
Implementation Date:
2002/6
Program:
```.  Sample program to compute DFBETA's
ECHO ON
DIMENSION 100 COLUMNS
SKIP 25
READ HALD647.DAT Y X1 X2 X3 X4
FIT Y X1 X2 X3 X4
SKIP 1
SKIP 0
.
LET N = SIZE X1
LET X0 = SEQUENCE 1 1 N
LET Z = CREATE MATRIX X0 X1 X2 X3 X4
.
LET XTXINV = XTXINV MATRIX Z
LET C = CATCHER MATRIX Z
LOOP FOR K = 1 1 5
LET TEMP1 = C^K
LET TEMP2 = XTXINV^K(K)
LET DFBETA^K = TEMP1*ESTUD/SQRT(TEMP2*(1-HII))
END OF LOOP
LET N = SIZE Y
LET XTEMP = SEQUENCE 1 1 N
.
CHARACTER B0 B1 B2 B3 B4 B5 BLANK BLANK
LINE BLANK BLANK BLANK BLANK BLANK DOTTED DOTTED
X1LABEL SEQUENCE
Y1LABEL DFBETA
TIC OFFSET UNITS SCREEN
TIC OFFSET 5 5
.
LET XGRID = DATA 1 N
LET YGRID = DATA 1 1
LET YGRID2 = DATA -1 -1
PLOT DFBETA1 DFBETA2 DFBETA3 DFBETA4 DFBETA5 VERSUS XTEMP AND
PLOT YGRID YGRID2 VERSUS XGRID
```

Date created: 7/22/2002
Last updated: 4/4/2003