MATRIX-END MATRIX

The MATRIX and END MATRIX commands enclose statements that are executed by the matrix processor. Using matrix programs, you can write your own statistical routines in the compact language of matrix algebra. Matrix programs can include mathematical calculations, control structures, display of results, and reading and writing matrices as character files or data files.

MATRIX

matrix statements

END MATRIX

The following matrix language statements can be used in a matrix program: BREAK, CALL, COMPUTE, DISPLAY, DO IF, ELSE, ELSE IF, END IF, END LOOP, GET, LOOP, MGET, MSAVE, PRINT, READ, RELEASE, SAVE, WRITE.

The following functions can be used in matrix language statements:

ABS. Absolute values of matrix elements

ALL. Test if all elements are positive

ANY. Test if any element is positive

ARSIN. Arcsines of matrix elements

ARTAN. Arctangents of matrix elements

BLOCK. Create block diagonal matrix

CDFNORM. Cumulative normal distribution function

CHICDF. Cumulative chi-squared distribution function

CHOL. Cholesky decomposition

CMAX. Column maxima

CMIN. Column minima

COS. Cosines of matrix elements

CSSQ. Column sums of squares

CSUM. Column sums

DESIGN. Create design matrix

DET. Determinant

DIAG. Diagonal of matrix

EOF. Check end of file

EVAL. Eigenvalues of symmetric matrix

EXP. Exponentials of matrix elements

FCDF. Cumulative F distribution function

GINV. Generalized inverse

GRADE. Rank elements in matrix, using sequential integers for ties

GSCH. Gram-Schmidt orthonormal basis

IDENT. Create identity matrix

INV. Inverse

KRONECKER. Kronecker product of two matrices

LG10. Logarithms to base 10 of matrix elements

LN. Logarithms to base e of matrix elements

MAGIC. Create magic square

MAKE. Create a matrix with all elements equal

MDIAG. Create a matrix with the given diagonal

MMAX. Maximum element in matrix

MMIN. Minimum element in matrix

MOD. Remainders after division

MSSQ. Matrix sum of squares

MSUM. Matrix sum

NCOL. Number of columns

NROW. Number of rows

RANK. Matrix rank

RESHAPE. Change shape of matrix

RMAX. Row maxima

RMIN. Row minima

RND. Round off matrix elements to nearest integer

RNKORDER. Rank elements in matrix, averaging ties

RSSQ. Row sums of squares

RSUM. Row sums

SIN. Sines of matrix elements

SOLVE. Solve systems of linear equations

SQRT. Square roots of matrix elements

SSCP. Sums of squares and cross-products

SVAL. Singular values

SWEEP. Perform sweep transformation

T. Synonym for TRANSPOS

TCDF. Cumulative normal t distribution function

TRACE. Calculate trace (sum of diagonal elements)

TRANSPOS. Transposition of matrix

TRUNC. Truncation of matrix elements to integer

UNIFORM. Create matrix of uniform random numbers

Example

MATRIX.
READ A /FILE=MATRDATA /SIZE={6,6} /FIELD=1 TO 60.
CALL EIGEN(A,EIGENVEC,EIGENVAL).
LOOP J=1 TO NROW(EIGENVAL).
+ DO IF (EIGENVAL(J) > 1.0).
+   PRINT EIGENVAL(J) / TITLE="Eigenvalue:" /SPACE=3.
+   PRINT T(EIGENVEC(:,J)) / TITLE="Eigenvector:" /SPACE=1.
+ END IF.
END LOOP.
END MATRIX.