WWW | Community | Store | Account | Contact Us
SHAZAM Homepage


The MATRIX command supports a full Matrix programming language and will do matrix operations on matrices and vectors. A comprehensive set of functions are available. Please see the chapter MATRIX MANIPULATION in the SHAZAM Reference Manual.

In general, the format is:

MATRIX newmat = f(oldmat)

The following logical operators are valid on the MATRIX command:

negation(-), multiplication(*), addition(+), subtraction(-), transpose('), Kronecker multiplication(@), Hadamard division(/) and Concatenation (|).

Regular matrix rules apply on the MATRIX command.

CHOL(matrix) Cholesky's decomposition of symmetric positive.
DET(matrix) Determinant of matrix.
DIAG(matrix) Diagonal.
EIGVAL(matrix) The eigenvalues of matrix are taken.
EIGVEC(matrix) The eigenvector of matrix is taken.
EXP(matrix) Exponential operator is applied to each element of matrix.
FACT(matrix) Factors the inverse of the matrix.
IDEN(ndim) Identity matrix is created.
IDEN(ndim,ndiag) A matrix with ndim rows and columns is created with a diagonal of ones on the ndiag lower diagonal. (ndiag=1 gives an identity matrix)
INT(matrix) Integer truncation of each element of matrix.
INV(matrix) Inverse of matrix.
LAG(matrix,n) Each column of the matrix is lagged n times.
LOG(matrix) Natural log of each element is taken.
NCDF(matrix) Normal cumulative density function.
NOR(nrow,ncol) Normally distributed numbers.
RANK(matrix) Rank of matrix is calculated.
SAMP(matrix,nrows) A new matrix with n rows is created by random sampling with replacement from the old matrix.
SEAS(nob,nseas) A series of seasonal dummy variables is created.
SEAS(nob,-ncross) A series of cross-section dummy variables is created.
SIN(matrix) Sine of each element of matrix is taken.
SQRT(matrix) Square root of each element of matrix is taken.
SVD(matrix) Singular Value Decomposition of matrix is performed.
SYM(matrix) Creates a symmetric matrix from a square full matrix.
TIME(nob,x) A vector with nob observations is created with values equal to a time index plus x.
TRACE(matrix) Trace of matrix is calculated.
TRI(matrix) Creates a lower triangular matrix from a square full matrix.
UNI(nrow,ncol) Random numbers between 0 and 1 is created.
VEC(matrix) Stacks columns of a matrix into a longer vector.
VEC(matrix,nrows) Unstacks a vector into a matrix with nrows.