*! version 1.0.1 May2013

help for matamatrix -- Mata matrix operations for Stata matrices (Version 1.0.0)

Syntax

matamatrix
[mname = ] matrix_expression

Description

matamatrix allows mata matrix operators and functions to be used on Stata matrices.

Examples

matamatrix A = (2, 3 \ 4, 5)

matamatrix B = exp(A[1,]) :- 10

matamatrix B

matamatrix exp(A[1,]) :- 10

Results saved in r() or e() can be used directly.

sysuse auto, clear

logit foreign price

matamatrix invlogit((10000, 1) * e(b)') // Estimating the probability of a car being foreign given a price of $10,000

matamatrix invlogit((10000,1) * e(b)' :+ (-1,1) :* invnormal(0.975) :* sqrt((10000, 1) * e(V) * (10000,1)')) // Deriving 95% confidence intervals

Subscripting can be applied directly to r() or e() matrices

matamatrix e(V)[1,1]

Note

- In theory, all functions in mata that return real matrices can be used, including user-defined ones. mata functions
that modify input matrices and output void matrices such as _invsym() are not supported. All variables in matamatrix must be Stata matrices.
scalars and mata variables cannot be included.

- If speed is an issue, then matamatrix may not be the best idea.

- matamatrix has not been tested on all mata commands. Please let me know if you encounter any bugs while using it.

Author

Timothy Mak

School of Public Health, University of Hong Kong

tshmak@hku.hk

May 2013