Stata 15 help for mf__factorsym


[M-5] _factorsym() -- Factor a symmetric nonnegative-definite matrix


real scalar _factorsym(real matrix A[, real scalar tol])


_factorsym(A) factors a symmetric nonnegative-definite matrix A to a lower triangular matrix and overwrites A with the solution. Returned is the rank of A. For a matrix with dimension n and rank r < n, the resulting matrix has n - r rows with zeros. The optional argument tol is the tolerance used to determine whether the matrix is nonnegative definite. The default is tol = sum(abs(diagonal(A)))*epsilon(16).


The decomposition G of a symmetric nonnegative-definite matrix A is

A = GG'

where G is lower triangular.

A generalized inverse (G-inverse) can be computed from the factored matrix G by typing

: G = A

: rank = _factorsym(G)

: Ai = I(n)

: rank = _solvelower(G,Ai)

: Ai = Ai'Ai

: mreldif(A,A*Ai*A)

You can compare this G-inverse Ai with that computed from invsym().


_factorsym(A) input: A: n x n tol: 1 x 1 (optional) output: A: n x n result: 1 x 1


_factorsym(A) uses the elements from the lower triangle of A without checking whether A is symmetric.

Source code

_factorsym() is built-in.

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index