Matrix Language Reference

The following entries constitute a listing of the functions and commands used in the EViews matrix language. For a description of the EViews matrix language, see “Matrix Language”.

Matrix Command and Function Summary

Matrix Utility Commands

colplace Places column vector into matrix.

matplace Places matrix object in another matrix object.

mtos Converts a matrix object to series or group.

nrnd Fill the matrix with normal random numbers.

rnd Fill the matrix with uniform random numbers.

rowplace Places a rowvector in matrix object.

stom Converts series or group to vector or matrix after removing observations with NAs.

stomna Converts series or group to vector or matrix without removing observations with NAs.

ttom Fills a matrix with the numeric contents of a table.

Matrix Utility Functions

@capplyranks Reorder the rows of the matrix using a vector of ranks.

@colranks Returns a matrix where each column contains the ranking of the values of the corresponding column of m.

@columnextract Extracts column from matrix.

@columns Number of columns in matrix object.

@colsort Returns a matrix where each column contains the sorted values of the corresponding column of m.

@convert Converts series or group to a vector or matrix after removing NAs.

@explode Creates square matrix from a sym matrix object.

@fill Create and fill a vector with a list of values.

@filledmatrix Creates matrix filled with scalar value.

@filledrowvector Creates rowvector filled with scalar value.

@filledsym Creates sym filled with scalar value.

@filledvector Creates vector filled with scalar value.

@first Returns the first non-missing value in the vector or series.

@hcat Horizontally concatenate two matrix objects.

@identity Creates identity matrix.

@ifirst Returns the index of the first non-missing value in the vector or series.

@ilast Returns the index of the last non-missing value in the vector or series.

@implode Creates sym from lower triangle of square matrix.

@kronecker Computes the Kronecker product of two matrix objects.

@lag Returns a matrix with rows shifted down or up.

@last Returns the last non-missing value in the vector or series.

@makediagonal Creates a square matrix with ones down a specified diagonal and zeros elsewhere.

@maxes Returns a vector of maximal values of an object, arranged from high to low.

@mins Returns a vector of minimal values of an object, arranged from low to high.

@mnrnd Creates a matrix, sym or vector of normal random numbers.

@mrnd Creates a matrix, sym or vector of uniform random numbers.

@ones Creates a matrix, sym or vector of ones.

@permute Permutes the rows of the matrix.

@ranks Obtain the ranks of a matrix or vector.

@rapplyranks Reorder the rows of the matrix using a vector of ranks.

@resample Randomly draws from the rows of the matrix.

@rowextract Extracts rowvector from matrix object.

@rowranks Returns a matrix where each row contains the ranking of the values of the corresponding row of m.

@rows Returns the number of rows in matrix object.

@scale Scale the rows or columns of a matrix, or the rows and columns of a sym matrix.

@sort Sorts a matrix or vector.

@subextract Extracts submatrix from matrix object.

@transpose Transposes matrix object.

@uniquevals Returns a vector or svector containing the list of unique values in the object (series, vector, alpha, matrix)

@unitvector Extracts column from an identity matrix.

@unvec Unstack vector into a matrix object.

@unvech Unstack vector into the lower triangular portion of sym matrix.

@vcat Vertically concatenate two matrix objects.

@vec Stacks columns of a matrix object.

@vech Stacks the lower triangular portion of matrix by column.

Matrix Algebra Functions

@cholesky Computes the Cholesky factorization.

@commute Creates the commutation matrix.

@cond Calculates the condition number of a square matrix or sym.

@det Calculate the determinant of a square matrix or sym.

@duplic Returns the duplication matrix.

@duplicinv Returns the generalized inverse of the duplication matrix.

@eigenvalues Returns a vector containing the eigenvalues of a sym.

@eigenvectors Returns a square matrix whose columns contain the eigenvectors of a matrix.

@elimin Returns the elimination matrix.

@inner Computes the inner product of two vectors or series, or the inner product of a matrix object.

