portfolio.optimize: Portfolio optimization with respect to alternative risk...

portfolio.optimizeR Documentation

Portfolio optimization with respect to alternative risk measures

Description

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.

Usage

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, ...)

Arguments

object

A multivariate ghyp object representing the loss distribution. In case object gives the return distribution set the argument distr to “return”.

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 risk.measure is either “value.at.risk” or “expected.shortfall”.

distr

The default distribution is “loss”. If object gives the return distribution set distr to “return”.

target.return

A numeric scalar specifying the target return if the optimization problem is of type “target.return”.

risk.free

A numeric scalar giving the risk free rate in case the optimization problem is of type “tangency”.

silent

If TRUE no prompts will appear in the console.

...

Arguments passed to optim.

Details

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.

Value

A list with components:

portfolio.dist

An univariate generalized hyperbolic object of class ghyp which represents the distribution of the optimal portfolio.

risk.measure

The risk measure which was used.

risk

The risk.

opt.weights

The optimal weights.

converged

Convergence returned from optim.

message

A possible error message returned from optim.

n.iter

The number of iterations returned from optim.

Note

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.

Author(s)

David Luethi

See Also

transform, fit.ghypmv

Examples


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")


ghyp documentation built on Sept. 12, 2024, 7:38 a.m.