I am looking for a way to calculate confidence intervals for the interquartile range IQR of a numerical variable. Of course, they can be found by the bootstrap, but I am explicitly looking for a different, still distribution-free way. Since the IQR is a quantile difference, this reference could head into the right direction.
How would a pseudo-algorithm (or R/Python code) look like?
Here the "cheap" bootstrap way in R:
library(boot)
set.seed(1)
x <- rnorm(100)
S <- boot(x, function(x, ix) IQR(x[ix]), R = 10000)
boot.ci(S, type = "bca")
# BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
# Based on 10000 bootstrap replicates
#
# CALL :
# boot.ci(boot.out = S, type = "bca")
#
# Intervals :
# Level BCa
# 95% ( 0.958, 1.448 )
# Calculations and Intervals on Original Scale
Is there something similar like the binomial approach used by @whuber in his answer here? How to obtain a confidence interval for a percentile?