Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Eviews5 / EViews5 / Docs / EViews 5 Command Ref.pdf
Скачиваний:
91
Добавлен:
23.03.2015
Размер:
5.23 Mб
Скачать

@inner—619

@inner

Matrix Algebra Function

 

 

Syntax: @inner(v1, v2, smp)

Argument 1: vector, rowvector, or series, v1

Argument 2: vector, rowvector, or series, v2

Argument 3: (optional) sample, smp

Return: scalar

Syntax: @inner(o, smp)

Argument 1: matrix object or group, o

Argument 2: (optional) sample, smp

Return: scalar

If used with two vectors, v1 and v2, @inner returns the dot or inner product of the two vectors. Examples:

scalar sc1 = @inner(v1, v2) s1(1,2) = @inner(v1, r1)

If used with two series, @inner returns the inner product of the series using observations in the workfile sample. You may provide an optional sample.

If used with a matrix or sym, o, @inner returns the inner product, or moment matrix, oo. Each element of the result is the vector inner product of two columns of the source matrix. The size of the resulting sym is the number of columns in o. Examples:

scalar sc1 = @inner(v1) sym sym1 = @inner(m1)

If used with a group, @inner returns the uncentered second moment matrix of the data in the group, g, using the observations in the sample, smp. If no sample is provided, the workfile sample is used. Examples:

sym s2 = @inner(gr1)

sym s3 = @inner(gr1, smp1)

See also @outer (p. 623).

620—Appendix G. Matrix Reference

@inverse

Matrix Algebra Function

 

 

Syntax:

@inverse(m)

Argument:

square matrix or sym, m

Return:

matrix or sym

Returns the inverse of a square matrix object or sym. The inverse has the property that the product of the source matrix and its inverse is the identity matrix. The inverse of a matrix returns a matrix, while the inverse of a sym returns a sym. Note that inverting a sym is much faster than inverting a matrix.

Examples:

matrix m2 = @inverse(m1) sym s2 = @inverse(s1)

sym s3 = @inverse(@implode(m2))

See @solvesystem (p. 626).

@issingular

Matrix Algebra Function

 

 

Syntax:

@issingular(o)

Argument:

matrix or sym, o

Return:

integer

Returns “1” if the square matrix or sym, o, is singular, and “0” otherwise. A singular matrix has a determinant of 0, and cannot be inverted. Example:

scalar sc1 = @issingular(m1)

@kronecker

Matrix Algebra Function

 

 

Syntax:

@kronecker(o1, o2)

Argument 1:

matrix object, o1

Argument 2:

matrix object, o2

Return:

matrix

Calculates the Kronecker product of the two matrix objects, o1 and o2. The resulting matrix has a number of rows equal to the product of the numbers of rows of the two

@makediagonal—621

matrix objects and a number of columns equal to the product of the numbers of columns of the two matrix objects. The elements of the resulting matrix consist of submatrices consisting of one element of the first matrix object multiplied by the entire second matrix object. Example:

matrix m3 = @kronecker(m1,m2)

@makediagonal

Matrix Utility Function

 

 

Syntax: @makediagonal(v, k)

Argument 1: vector or rowvector, v

Argument 2: (optional) integer, k

Return: matrix

Creates a square matrix with the specified vector or rowvector, v, in the k-th diagonal relative to the main diagonal, and zeroes off the diagonal. If no k value is provided or if k is set to 0, the resulting matrix will have the same number of rows and columns as the length of v, and will have v in the main diagonal. If a value for k is provided, the matrix has the same number of rows and columns as the number of elements in the vector plus k, and will place v in the diagonal offset from the main by k.

Examples:

matrix m1 = @makediagonal(v1)

matrix m2 = @makediagonal(v1,1)

matrix m4 = @makediagonal(r1,-3)

M1 will contain V1 in the main diagonal; M2 will contain V1 in the diagonal immediately above the main diagonal; M4 will contain R1 in the diagonal 3 positions below the main diagonal. Using the optional k parameter may be useful in creating covariance matrices for AR models. For example, you can create an AR(1) correlation matrix by issuing the commands:

matrix(10,10) m1

vector(9) rho = .3

m1 = @makediagonal(rho,-1) + @makediagonal(rho,+1)

m1 = m1 + @identity(10)

622—Appendix G. Matrix Reference

matplace

Matrix Utility Command

 

 

Syntax:

matplace(m1, m2, n1, n2)

Argument 1:

matrix, m1

Argument 2:

matrix, m2

Argument 3:

integer, n1

Argument 4:

integer, n2

Places the matrix object m2 into m1 at row n1 and column n2. The sizes of the two matrices do not matter, as long as m1 is large enough to contain all of m2 with the upper left cell of m2 placed at row n1 and column n2.

Example:

matrix(100,5) m1

matrix(100,2) m2

matplace(m1,m2,1,1)

mtos

Matrix Utility Command

 

 

Convert matrix to a series or group. Fills a series or group with the data from a vector or matrix.

Syntax

Vector Proc: mtos(vector, series[, sample])

Matrix Proc: mtos(matrix, group[, sample])

Matrix-TO-Series Object. Include the vector or matrix name in parentheses, followed by a comma and then the series or group name. The number of included observations in the sample must match the row size of the matrix to be converted. If no sample is provided, the matrix is written into the series using the current workfile sample. Example:

mtos(mom,gr1)

converts the first column of the matrix MOM to the first series in the group GR1, the second column of MOM to the second series in GR1, and so on. The current workfile sample length must match the row length of the matrix MOM. If GR1 is an existing group object, the number of series in GR1 must match the number of columns of MOM. If a group object named GR1 does not exist, EViews creates GR1 with the first series named SER1, the second series named SER2, and so on.

Соседние файлы в папке Docs