# [R] Ensuring a matrix to be positive definite, case involving three matrices

Pacin Al jokloq at gmail.com
Fri Nov 18 15:07:25 CET 2011

```Hi,

I would like to know what should I garantee about P and GGt in order to have

F = Z %*% P %*% t(Z) + GGt always as a positive definite matrix.

Being more precise:

I am trying to find minimum likelihood parameters by using the function
'optim' to find the lowest value generated by \$LogLik from the function
'fkf' (http://127.0.0.1:27262/library/FKF/html/fkf.html).

The variable Kt within the algorithm used to generate the Kalman Filter
equations needs in each iteration the inverse of the variable Ft, ("Kt[,, i]
= Pt[,, i] %*% t(Zt[,, i]) %*% solve(Ft[,, i])") which is updated by "Ft[,,
i] = Zt[,, i] %*% Pt[,, i] %*% t(Zt[,, i]) + GGt[,, i]".

Zt is a constant 2x4 matrix and can't be changed. Gt (2x2) and P0 (4x4) are
inputs for 'fkf'. Pt is updated in each iteration, starting with P0. GGt is
constant and one of the parameters tested by 'optim' to minimize the LogLik
(by the way, GGt is always positive definite). Except for the first
parameters that I give to 'optim', I can't control its tested parameters,
which will be used as the inputs of 'fkf' (except, as I sad, for Gt, because
I ask 'optim' to give GLt, the lower triangular matrix of Gt, giving as
input to 'fkf' GLt %*% t(GLt) ).

Since the process stops every time a non positive matrix Ft appears, I would
like to know if are there any transformations that could be applied to GGt
and P0, given by 'optim', to be sure that Ft will be always positive
definite.

--
View this message in context: http://r.789695.n4.nabble.com/Ensuring-a-matrix-to-be-positive-definite-case-involving-three-matrices-tp4083376p4083376.html
Sent from the R help mailing list archive at Nabble.com.

```