# confidence interval of the difference of two statistics

I have the returns of two groups of stock over 135 months and I am trying to find the confidence interval for the difference of two Sharpe ratios (that I will call $X$ and $Y$). To do so, I want to apply the formula:

$$(X-Y) \pm 1.96 \cdot \sigma(X-Y)$$

Thus, I first calculate the standard error of $X$ and $Y$ as the standard deviation of the bootstrapped Sharpe ratios. Now I want to calculate the standard deviation of the difference between the statistics. I found that I can apply the formula:

$$\newcommand{\length}{{\rm length}}\sigma(X-Y) = \sqrt{\frac{\sigma_X^2}{\length_X} + \frac{\sigma_Y^2}{\length_Y}}$$

My problem is in understanding which value I should use for the length(x) and length(y): should I use the length of my original statistic (1), of my original sample (135) or of the bootstrapped statistic (10000)?

As an alternative to bootstrapping, you can use a HAC estimator for covariance and the delta method. See section 4.2 of Short Sharpe Course. Some example code using the SharpeR package with the HAC estimator from sandwich package in R:

set.seed(1234)
x <- rnorm(135)
y <- rnorm(length(x))
xy <- cbind(x,y)
sg <- SharpeR::sr_vcov(xy,vcov.func=sandwich::vcovHAC,ope=12) # 12 for monthly data
difd  <- matrix(c(1,-1),nrow=1)
srdif <- difd %*% sg$SR difvar <- difd %*% sg$Ohat %*% t(difd)
alpha <- 0.05
cis <- srdif + sqrt(difvar) * qnorm(c(alpha,2-alpha)/2)
cis
[1] -1.86814  0.08004


If you're bootstrapping, you should just bootstrap the confidence interval and not rely on a normal approximation. In each bootstrapped sample, compute $X-Y$. The empirical 2.5 and 97.5 percentiles of the bootstrapped distribution are the bounds of a 95% confidence interval.

There are other ways of computing a bootstrapped confidence interval, but this is one (the percentile bootstrap).

• Just to be sure that I understood correctly, you suggest to first bootstrap the statistic for each sample (so to have two vectors each of them with 10000 values of the Sharpe ratio), then to subtract one vector to the other and finally to take the empirical 2.5 and 97.5 percentiles of this resulting vector? (thanks for the answer) Jul 26, 2018 at 17:49
• Do I have to sort the two vectors before subtracting one from the other? So that the "highest" Sharpe ratios of one group are subtracted to the "highest" Sharpe ratios of the other group? Jul 26, 2018 at 17:50
• I don't know anything about Sharpe ratios, so I don't know if they need to be treated differently to other statistics, but in a bootstrap you draw a random sample with replacement from your collected data, compute the statistic of interest (which in your case is the difference between the Sharpe ratios), and repeat, leaving you with a single vector of the statistic of interest. It's this single vector from which you compute the 2.5 and 97.5 percentiles.
– Noah
Jul 26, 2018 at 17:54