Description Usage Arguments Details Value Author(s) See Also Examples
Computes the Sharpe ratio of the Markowitz portfolio of some observed returns.
1 2 3 4 5 6 7 |
X |
matrix of returns, or |
drag |
the 'drag' term, c0/R. defaults to 0. It is assumed
that |
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 |
epoch |
the string representation of the 'epoch', defaulting to 'yr'. |
Suppose xi are n independent draws of a q-variate normal random variable with mean mu and covariance matrix Sigma. Let xbar be the (vector) sample mean, and S be the sample covariance matrix (using Bessel's correction). Let
zeta(w) = (w'xbar - c0)/sqrt(w'Sw)
be the (sample) Sharpe ratio of the portfolio w, subject to risk free rate c0.
Let w* be the solution to the portfolio optimization problem:
max {zeta(w) | 0 < w'Sw <= R^2},
with maximum value z* = zeta(w*). Then
w* = R S^-1 xbar / sqrt(xbar' S^-1 xbar)
and
z* = sqrt(xbar' S^-1 xbar) - c0/R
The units of z* are per root time. Typically the Sharpe ratio is annualized by multiplying by sqrt(ope), where ope is the number of observations per year (or whatever the target annualization epoch.)
Note that if ope
and epoch
are not given, the
converter from xts
attempts to infer the observations per epoch,
assuming yearly epoch.
An object of class sropt
.
Steven E. Pav shabbychef@gmail.com
sropt
, sr
, sropt-distribution functions,
dsropt, psropt, qsropt, rsropt
Other sropt:
confint.sr()
,
dsropt()
,
is.sropt()
,
pco_sropt()
,
power.sropt_test()
,
reannualize()
,
sropt_test()
,
sropt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 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)
asro <- as.sropt(Returns,drag=0,ope=ope)
# under the alternative:
Returns <- matrix(rnorm(ope*nyr*nfac,mean=0.0005,sd=0.0125),ncol=nfac)
asro <- as.sropt(Returns,drag=0,ope=ope)
# generating correlated multivariate normal data in a more sane way
if (require(MASS)) {
nstok <- 10
nfac <- 3
nyr <- 10
ope <- 253
X.like <- 0.01 * matrix(rnorm(500*nfac),ncol=nfac) %*%
matrix(runif(nfac*nstok),ncol=nstok)
Sigma <- cov(X.like) + diag(0.003,nstok)
# under the null:
Returns <- mvrnorm(ceiling(ope*nyr),mu=matrix(0,ncol=nstok),Sigma=Sigma)
asro <- as.sropt(Returns,ope=ope)
# under the alternative
Returns <- mvrnorm(ceiling(ope*nyr),mu=matrix(0.001,ncol=nstok),Sigma=Sigma)
asro <- as.sropt(Returns,ope=ope)
}
# using real data.
if (require(xts)) {
data(stock_returns)
asro <- as.sropt(stock_returns)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.