I am using solve.QP
in quadprog
package of R to solve the classical mean-variance optimization problem. In my understanding, the output component "value" means the variance of the optimized portfolio and many codes for the mean-variance optimization posted online also show that sqrt(sol$value)
is the standard deviation of the optimized portfolio.
However, when I use solve.QP
to solve a simple mean-variance optimization, sol$value
provides me a negative value which is also different from the value calculated by using the portfolio variance function: w%*%covariance%*%t(w)
. I was trying to search online for the definition or the algorithm for sol$value
but unfortunately I could not find detailed description. The R Documentation for quadprog
only states that "value" is "scalar, the value of the quadratic function at the solution".
So could anyone who is familiar with solve.QP
could tell me the exact definition or algorithm of sol$value
. And if my understanding about it is correct, namely the variance of the optimized portfolio, then what is the possible reason that solve.QP
provides me negative values for sol$value
.