Learn R Programming

SharpeR (version 1.0.0)

as.del_sropt: Compute the Sharpe ratio of a hedged Markowitz portfolio.

Description

Computes the Sharpe ratio of the hedged Markowitz portfolio of some observed returns.

Usage

as.del_sropt(X,G,drag=0,ope=1,epoch="yr")

## S3 method for class 'default': as.del_sropt(X, G, drag = 0, ope = 1, epoch = "yr")

## S3 method for class 'xts': as.del_sropt(X, G, drag = 0, ope = 1, epoch = "yr")

Arguments

X
matrix of returns, or xts object.
G
an $g \times q$ matrix of hedge constraints. A garden variety application would have G be one row of the identity matrix, with a one in the column of the instrument to be 'hedged out'.
drag
the 'drag' term, $c_0/R$. defaults to 0. It is assumed that drag has been annualized, i.e. has been multiplied by $\sqrt{ope}$. This is in contrast to the c0 term given to sr.
ope
the number of observations per 'epoch'. For convenience of interpretation, The Sharpe ratio is typically quoted in 'annualized' units for some epoch, that is, 'per square root epoch', though returns are observed at a frequency of ope per epoc
epoch
the string representation of the 'epoch', defaulting to 'yr'.

Value

  • An object of class del_sropt.

Details

Suppose $x_i$ are $n$ independent draws of a $q$-variate normal random variable with mean $\mu$ and covariance matrix $\Sigma$. Let $G$ be a $g \times q$ matrix of rank $g$. Let $\bar{x}$ be the (vector) sample mean, and $S$ be the sample covariance matrix (using Bessel's correction). Let $$\zeta(w) = \frac{w^{\top}\bar{x} - c_0}{\sqrt{w^{\top}S w}}$$ be the (sample) Sharpe ratio of the portfolio $w$, subject to risk free rate $c_0$.

Let $w_*$ be the solution to the portfolio optimization problem: $$\max_{w: 0 < w^{\top}S w \le R^2,\,G S w = 0} \zeta(w),$$ with maximum value $z_* = \zeta\left(w_*\right)$.

Note that if ope and epoch are not given, the converter from xts attempts to infer the observations per epoch, assuming yearly epoch.

See Also

del_sropt, sropt, sr

Other del_sropt: del_sropt; is.del_sropt

Examples

Run this code
nfac <- 5
nyr <- 10
ope <- 253
# simulations with no covariance structure.
# under the null:
set.seed(as.integer(charToRaw("be determinstic")))
Returns <- matrix(rnorm(ope*nyr*nfac,mean=0,sd=0.0125),ncol=nfac)
# hedge out the first one:
G <- matrix(diag(nfac)[1,],nrow=1)
asro <- as.del_sropt(Returns,G,drag=0,ope=ope)
print(asro)
G <- diag(nfac)[c(1:3),]
asro <- as.del_sropt(Returns,G,drag=0,ope=ope)
# compare to sropt on the remaining assets
# they should be close, but not exact.
asro.alt <- as.sropt(Returns[,4:nfac],drag=0,ope=ope)
# using real data.
if (require(quantmod)) {
  get.ret <- function(sym,...) {
    OHLCV <- getSymbols(sym,auto.assign=FALSE,...)
    lrets <- diff(log(OHLCV[,paste(c(sym,"Adjusted"),collapse=".",sep="")]))
    # chomp first NA!
    lrets[-1,]
  }
  get.rets <- function(syms,...) { some.rets <- do.call("cbind",lapply(syms,get.ret,...)) }
  some.rets <- get.rets(c("IBM","AAPL","A","C","SPY","XOM"))
  # hedge out SPY
  G <- diag(dim(some.rets)[2])[5,]
  asro <- as.del_sropt(some.rets,G)
}

Run the code above in your browser using DataLab