qdf: Nonparametric estimation of a quantile density function

View source: R/qdf.R

qdfR Documentation

Nonparametric estimation of a quantile density function

Description

Estimates the quantile density function q(u) = Q'(u) = 1/g(Q(u)) (Parzen 1979; also called the sparsity function, Tukey 1965) from an i.i.d. sample, with the smoothing parameter chosen by cross-validation. Ten estimators are available; see [qdf_kernel()], [qdf_poisson()], [qdf_jones()] and [qdf_wavelet()] for their definitions and the simulation evidence in Doosti, Dewan and Talebian (2025), where the indirect Poisson estimator with BCV bandwidth performed best for first-price auction inversion.

Usage

qdf(
  x,
  method = c("indirect_poisson", "kernel", "kernel_corrected", "poisson", "bernstein",
    "jones", "soni", "wavelet", "wavelet_hard", "wavelet_block"),
  bandwidth = c("bcv", "rlcv", "wbcv", "sqrt", "cv"),
  m_range = NULL,
  u = NULL,
  H = NULL,
  kernel = "gaussian",
  j0 = NULL,
  loo = NULL,
  zero_at_origin = TRUE,
  grid = NULL,
  u_scheme = NULL,
  optimizer = NULL,
  rescale = TRUE,
  ...
)

Arguments

x

numeric sample. The series estimators ('"poisson"', '"bernstein"', '"indirect_poisson"') require strictly positive data.

method

one of '"indirect_poisson"' (default), '"kernel"', '"kernel_corrected"', '"poisson"', '"bernstein"', '"jones"', '"soni"', or the wavelet estimators '"wavelet"' (linear), '"wavelet_hard"', '"wavelet_block"' of [qdf_wavelet()], all with local-linear smoothing.

bandwidth

either a selector name ('"bcv"', the default, or '"rlcv"'; '"wbcv"' is kept only for backward compatibility: it is not scale-invariant, is not recommended and warns, see [bcv_criterion()]; for the wavelet methods '"cv"', the default for them, see [select_wavelet()]), the rule '"sqrt"', or a numeric bandwidth h to use directly. '"sqrt"', for 'method = "bernstein"' only, sets m = \lceil\sqrt{n}\rceil, the rule used in Doosti (2026b): it lies inside the range n^{2/5} \ll m \ll n^{2/3} covered by that paper's asymptotic theory and was calibrated there over the designs of Zincenko (2024).

m_range

search range for m = 1/h when a selector is used. Defaults to 'c(10, 50)' ('c(1, 50)' for '"jones"' and '"soni"'), the ranges used in the published simulations.

u

evaluation grid in [0, 1]. Defaults to i/(n+1).

H

second bandwidth for 'method = "soni"' (the outer smoother on the probability scale). Defaults to the Sheather–Jones bandwidth of the uniform scores, 'bw.SJ(rank(x)/n)'.

kernel

kernel for the kernel-type estimators ('"gaussian"', '"triangular"', '"epanechnikov"'); see [qdf_kernel()].

j0

resolution level for the wavelet methods (default 5 when a numeric 'h' is given; chosen by cross-validation with 'bandwidth = "cv"').

loo, grid, u_scheme, optimizer

passed to [select_bandwidth()].

zero_at_origin

logical (default 'TRUE'), for 'method = "bernstein"' only: anchor the fitted quantile function at Q_n(0) = 0. The default reproduces earlier versions. 'FALSE' anchors at the smallest observation instead and is preferable when the data do not start near zero (for example bids in dollars); it changes the fit only in the lowest few percent of quantiles. Ignored by the other estimators.

rescale

logical (default 'TRUE'): estimate on x/s, s the sample standard deviation, and return s\,\hat q. This makes every estimator scale-equivariant; it matters for the indirect Poisson, Jones and Soni estimators, whose smoothing parameter lives on the data scale (for them the reported 'h' refers to the standardised data). The kernel, corrected kernel, Poisson and Bernstein estimators are equivariant anyway. 'FALSE' reproduces the original implementations.

...

currently unused.

Value

An object of class '"qdf"': a list with components

x

the sorted sample

u, q

the evaluation grid and the estimated quantile density on it

Q

the empirical quantile function on 'u' (for convenience)

method, h, m, H

the estimator and its smoothing parameters

selection

the output of [select_bandwidth()], or 'NULL' when a numeric bandwidth was supplied

with methods [predict.qdf()], 'print()' and [plot.qdf()].

References

Doosti, H., Dewan, I. and Talebian, M. (2025). Nonparametric estimation of private value distributions in first-price auctions: Evaluating quantile density function approaches. *Economics Letters*, 257, 112670. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.econlet.2025.112670")}

Parzen, E. (1979). Nonparametric statistical data modeling. *Journal of the American Statistical Association*, 74, 105–121.

Examples

set.seed(1)
x <- rgamma(80, 5, 1)
fit <- qdf(x, method = "bernstein", bandwidth = "bcv")
fit
predict(fit, u = c(0.1, 0.5, 0.9))
# compare with the truth 1 / dgamma(qgamma(u, 5), 5)
plot(fit, true = function(u) 1 / dgamma(qgamma(u, 5, 1), 5, 1))

qdfauction documentation built on Nov. 10, 2026, 5:07 p.m.