Learn R Programming

SharpeR (version 1.3.0)

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,
                 vcov.func=vcov)

Arguments

X

an \(n \times p\) matrix of paired observations.

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" test. "greater" corresponds to \(H_a: E s > 0\).

contrasts

an \(k \times p\) matrix of the contrasts

vcov.func

a function which takes a model of class lm (one of the form x ~ 1), and produces a variance-covariance matrix. The default is vcov, which produces a 'vanilla' estimate of covariance. Other sensible options are vcovHAC from the sandwich package.

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.

See ‘The Sharpe Ratio: Statistics and Applications’, section 3.3.1.

References

Sharpe, William F. "Mutual fund performance." Journal of business (1966): 119-138. https://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. https://www.risk.net/journal-risk/2340067/test-equality-multiple-sharpe-ratios

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. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=907270

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

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

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

Pav, S. E. "The Sharpe Ratio: Statistics and Applications." CRC Press, 2021.

See Also

sr_test

Other sr: as.sr(), confint.sr(), dsr(), is.sr(), plambdap(), power.sr_test(), predint(), print.sr(), reannualize(), se(), sr_test(), sr_unpaired_test(), sr_vcov(), sr, summary.sr

Examples

Run this code
# NOT RUN {
# under the null 
set.seed(1234)
rv <- sr_equality_test(matrix(rnorm(500*5),ncol=5))

# under the alternative (but with identity covariance)
ope <- 253
nyr <- 10
nco <- 5
set.seed(909)
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(xts)) {
 data(stock_returns)
 pvs <- sr_equality_test(stock_returns)
}

# 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') 

# }
# NOT RUN {
if (require(sandwich)) {
  set.seed(as.integer(charToRaw("0b2fd4e9-3bdf-4e3e-9c75-25c6d18c331f")))
  n.manifest <- 10
  n.latent <- 4
  n.day <- 1024
  snr <- 0.95
  la_A <- matrix(rnorm(n.day*n.latent),ncol=n.latent)
  la_B <- matrix(runif(n.latent*n.manifest),ncol=n.manifest)
  latent.rets <- la_A %*% la_B
  noise.rets <- matrix(rnorm(n.day*n.manifest),ncol=n.manifest)
  some.rets <- snr * latent.rets + sqrt(1-snr^2) * noise.rets
  # naive vcov
  pvs0 <- sr_equality_test(some.rets)
  # HAC vcov
  pvs1 <- sr_equality_test(some.rets,vcov.func=vcovHAC)
  # more elaborately:
  pvs <- sr_equality_test(some.rets,vcov.func=function(amod) {
	vcovHAC(amod,prewhite=TRUE) })
}
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab