Matrix functions
Matrix construction
- MAKE(r,c,[v])Creates a r × c matrix (r rows and c columns) with all elements equal to v.
- MAGIC(n) Creates a n × n matrix with as elements the integers 1 through n2, with equal row and column sums.
- MRND(r,c) Creates a r × c matrix (r rows and c columns) with random numbers.
- DIAG(A) Creates a diagonal matrix.
- UNIT(A) Returns a unit matrix with the same dimensions of the square matrix A.
- ONES(A) returns a matrix with the same dimensions as matrix A with all elements equal to 1.
- ZERO(A) Returns a matrix with the same dimensions as matrix A with all elements equal to zero.
- CVEC(min,max,n) Returns a column vector with n number or rows, with evenly spaced values ranging from min to max.
- RVEC(min,max,n) Returns a row vector with n number or columns, with evenly spaced values ranging from min to max .
Add and remove columns and rows
- CBIND(A,B[,..]) Returns a matrix with matrix B appended to matrix A, columnswise.
- RBIND(A,B[,..]) Returns a matrix with matrix B appended to matrix A, rowwise.
- CDEL(A,c) Returns the matrix A without column c.
- RDEL(A,r) Returns the matrix A without row r.
- CLEAN(A) Returns a matrix with empty columns and rows with missing data removed.
Matrix properties
- INDEX(A,r,c) Returns an element, row, or column of a matrix.
- NORM(A) Returns the 2-norm of a vector or matrix.
- NCOL(A) Returns the number of columns of a matrix.
- NROW(A) Returns the number of rows of a matrix.
- TRACE(A) Returns the sum of the elements on the main diagonal of a matrix.
Matrix Operations and Transformations
- KRON(A,B) Returns the Kronecker tensor product of matrices A and B.
- INV(A) Returns the inverse matrix of a matrix.
- PINV(A) Returns the Moore-Penrose Pseudoinverse of a matrix.
- RANK(A) Returns an estimate of the number of linearly independent rows or columns of a matrix.
- TRANSPOSE(A) Returns the transpose of a matrix.
- WINSORIZE(A,k) Returns a matrix with column-wise winsorized values.
Linear Equations
- BALANCE(A) Returns a better-balanced matrix with the same eigenvalues.
- DETERM(A) Returns the determinant of a matrix.
- HESSENBERG(A) Generates a Hessenberg matrix.
- EIG(A[,v]) Returns the Eigenvalues of matrix A.
- SOLVE(A,B) Solves the equation AX=B for X.
- MCOV(A) Returns the variance-covariance matrix.
- MCOR(A) Returns the correlation matrix.
- SSCP(A) Returns a matrix with sums of squares and cross-products.
Resampling
- RESAMPLE(A) Returns a matrix with the same dimension of A, containing a random selection of rows of A (resampling with replacement). Some rows of A may be duplicated in the result matrix, others may be missing.
- SUBSAMPLE(A,n) Returns a matrix with n number of rows, selected randomly from the rows of matrix A. Each row of A can only be present once in the result matrix.
Matrix statistical functions
- CMAX(A) Returns a row vector with column maxima.
- CMIN(A) Returns a row vector with column minima.
- CSSQ(A) Returns a row vector with the sum of the squared values of each column.
- CSUM(A) Returns a row vector with column totals.
- MMAX(A) Returns the numerically maximum value in a matrix.
- MMIN(A) Returns the numerically minimum value in a matrix.
- MSSQ(A) Returns the sum of the squared values of all of the elements in a matrix.
- MSUM(A) Returns the sum of all of the elements in a matrix.
- RMAX(A) Returns a column vector with row maxima.
- RMIN(A) Returns a column vector with row minima.
- RSSQ(A) Returns a column vector with the sum of the squared values of each row.
- RSUM(A) Returns a row vector with row totals.
See also
Recommended book
Matrix Algebra Useful for Statistics
Shayle R. Searle, Andre I. Khuri
Buy from Amazon
This book addresses matrix algebra that is useful in the statistical analysis of data as well as within statistics as a whole. The material is presented in an explanatory style rather than a formal theorem-proof format and is self-contained.