Declaring Matrix Objects

You must declare a matrix object for it to exist in the workfile. A listing of the declaration statements for the various matrix objects is provided in “Object Creation Commands”.

Briefly, a matrix object declaration consists of the object keyword, along with size information in parentheses and the name to be given to the object, followed (optionally) by an assignment statement. If no assignment is provided, the object will be initialized to have all zero values.

The various matrix objects require different sizing information. A matrix requires the number of rows and the number of columns. A sym requires that you specify a single number representing both the number of rows and the number of columns. A vector, rowvector, or coef declaration can include information about the number of elements. A scalar requires no size information. If size information is not provided, EViews will assume that there is only one element in the object.

For example:

matrix(3,10) xdata

sym(9) moments

vector(11) betas

rowvector(5) xob

creates a matrix XDATA, a symmetric matrix MOMENTS, an column vector BETAS, and a rowvector XOB. All of these objects are initialized to zero.

One common operation, creating and filling a vector in one-step, may be performed using the @fill function, as in

vector v = @fill(1,4,6,21.3)

which returns a 4 element vector, where the first element is set to 1, the second to 4, the third to 6 and the fourth to 21.3.

To change the size of a matrix object, you may repeat the declaration statement. Furthermore, if you use an assignment statement with an existing matrix object, the target will be resized as necessary. For example:

sym(10) bigz

matrix zdata

matrix(10,2) zdata

zdata = bigz

will first declare ZDATA to be a matrix with a single element, and then redeclare ZDATA to be a matrix. The assignment statement in the last line will resize ZDATA so that it contains the contents of the symmetric matrix BIGZ.