# Covariance matrices

If you want to estimate the parameters of a covariance matrix S you must ensure that the resulting matrix is 1) symmetric and 2) positive definite. To achieve this you do not parameterize S directly, but rather its Cholesky factor L, i.e. S = LL', see

http://en.wikipedia.org/wiki/Cholesky_decomposition

The following two step procedure is recommended:

1) Parameterize the correlation matrix C via the Cholesky factor as explained here

2) Scale C with the standard deviations to obtained S.

Complete example given in C.tpl and C.dat.

**Constrained covariance matrices**

Sometimes you want elements in the C (or S) to be zero, say S(1,2) = 0, meaning the element 1 and 2 are uncorrelated. An example of how to achieve this is provided here: