x
  in the mean-variance sense.## S3 method for class 'default':
portfolio.optim(x, pm = mean(x), riskless = FALSE,
                shorts = FALSE, rf = 0.0, reslow = NULL, reshigh = NULL,
                covmat = cov(x), ...)pm and
  no other portfolio exists, which has the same mean return, but a
  smaller variance. Inequality restrictions of the form $w_l \le w
  \le w_h$ can be imposed using the reslow and
  reshigh vectors. An alternative covariance matrix estimate can
  be supplied via the covmat argument. To solve the quadratic
  program, solve.QP is used.  portfolio.optim is a generic function with methods for
  multivariate "ts" and default for matrix.
Missing values are not allowed.
C. Huang and R. H. Litzenberger (1988): Foundations for Financial Economics, Elsevier, NY, pp. 59-82.
solve.QPx <- rnorm(1000)
dim(x) <- c(500,2)
res <- portfolio.optim(x)
res$pwRun the code above in your browser using DataLab