Learn R Programming

SharpeR (version 0.1306)

sr_equality_test: Paired test for equality of Sharpe ratio

Description

Performs a hypothesis test of equality of Sharpe ratios of p assets given paired observations.

Usage

sr_equality_test(X,type=c("chisq","F","t"),
    alternative=c("two.sided","less","greater"),
    contrasts=NULL)

Arguments

X
an $n \times p$ matrix of paired observations.
contrasts
an $k \times p$ matrix of the contrasts
type
which approximation to use. "chisq" is preferred when the returns are non-normal, but the approximation is asymptotic. the "t" test is only supported when $k = 1$.
alternative
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter. This is only relevant for the "t" te

Value

  • Object of class htest, a list of the test statistic, the size of X, and the method noted.

Details

Given $n$ i.i.d. observations of the excess returns of $p$ strategies, we test $$H_0: \frac{\mu_i}{\sigma_i} = \frac{\mu_j}{\sigma_j}, 1 \le i < j \le p$$ using the method of Wright, et. al.

More generally, a matrix of constrasts, $E$ can be given, and we can test $$H_0: E s = 0,$$ where $s$ is the vector of Sharpe ratios of the $p$ strategies.

When $E$ consists of a single row (a single contrast), as is the case when the default contrasts are used and only two strategies are compared, then an approximate t-test can be performed against the alternative hypothesis $H_a: E s > 0$

Both chi-squared and F- approximations are supported; the former is described by Wright. et. al., the latter by Leung and Wong.

References

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

Wright, J. A., Yam, S. C. P., and Yung, S. P. "A note on the test for the equality of multiple Sharpe ratios and its application on the evaluation of iShares." J. Risk. to appear. http://www.sta.cuhk.edu.hk/scpy/Preprints/John%20Wright/A%20test%20for%20the%20equality%20of%20multiple%20Sharpe%20ratios.pdf

Leung, P.-L., and Wong, W.-K. "On testing the equality of multiple Sharpe ratios, with application on the evaluation of iShares." J. Risk 10, no. 3 (2008): 15--30. http://papers.ssrn.com/sol3/papers.cfm?abstract_id=907270

Memmel, C. "Performance hypothesis testing with the Sharpe ratio." Finance Letters 1 (2003): 21--23.

See Also

sr_test

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

Examples

Run this code
# under the null
rv <- sr_equality_test(matrix(rnorm(500*5),ncol=5))
# under the alternative (but with identity covariance)
ope <- 253
nyr <- 10
nco <- 5
rets <- 0.01 * sapply(seq(0,1.7/sqrt(ope),length.out=nco),
  function(mu) { rnorm(ope*nyr,mean=mu,sd=1) })
rv <- sr_equality_test(rets)

# 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="")]))
    lrets[-1,]
  }
  get.rets <- function(syms,...) { some.rets <- do.call("cbind",lapply(syms,get.ret,...)) }
  some.rets <- get.rets(c("IBM","AAPL","NFLX","SPY"))
  pvs <- sr_equality_test(some.rets)
}
# test for uniformity
pvs <- replicate(1024,{ x <- sr_equality_test(matrix(rnorm(400*5),400,5),type="chisq")
                       x$p.value })
plot(ecdf(pvs))
abline(0,1,col='red')

Run the code above in your browser using DataLab