Learn R Programming

SharpeR (version 1.3.0)

SharpeR-package: statistics concerning Sharpe ratio and Markowitz portfolio

Description

Inference on Sharpe ratio and Markowitz portfolio.

Arguments

Sharpe Ratio

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' or 'disastrous rate' of return. Then $$z = \frac{\bar{x} - c_0}{s}$$ is the (sample) Sharpe ratio.

The units of \(z\) are \(\mbox{time}^{-1/2}\). Typically the Sharpe ratio is annualized by multiplying by \(\sqrt{d}\), where \(d\) is the number of observations per year (or whatever the target annualization epoch.) It is not common practice to include units when quoting Sharpe ratio, though doing so could avoid confusion.

The Sharpe ratio follows a rescaled non-central t distribution. That is, \(z/K\) follows a non-central t-distribution with \(m\) degrees of freedom and non-centrality parameter \(\zeta / K\), for some \(K\), \(m\) and \(\zeta\).

We can generalize Sharpe's model to APT, wherein we write $$x_i = \alpha + \sum_j \beta_j F_{j,i} + \epsilon_i,$$ where the \(F_{j,i}\) are observed 'factor returns', and the variance of the noise term is \(\sigma^2\). Via linear regression, one can compute estimates \(\hat{\alpha}\), and \(\hat{\sigma}\), and then let the 'Sharpe ratio' be $$z = \frac{\hat{\alpha} - c_0}{\hat{\sigma}}.$$ As above, this Sharpe ratio follows a rescaled t-distribution under normality, etc.

The parameters are encoded as follows:

  • df stands for the degrees of freedom, typically \(n-1\), but \(n-J-1\) in general.

  • \(\zeta\) is denoted by zeta.

  • \(d\) is denoted by ope. ('Observations Per Year')

  • For the APT form of Sharpe, K stands for the rescaling parameter.

Optimal Sharpe Ratio

Suppose \(x_i\) are \(n\) independent draws of a \(q\)-variate normal random variable with mean \(\mu\) and covariance matrix \(\Sigma\). Let \(\bar{x}\) be the (vector) sample mean, and \(S\) be the sample covariance matrix (using Bessel's correction). Let $$Z(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} Z(w),$$ with maximum value \(z_* = Z\left(w_*\right)\). Then $$w_* = R \frac{S^{-1}\bar{x}}{\sqrt{\bar{x}^{\top}S^{-1}\bar{x}}}$$ and $$z_* = \sqrt{\bar{x}^{\top} S^{-1} \bar{x}} - \frac{c_0}{R}$$

The variable \(z_*\) follows an Optimal Sharpe ratio distribution. For convenience, we may assume that the sample statistic has been annualized in the same manner as the Sharpe ratio, that is by multiplying by \(d\), the number of observations per epoch.

The Optimal Sharpe Ratio distribution is parametrized by the number of assets, \(q\), the number of independent observations, \(n\), the noncentrality parameter, $$\zeta_* = \sqrt{\mu^{\top}\Sigma^{-1}\mu},$$ the 'drag' term, \(c_0/R\), and the annualization factor, \(d\). The drag term makes this a location family of distributions, and by default we assume it is zero.

The parameters are encoded as follows:

  • \(q\) is denoted by df1.

  • \(n\) is denoted by df2.

  • \(\zeta_*\) is denoted by zeta.s.

  • \(d\) is denoted by ope.

  • \(c_0/R\) is denoted by drag.

Spanning and Hedging

As above, let $$Z(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 \(G\) be a \(g \times q\) matrix of 'hedge constraints'. Let \(w_*\) be the solution to the portfolio optimization problem: $$\max_{w: 0 < w^{\top}S w \le R^2,\,G S w = 0} Z(w),$$ with maximum value \(z_* = Z\left(w_*\right)\). Then \(z_*^2\) can be expressed as the difference of two squared optimal Sharpe ratio random variables. A monotonic transform takes this difference to the LRT statistic for portfolio spanning, first described by Rao, and refined by Giri.

Legal Mumbo Jumbo

SharpeR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

References

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

Johnson, N. L., and Welch, B. L. "Applications of the non-central t-distribution." Biometrika 31, no. 3-4 (1940): 362-389. 10.1093/biomet/31.3-4.362

Lo, Andrew W. "The statistics of Sharpe ratios." Financial Analysts Journal 58, no. 4 (2002): 36-52. https://www.ssrn.com/paper=377260

Opdyke, J. D. "Comparing Sharpe Ratios: So Where are the p-values?" Journal of Asset Management 8, no. 5 (2006): 308-336. https://www.ssrn.com/paper=886728

Ledoit, O., and Wolf, M. "Robust performance hypothesis testing with the Sharpe ratio." Journal of Empirical Finance 15, no. 5 (2008): 850-859. 10.1016/j.jempfin.2008.03.002

Giri, N. "On the likelihood ratio test of a normal multivariate testing problem." Annals of Mathematical Statistics 35, no. 1 (1964): 181-189. 10.1214/aoms/1177703740

Rao, C. R. "Advanced Statistical Methods in Biometric Research." Wiley (1952).

Rao, C. R. "On Some Problems Arising out of Discrimination with Multiple Characters." Sankhya, 9, no. 4 (1949): 343-366. https://www.jstor.org/stable/25047988

Kan, Raymond and Smith, Daniel R. "The Distribution of the Sample Minimum-Variance Frontier." Journal of Management Science 54, no. 7 (2008): 1364--1380. 10.1287/mnsc.1070.0852

Kan, Raymond and Zhou, GuoFu. "Tests of Mean-Variance Spanning." Annals of Economics and Finance 13, no. 1 (2012) https://econpapers.repec.org/article/cufjournl/y_3a2012_3av_3a13_3ai_3a1_3akanzhou.htm

Britten-Jones, Mark. "The Sampling Error in Estimates of Mean-Variance Efficient Portfolio Weights." The Journal of Finance 54, no. 2 (1999): 655--671. https://www.jstor.org/stable/2697722

Silvapulle, Mervyn. J. "A Hotelling's T2-type statistic for testing against one-sided hypotheses." Journal of Multivariate Analysis 55, no. 2 (1995): 312--319. 10.1006/jmva.1995.1081

Bodnar, Taras and Okhrin, Yarema. "On the Product of Inverse Wishart and Normal Distributions with Applications to Discriminant Analysis and Portfolio Theory." Scandinavian Journal of Statistics 38, no. 2 (2011): 311--331. 10.1111/j.1467-9469.2011.00729.x