Fast delete-one jackknife for rank-weighted functionals (auto C++ when available, R fallback otherwise)
Source:R/jackknife-rank.R
jackknife_fast_rank.RdComputes the baseline aggregate theta0 and all delete-one aggregates
theta_loo for generic rank-weighted L-stat rules with finite support s.
Arguments
- ranks
Integer matrix (T x (s+1)) of positive neighbor indices (1-based). Each row t lists the first s+1 neighbors of target t.
- a
Finite numeric length-s vector of L-stat coefficients a_1..a_s.
- phi
either:
finite numeric matrix (n_ref x q): row j is the q-vector phi(j), or
function
function(j, t)returning a finite numeric length-q vector (allows target dependence). For a scalar \(\phi\), usecbind(y)as the matrix case.
- normalize
Scalar logical; if TRUE (default) divide by sum(a).
Value
list with:
theta0: numeric length-q baseline aggregate,theta_loo: numeric matrix (n_ref x q) of delete-one aggregates,info: list(s, T, q, normalize).
Details
This utility is for rules that are fully characterized by:
the first
s + 1ranked observations for each target, anda finite coefficient vector
a_1, ..., a_s.
It is therefore appropriate for compact-support L-statistics. The user-level
DNN wrappers (np_dnn(), cate_dnn(), plqr_dnn()) do not call this
helper directly for exact DNN weights. Those wrappers keep the full rank
matrix and reevaluate the DNN rank-weight rule after delete-one updates.
If
phiis a numeric matrix (n_ref x q) with rowsphi[j, ] = phi(j)and the package was compiled with C++ support, this calls the C++ fast path.Otherwise, it uses a general R fallback that also supports target-dependent per-neighbor contributions via a function
phi(j, t).