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

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -