portfolio.optimize | R Documentation |
This function performs a optimization of a portfolio with respect to one of the risk measures “sd”, “value.at.risk” or “expected.shortfall”. The optimization task is either to find the global minimum risk portfolio, the tangency portfolio or the minimum risk portfolio given a target-return.
portfolio.optimize(object,
risk.measure = c("sd", "value.at.risk", "expected.shortfall"),
type = c("minimum.risk", "tangency", "target.return"),
level = 0.95, distr = c("loss", "return"),
target.return = NULL, risk.free = NULL,
silent = FALSE, ...)
object |
A multivariate |
risk.measure |
How risk shall be measured. Must be one of “sd” (standard deviation), “value.at.risk” or “expected.shortfall”. |
type |
The tpye of the optimization problem. Must be one of “minimum.risk”, “tangency” or “target.return” (see Details). |
level |
The confidence level which shall be used if
|
distr |
The default distribution is “loss”. If |
target.return |
A numeric scalar specifying the target return if
the optimization problem is of |
risk.free |
A numeric scalar giving the risk free rate in case the
optimization problem is of |
silent |
If |
... |
Arguments passed to |
If type
is “minimum.risk” the global minimum risk
portfolio is returned.
If type
is “tangency” the portfolio maximizing the slope
of “(expected return - risk free rate) / risk” will be
returned.
If type
is “target.return” the portfolio with expected
return target.return
which minimizes the risk will be
returned.
Note that in case of an elliptical distribution (symmetric generalized
hyperbolic distributions) it does not matter which risk measure is
used. That is, minimizing the standard deviation results in a
portfolio which also minimizes the value-at-risk et cetera.
A list with components:
portfolio.dist |
An univariate generalized hyperbolic object of class |
risk.measure |
The risk measure which was used. |
risk |
The risk. |
opt.weights |
The optimal weights. |
converged |
Convergence returned from |
message |
A possible error message returned from |
n.iter |
The number of iterations returned from |
In case object
denotes a non-elliptical distribution and the
risk measure is either “value.at.risk” or
“expected.shortfall”, then the type “tangency”
optimization problem is not supported.
Constraints like avoiding short-selling are not supported yet.
David Luethi
transform
, fit.ghypmv
data(indices)
t.object <- fit.tmv(-indices, silent = TRUE)
gauss.object <- fit.gaussmv(-indices)
t.ptf <- portfolio.optimize(t.object,
risk.measure = "expected.shortfall",
type = "minimum.risk",
level = 0.99,
distr = "loss",
silent = TRUE)
gauss.ptf <- portfolio.optimize(gauss.object,
risk.measure = "expected.shortfall",
type = "minimum.risk",
level = 0.99,
distr = "loss")
par(mfrow = c(1, 3))
plot(c(t.ptf$risk, gauss.ptf$risk),
c(-mean(t.ptf$portfolio.dist), -mean(gauss.ptf$portfolio.dist)),
xlim = c(0, 0.035), ylim = c(0, 0.004),
col = c("black", "red"), lwd = 4,
xlab = "99 percent expected shortfall",
ylab = "Expected portfolio return",
main = "Global minimum risk portfolios")
legend("bottomleft", legend = c("Asymmetric t", "Gaussian"),
col = c("black", "red"), lty = 1)
plot(t.ptf$portfolio.dist, type = "l",
xlab = "log-loss ((-1) * log-return)", ylab = "Density")
lines(gauss.ptf$portfolio.dist, col = "red")
weights <- cbind(Asymmetric.t = t.ptf$opt.weights,
Gaussian = gauss.ptf$opt.weights)
barplot(weights, beside = TRUE, ylab = "Weights")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.