Learn R Programming

SharpeR (version 0.1306)

dsr: The (non-central) Sharpe ratio.

Description

Density, distribution function, quantile function and random generation for the Sharpe ratio distribution with df degrees of freedom (and optional signal-noise-ratio zeta).

Usage

dsr(x, df, zeta, ope, ...)

psr(q, df, zeta, ope, ...)

qsr(p, df, zeta, ope, ...)

rsr(n, df, zeta, ope)

Arguments

x,q
vector of quantiles.
p
vector of probabilities.
n
number of observations.
df
the number of observations the statistic is based on. This is one more than the number of degrees of freedom in the corresponding t-statistic, although the effect will be small when df is large.
zeta
the 'signal-to-noise' parameter, $\zeta$ defined as the population mean divided by the population standard deviation, 'annualized'.
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
...
arguments passed on to the respective t-distribution functions, namely lower.tail with default TRUE, log with default FALSE, and log.p with default FALSE.

Value

  • dsr gives the density, psr gives the distribution function, qsr gives the quantile function, and rsr generates random deviates.

    Invalid arguments will result in return value NaN with a warning.

Details

Suppose $x_i$ are $n$ independent draws of a normal random variable with mean $\mu$ and variance $\sigma^2$. Let $\bar{x}$ be the sample mean, and $s$ be the sample standard deviation (using Bessel's correction). Let $c_0$ be the 'risk free rate'. Then $$z = \frac{\bar{x} - c_0}{s}$$ is the (sample) Sharpe ratio.

The units of $z$ is $\mbox{time}^{-1/2}$. Typically the Sharpe ratio is annualized by multiplying by $\sqrt{d}$, where $d$ is the number of observations per epoch (typically a year).

Letting $z = \sqrt{d}\frac{\bar{x}-c_0}{s}$, where the sample estimates are based on $n$ observations, then $z$ takes a (non-central) Sharpe ratio distribution parametrized by $n$ 'degrees of freedom', non-centrality parameter $\zeta = \frac{\mu - c_0}{\sigma}$, and annualization parameter $d$.

The parameters are encoded as follows:

  • $n$is denoted bydf.
  • $\zeta$is denoted byzeta.
  • $d$is denoted byope. ('Observations Per Year')

If the returns violate the assumptions of normality, independence, etc (as they always should in the real world), the sample Sharpe Ratio will not follow this distribution. It does provide, however, a reasonable approximation in many cases.

References

Sharpe, William F. "Mutual fund performance." Journal of business (1966): 119-138. http://ideas.repec.org/a/ucp/jnlbus/v39y1965p119.html

See Also

reannualize

t-distribution functions, dt, pt, qt, rt

Other sr: as.sr, as.sr.data.frame, as.sr.default, as.sr.lm, as.sr.xts, confint.sr, confint.sropt, is.sr, power.sr_test, print.sr, print.sropt, reannualize, reannualize.sr, reannualize.sropt, se, se.sr, sr, sr_equality_test, sr_test

Examples

Run this code
rvs <- rsr(128, 253*6, 0, 253)
dvs <- dsr(rvs, 253*6, 0, 253)
pvs.H0 <- psr(rvs, 253*6, 0, 253)
pvs.HA <- psr(rvs, 253*6, 1, 253)
plot(ecdf(pvs.H0))
plot(ecdf(pvs.HA))

Run the code above in your browser using DataLab