Multivariate Statistical Techniques
Vector Operations in Mata


Mata is the new interactive matrix command language that comes with Stata beginning with Stata 9. To start Mata, type meta in the Stata command window. The end a Mata session, type end and press return.

Technically, Mata does not have any dedicated vector commands, it merely treats vectors as matrices with one column or one row. Thus, there are no commands for dot product or vector norm. We can still get the results we need using matrix commands in Mata.

The Vector

"Transpose" of a Vector

Adding Vectors

Subtracting Vectors

Multiplication by a Scalar

Vector Dot Product

Length of a Vector

Unit Length Vector

The Unit Vector


Multivariate Course Page

Phil Ender, 2may05