@inverse Returns the inverse of a square matrix object or sym.

@issingular Returns 1 if the square matrix or sym is singular, and 0 otherwise.

@norm Computes the norm of a matrix object or series.

@outer Computes the outer product of two vectors or series, or the outer product of a matrix object.

@pinverse Returns the Moore-Penrose pseudo-inverse of a square matrix object or sym.

@qform Compute the quadratic form of a symmetric matrix and a matrix or vector .

@rank Returns the rank of a matrix object.

@svd Performs singular value decomposition.

@svd Performs singular value decomposition.

@trace Computes the trace of a square matrix or sym.

Matrix Element Functions

@ediv Computes element by element division of two matrices.

@eeq Computes element by element equality comparison of two matrices.

@eeqna Computes element by element equality comparison of two matrices.

@ege Computes element by element tests for whether the elements in the matrix or sym are greater than or equal to corresponding elements in another matrix or sym .

@egt Computes element by element tests for whether the elements in the matrix or sym are strictly greater than corresponding elements in another matrix or sym .

@einv Computes element by element inversion of a matrix.

@ele Computes element by element tests for whether the elements in the matrix or sym are less than or equal to corresponding elements in another matrix or sym .

@elt Computes element by element tests for whether the elements in the matrix or sym are strictly less than corresponding elements in another matrix or sym .

@emult Computes element by element multiplication of two matrices.

@eneq Computes element by element inequality comparison of two matrices.

@eneqna Computes element by element inequality comparison of two matrices.

@epow Raises each element in a matrix to a power.

Matrix Descriptive Statistics Functions

You may use any of the descriptive statistics functions that are described in “Descriptive Statistics”. These statistics will be applied to the matrix object as a whole so that, for example, using @mean computes the mean taken over all non NA values in the matrix.

In addition, the following functions have special forms that apply to matrix objects:

@cor Computes correlation between two vectors, or between the columns of a matrix.

@cov Computes covariance between two vectors, or between the columns of a matrix using as the divisor.

@covp Computes covariance between two vectors, or between the columns of a matrix using as the divisor.

@covs Computes covariance between two vectors, or between the columns of a matrix using as the divisor.

@inner Computes the inner product of two vectors or series, or the inner product of a matrix object.

Matrix Column Functions

There are a number of column functions that return results computed for each column of the matrix:

@cfirst Returns the value of the first non-missing value in each column of a matrix.

@cifirst Returns the index of the first non-missing value in each column of a matrix.

@cilast Returns the index of the last non-missing value in each column of a matrix.

@cimax Returns the index of the maximal value in each column of a matrix.

@cimin Returns the index of the minimal value in each column of a matrix.

@cilast Returns the index of the last non-missing value in each column of a matrix.

@clast Returns the value of the last non-missing value in each column of the matrix.

@cmax Returns the maximal value in each column of a matrix.

@cmean Returns the mean value in each column of a matrix.

@cmedian Returns the column median.

@cmin Returns the minimal value for each column of the matrix.

@cnas Returns the number of NA values in each column of a matrix.

@cobs Returns the number of non-NA values in each column of a matrix.

@cprod Returns the column product.

@cquantile Returns the column quantile q using the Cleveland definition.

@cstdev Returns the column sample standard deviation.

@cstdevs Returns the column sample standard deviation.

@cstdevp Returns the column population standard deviation.

@csum Returns the sum of each column of a matrix.

@csumsq Returns the column sum of squared values.

@cvar Returns the column population variance.

@cvarp Returns the column population variance.

@cvars Returns the column sample variance.

Additional Functions

In addition, EViews also supports matrix element versions of the following categories of functions:

Category | Matrix Element Support |

addition, subtraction, multiplication, and comparison operators (note that the comparison operators perform the comparison for every element of the matrix object and return a 1 if true for all elements, and a 0 if the comparison fails for any element). | |

All, except for “@inv” and “@recode”. | |

All | |

All | |

All |