This transfer page keeps the same goal: connect a population derivative to a sample expansion and a justified standard error. A stated empirical-CDF lemma supplies the extra probability step; proving its general empirical-process version is additional theory.
For i.i.d. observations, P_nf=n^{-1}\sum_i f(Y_i) and Pf=E[f(Y)].
1 A quantile has a nonsmooth sample equation
Let F(u)=\Pr(Y\le u) be the population CDF and fix 0<\tau<1. The target is the quantile q=\inf\{u:F(u)\ge\tau\}. The median uses \tau=1/2. Assume i.i.d. observations, a continuous distribution with a unique interior quantile, and a density f continuous and positive near q. These conditions give F(q)=\tau and a nonzero population slope f(q).
The empirical CDF is F_n(u)=n^{-1}\sum_i1\{Y_i\le u\}. Use the order-statistic quantile \hat q=Y_{(k)} with k=\lceil n\tau\rceil, corresponding to R’s type = 1. With no ties, F_n(\hat q)=k/n, so
For five ordered values (1,2,4,6,9), the median is 4 and the empirical CDF there is 3/5. The sample equation misses 1/2 by 1/10. This small root error is acceptable because 1/n is negligible on the root-n scale.
The sample CDF is a step function: between observations its derivative is zero, and at jumps an ordinary derivative is unavailable. We cannot Taylor-expand that random step function as if its derivative were the population density. Instead, write E_n(u)=F_n(u)-F(u) for the empirical CDF error and \Delta_n=E_n(\hat q)-E_n(q). The exact decomposition is
The three right-hand terms have different jobs: sampling fluctuation at the fixed q, a smooth population-CDF change, and an empirical increment caused by evaluating at a random argument.
1.1 Establish consistency and the local rate
Use the uniform CDF consistency result \sup_u|F_n(u)-F(u)|\xrightarrow{p}0. For any sufficiently small fixed \delta>0, positive density gives F(q-\delta)<\tau<F(q+\delta). Once the empirical CDF is uniformly close enough, its crossing of \tau lies between these two endpoints. This proves \hat q\xrightarrow{p}q.
To obtain a rate, examine the deterministic thresholds q\pm C/\sqrt n for fixed C. Their population CDF values differ from \tau by approximately \pm Cf(q)/\sqrt n. The count of observations below either threshold is binomial. Its CLT shows that crossing beyond the threshold requires a fluctuation in a corresponding normal tail. Choosing C large makes both tail probabilities small, giving \hat q-q=O_p(n^{-1/2}). This rate argument uses binomial fluctuations, rather than a derivative of the sample indicator.
1.2 Use the stated empirical-CDF lemma
We supply the additional probability result needed for the random argument. For every fixed C<\infty,
This is stochastic equicontinuity over shrinking neighborhoods: on that local scale, changing the evaluation point changes the empirical error by less than root-n fluctuation. The rate established above places \hat q in such a neighborhood with arbitrarily high probability after choosing C large. Consequently \Delta_n=o_p(n^{-1/2}).
The full empirical-process proof of this lemma is additional theory. The completion task uses it as a stated result, with its role and required neighborhood made explicit.
1.3 Invert the population slope
Taylor-expand only the population CDF. Its differentiability and the local rate give
F(\hat q)-F(q)=f(q)(\hat q-q) +o_p(n^{-1/2}).
In the exact decomposition, the sample-root error is O(1/n) and the empirical increment is negligible. Move the fixed-point fluctuation to the other side and divide by the nonzero f(q):
An observation below q has negative influence, pulling the quantile downward; one above it has positive influence. The factor 1/f(q) translates CDF noise into outcome units. A flat population CDF near the quantile makes its location harder to determine precisely.
2 Derive the population path derivative separately
For a bounded, mean-zero-score path dP_t=(1+ts)dP, let F_t be its CDF and q_t its quantile. At a fixed endpoint u,
F_t(u)=F(u)+tE[1\{Y\le u\}s(Y)].
The identity F_t(q_t)=\tau changes both the distribution and the endpoint. Differentiating at zero gives
0=E[1\{Y\le q\}s(Y)]+f(q)\dot q.
Solving and using E[s]=0 yields \dot q=E[\phi_q(Y)s(Y)], with the same \phi_q as the sample expansion. The path derivative is a deterministic sensitivity calculation for populations. The empirical-CDF lemma above was the extra step needed for the random sample quantile.
3 Obtain and interpret uncertainty
Because 1\{Y\le q\} is Bernoulli with probability \tau, E[\phi_q]=0 and
The first is the limiting variance of the scaled error; the second is the estimator’s first-order variance. A feasible SE can use \sqrt{\tau(1-\tau)}/\{\sqrt n\,\hat f(\hat q)\} if the density estimate at the fitted quantile converges to f(q)>0. Such consistency needs an appropriate density estimator and its own conditions; another justified quantile-uncertainty procedure is also possible.
The influence contribution is bounded under the stated positive-density conditions, so this CLT does not require the raw outcome to have finite variance. If the density is zero at q, or the CDF has a jump there, the displayed inversion and regularity argument must be reconsidered. Nonsmoothness of the sample equation alone is therefore a different issue from failure of the population derivative or local empirical control.
4 Check the approximation in a simulation
For a standard-normal median, f(0)=1/\sqrt{2\pi}, giving limiting variance \pi/2 for \sqrt n\hat q. The code uses known density only to assess the theory in a known simulation, not as an available input in a real cohort.
Code
set.seed(21)ns <-c(40, 160, 640); R <-500z <-lapply(ns, function(n) {replicate(R, sqrt(n) *quantile(rnorm(n), 0.5, type =1) /sqrt(pi /2))})plot(density(z[[1]]), xlim =c(-4, 4), ylim =c(0, 0.5),xlab ="Scaled median error", main ="Quantile normal approximation", col ="#2F80C8")lines(density(z[[2]]), col ="#D55E00")lines(density(z[[3]]), col ="#009E73")curve(dnorm(x), add =TRUE, lty =2)legend("topright", c(paste("n =", ns), "N(0,1)"),col =c("#2F80C8", "#D55E00", "#009E73", "black"), lty =c(1, 1, 1, 2), bty ="n")data.frame(n = ns, variance =sapply(z, var),coverage =sapply(z, function(a) mean(abs(a) <=1.96)))
Figure 1: Synthetic normal medians, scaled by their theoretical asymptotic standard deviation. Increasing sample size is compared on a common N(0,1) scale.
The reported variances concern the standardized errors and should approach 1; they are not variances of the unscaled medians. The coverage calculation uses the known density to assess an idealized normal interval in this simulation. A real-data procedure would need to estimate the required uncertainty or use another justified method.
Across 500 replications, coverage near 0.95 has Monte Carlo SE about 0.01. Both the numerical variances and coverages fluctuate. A familiar-looking density is evidence about this experiment, not a substitute for the assumptions and proof.
5 Exercises
The checkpoint is this page’s completion target. Additional practice is optional.
Checkpoint · SP-06 — Derive the quantile expansion and influence function
Task type: Derivation using a stated stochastic lemma.
Under the quantile conditions in this page, derive the expansion using the displayed CDF decomposition and stated stochastic-equicontinuity fact. Identify the influence function, its variance, and the additional requirement for a feasible standard error. Independently derive the path derivative by differentiating F_t(q_t)=\tau along a valid bounded-score path. Explain why a pointwise derivative of the sample indicator cannot replace the argument.
Ready to continue when: you can distinguish the population derivative from the stochastic increment and obtain both the expansion and pathwise representation.
Transfer: For the standard-normal median, compute the variance. Which step fails when the density is zero at the target?
Hint
The approximate sample root has an error of order 1/n. Along a path, differentiating the CDF changes both its distribution and its endpoint.
Solution outline — open after trying
The approximate-root error and empirical-CDF increment are o_p(n^{-1/2}). The population change is f(q)(\hat q-q) plus a negligible remainder, so inversion gives \hat q-q=(\tau-F_n(q))/f(q)+o_p(n^{-1/2}). The influence function is (\tau-1\{Y\le q\})/f(q) with variance \tau(1-\tau)/f(q)^2. For a score s, differentiation gives 0=E[1\{Y\le q\}s]+f(q)\dot q; using E[s]=0 recovers \dot q=E[\phi_qs]. A feasible variance estimate needs density consistency at q or another justified method. The sample CDF is discontinuous, so its pointwise derivative does not supply the population density. For a standard-normal median the influence variance is \pi/2, giving first-order estimator variance \pi/(2n); a zero density prevents the displayed derivative inversion.
Additional practice (optional)
Compare R quantile types 1 and 7 and explain why their first-order limits can agree.
Identify the derivative step that fails when the density vanishes at the target.
---title: "Quantiles and local expansions"subtitle: "A transfer from smooth means to a nonsmooth sample equation"---**Before reading:** [Statistical models, targets, and paths](model-target-paths.qmd), [Influence functions](influence-functions.qmd), and the LLN/CLT and stochastic orders from [Large-sample reasoning for methods research](../estimation-and-inference/large-sample-reasoning.qmd).This transfer page keeps the same goal: connect a population derivative to a sample expansion and a justified standard error. A stated empirical-CDF lemma supplies the extra probability step; proving its general empirical-process version is additional theory.For i.i.d. observations, $P_nf=n^{-1}\sum_i f(Y_i)$ and $Pf=E[f(Y)]$.## A quantile has a nonsmooth sample equationLet $F(u)=\Pr(Y\le u)$ be the population CDF and fix $0<\tau<1$. The target is the quantile $q=\inf\{u:F(u)\ge\tau\}$. The median uses $\tau=1/2$. Assume i.i.d. observations, a continuous distribution with a unique interior quantile, and a density $f$ continuous and positive near $q$. These conditions give $F(q)=\tau$ and a nonzero population slope $f(q)$.The empirical CDF is $F_n(u)=n^{-1}\sum_i1\{Y_i\le u\}$. Use the order-statistic quantile $\hat q=Y_{(k)}$ with $k=\lceil n\tau\rceil$, corresponding to R's `type = 1`. With no ties, $F_n(\hat q)=k/n$, so$$\begin{aligned}0&\le F_n(\hat q)-\tau\\&<1/n.\end{aligned}$$For five ordered values $(1,2,4,6,9)$, the median is 4 and the empirical CDF there is $3/5$. The sample equation misses $1/2$ by $1/10$. This small root error is acceptable because $1/n$ is negligible on the root-$n$ scale.The sample CDF is a step function: between observations its derivative is zero, and at jumps an ordinary derivative is unavailable. We cannot Taylor-expand that random step function as if its derivative were the population density. Instead, write $E_n(u)=F_n(u)-F(u)$ for the empirical CDF error and $\Delta_n=E_n(\hat q)-E_n(q)$. The exact decomposition is$$F_n(\hat q)-\tau=F_n(q)-\tau +\{F(\hat q)-F(q)\}+\Delta_n.$$The three right-hand terms have different jobs: sampling fluctuation at the fixed $q$, a smooth population-CDF change, and an empirical increment caused by evaluating at a random argument.### Establish consistency and the local rateUse the uniform CDF consistency result $\sup_u|F_n(u)-F(u)|\xrightarrow{p}0$. For any sufficiently small fixed $\delta>0$, positive density gives $F(q-\delta)<\tau<F(q+\delta)$. Once the empirical CDF is uniformly close enough, its crossing of $\tau$ lies between these two endpoints. This proves $\hat q\xrightarrow{p}q$.To obtain a rate, examine the deterministic thresholds $q\pm C/\sqrt n$ for fixed $C$. Their population CDF values differ from $\tau$ by approximately $\pm Cf(q)/\sqrt n$. The count of observations below either threshold is binomial. Its CLT shows that crossing beyond the threshold requires a fluctuation in a corresponding normal tail. Choosing $C$ large makes both tail probabilities small, giving $\hat q-q=O_p(n^{-1/2})$. This rate argument uses binomial fluctuations, rather than a derivative of the sample indicator.### Use the stated empirical-CDF lemmaWe supply the additional probability result needed for the random argument. For every fixed $C<\infty$,$$\sqrt n\sup_{|u-q|\le C/\sqrt n}|E_n(u)-E_n(q)|\xrightarrow{p}0.$$This is **stochastic equicontinuity** over shrinking neighborhoods: on that local scale, changing the evaluation point changes the empirical error by less than root-$n$ fluctuation. The rate established above places $\hat q$ in such a neighborhood with arbitrarily high probability after choosing $C$ large. Consequently $\Delta_n=o_p(n^{-1/2})$.The full empirical-process proof of this lemma is additional theory. The completion task uses it as a stated result, with its role and required neighborhood made explicit.### Invert the population slopeTaylor-expand only the population CDF. Its differentiability and the local rate give$$F(\hat q)-F(q)=f(q)(\hat q-q) +o_p(n^{-1/2}).$$In the exact decomposition, the sample-root error is $O(1/n)$ and the empirical increment is negligible. Move the fixed-point fluctuation to the other side and divide by the nonzero $f(q)$:$$\begin{aligned}\hat q-q&=P_n\phi_q+o_p(n^{-1/2}),\\\phi_q(Y)&=\frac{\tau-1\{Y\le q\}}{f(q)}.\end{aligned}$$An observation below $q$ has negative influence, pulling the quantile downward; one above it has positive influence. The factor $1/f(q)$ translates CDF noise into outcome units. A flat population CDF near the quantile makes its location harder to determine precisely.## Derive the population path derivative separatelyFor a bounded, mean-zero-score path $dP_t=(1+ts)dP$, let $F_t$ be its CDF and $q_t$ its quantile. At a fixed endpoint $u$,$$F_t(u)=F(u)+tE[1\{Y\le u\}s(Y)].$$The identity $F_t(q_t)=\tau$ changes both the distribution and the endpoint. Differentiating at zero gives$$0=E[1\{Y\le q\}s(Y)]+f(q)\dot q.$$Solving and using $E[s]=0$ yields $\dot q=E[\phi_q(Y)s(Y)]$, with the same $\phi_q$ as the sample expansion. The path derivative is a deterministic sensitivity calculation for populations. The empirical-CDF lemma above was the extra step needed for the random sample quantile.## Obtain and interpret uncertaintyBecause $1\{Y\le q\}$ is Bernoulli with probability $\tau$, $E[\phi_q]=0$ and$$\begin{aligned}\operatorname{Var}(\phi_q)&=\frac{\tau(1-\tau)}{f(q)^2},\\\operatorname{Var}(\hat q)&\approx\frac{\tau(1-\tau)}{nf(q)^2}.\end{aligned}$$The first is the limiting variance of the scaled error; the second is the estimator's first-order variance. A feasible SE can use $\sqrt{\tau(1-\tau)}/\{\sqrt n\,\hat f(\hat q)\}$ if the density estimate at the fitted quantile converges to $f(q)>0$. Such consistency needs an appropriate density estimator and its own conditions; another justified quantile-uncertainty procedure is also possible.The influence contribution is bounded under the stated positive-density conditions, so this CLT does not require the raw outcome to have finite variance. If the density is zero at $q$, or the CDF has a jump there, the displayed inversion and regularity argument must be reconsidered. Nonsmoothness of the *sample equation* alone is therefore a different issue from failure of the population derivative or local empirical control.## Check the approximation in a simulationFor a standard-normal median, $f(0)=1/\sqrt{2\pi}$, giving limiting variance $\pi/2$ for $\sqrt n\hat q$. The code uses known density only to assess the theory in a known simulation, not as an available input in a real cohort.```{r}#| label: fig-quantile-limit#| fig-cap: "Synthetic normal medians, scaled by their theoretical asymptotic standard deviation. Increasing sample size is compared on a common N(0,1) scale."#| fig-alt: "Density curves for standardized sample medians at sample sizes 40, 160, and 640, compared with a standard normal density."set.seed(21)ns <-c(40, 160, 640); R <-500z <-lapply(ns, function(n) {replicate(R, sqrt(n) *quantile(rnorm(n), 0.5, type =1) /sqrt(pi /2))})plot(density(z[[1]]), xlim =c(-4, 4), ylim =c(0, 0.5),xlab ="Scaled median error", main ="Quantile normal approximation", col ="#2F80C8")lines(density(z[[2]]), col ="#D55E00")lines(density(z[[3]]), col ="#009E73")curve(dnorm(x), add =TRUE, lty =2)legend("topright", c(paste("n =", ns), "N(0,1)"),col =c("#2F80C8", "#D55E00", "#009E73", "black"), lty =c(1, 1, 1, 2), bty ="n")data.frame(n = ns, variance =sapply(z, var),coverage =sapply(z, function(a) mean(abs(a) <=1.96)))```The reported variances concern the standardized errors and should approach 1; they are not variances of the unscaled medians. The coverage calculation uses the known density to assess an idealized normal interval in this simulation. A real-data procedure would need to estimate the required uncertainty or use another justified method.Across 500 replications, coverage near 0.95 has Monte Carlo SE about 0.01. Both the numerical variances and coverages fluctuate. A familiar-looking density is evidence about this experiment, not a substitute for the assumptions and proof.## ExercisesThe checkpoint is this page’s completion target. Additional practice is optional.::: {#checkpoint-sp-06 .checkpoint}### Checkpoint · SP-06 — Derive the quantile expansion and influence function {.unnumbered}**Task type:** Derivation using a stated stochastic lemma.Under the quantile conditions in this page, derive the expansion using the displayed CDF decomposition and stated stochastic-equicontinuity fact. Identify the influence function, its variance, and the additional requirement for a feasible standard error. Independently derive the path derivative by differentiating $F_t(q_t)=\tau$ along a valid bounded-score path. Explain why a pointwise derivative of the sample indicator cannot replace the argument.**Ready to continue when:** you can distinguish the population derivative from the stochastic increment and obtain both the expansion and pathwise representation.**Transfer:** For the standard-normal median, compute the variance. Which step fails when the density is zero at the target?<details class="checkpoint-help"><summary>Hint</summary>The approximate sample root has an error of order 1/n. Along a path, differentiating the CDF changes both its distribution and its endpoint.</details><details class="checkpoint-help"><summary>Solution outline — open after trying</summary>The approximate-root error and empirical-CDF increment are $o_p(n^{-1/2})$. The population change is $f(q)(\hat q-q)$ plus a negligible remainder, so inversion gives $\hat q-q=(\tau-F_n(q))/f(q)+o_p(n^{-1/2})$. The influence function is $(\tau-1\{Y\le q\})/f(q)$ with variance $\tau(1-\tau)/f(q)^2$. For a score $s$, differentiation gives $0=E[1\{Y\le q\}s]+f(q)\dot q$; using $E[s]=0$ recovers $\dot q=E[\phi_qs]$. A feasible variance estimate needs density consistency at $q$ or another justified method. The sample CDF is discontinuous, so its pointwise derivative does not supply the population density. For a standard-normal median the influence variance is $\pi/2$, giving first-order estimator variance $\pi/(2n)$; a zero density prevents the displayed derivative inversion.</details>:::### Additional practice (optional) {.unnumbered}1. Compare R quantile types 1 and 7 and explain why their first-order limits can agree.2. Identify the derivative step that fails when the density vanishes at the target.