I believe this question is related to Extreme Value Theory, an area of statistics that I have not studied.
Let
- $X$ and $Y$ be random variables
- the null hypothesis be that $X=Y$ in distribution
- $\{X_i\}_{i=1}^{n_X}$ be a sample of size $n_X$ from $X$ and $\{Y_i\}_{i=1}^{n_Y}$ be a sample of size $n_Y$ from $Y$
- $X_{max} = max(\{X_i\}_{i=1}^{n_X})$
- $S = \sum_{i=1}^{n_Y} I(Y_i > X_{max}) $, where $I$ is the indicator function
- $n_Y >> n_X$ (e.g. $n_Y= 100000$ and $n_X=500$). This isn't a necessary assumption, but it is useful for understanding why I'm using $S$ as a test statistic.
The goal is to determine when $S$ is unusually high under the null hypothesis. Meaning, find $b$ such that we reject the null when $S>b$, where b is a sample statistic and $P(S > b) < \alpha$ under the null. For example the 99th quantile of a binomial of size $n_Y$ and probability $1/(n_X +1)$ (this bound can be verified to be wrong through simulation). Can a valid $b$ be determined? Or more generally:
How do we use $S$ to determine if the tails of $X$ and $Y$ are different?
Possible solutions:
- Determine the distribution of $S$ under the null hypothesis
- Something involving Order Statistics
- Something involving Extreme Value Theory
Answers may certainly include additional assumptions if needed for this to be tractable.
Here is a quick simulation in R (with the wrong bound) showing what I am looking for:
NSIM <- 1000
nX <- 500
nY <- 100000
alpha <- .01
exc <- rep(NA, NSIM)
for(i in 1:NSIM){
cat('\r', paste0("Sim: ",i,"/", NSIM))
X <- rnorm(nX)
Xmax <- max(X)
Y <- rnorm(nY)
# b is the wrong bound
b <- qbinom(p = 1-alpha, size = nY, prob = 1/(nX+1))
S <-sum(Y > Xmax)
exc[i] <- S > b
}
### This is the type I error rate
### should be around alpha=.01 if correct bound
sum(exc)/NSIM
### [1] 0.307 (usually like .27-.33)