r - Covariance matrix not positive definite -
i'm trying solve portfolio optimization problem quadprog
library, solve.qp
function returns this:
matrix d in quadratic function not positive definite!
but, i'm defining dmat
as:
dmat <- cov(diff(as.matrix(na.locf(prices))))
how can turn dmat
in positive definite matrix?
thanks help. discovered cov.shrink function corpcor library, , i'm defining dmat as:
cov.shrink(diff(as.matrix(na.locf(precos_mes))))
which works positive definite matrix.
Comments
Post a Comment