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

c - Calling a function within a loop -

vb.net - Unbound DataGridView add row with checkbox error -

How i fill combobox items in Radgridview manually using in vb.net -