Conditional Distribution Hat Operator
npcdisthat.RdConstructs the conditional distribution hat operator associated with
npcdist bandwidth objects. The returned operator maps a
right-hand side y to \(H y\); with y = 1 this reproduces the
fitted conditional distribution function.
Arguments
Data, Bandwidth Inputs And Formula Interface
These arguments identify the fitted bandwidth object, training data, and evaluation data.
- bws
A fitted conditional distribution bandwidth object of class
"condbandwidth".- exdat
Optional evaluation conditioning data. If omitted, the operator is built on the training conditioning data.
- eydat
Optional evaluation response data. If omitted, the operator is built on the training response data.
- txdat
Training conditioning data used to construct the operator.
- tydat
Training response data used to construct the operator.
Operator Output
These arguments control whether the operator is returned as a matrix or applied directly.
Details
For output = "matrix", the return value is a matrix with class
c("npcdisthat", "matrix") and attributes storing the bandwidth object,
training data, evaluation data, and call metadata.
For output = "apply", the function returns H y directly. Matrix
right-hand sides are applied column-wise.
The optional s argument follows the derivative multi-index convention
used by npreghat for continuous conditioning variables. The
default s = NULL returns the ordinary conditional-distribution hat
operator. Supplying one first derivative, for example s = 1L in a
univariate continuous-\(x\) problem or s = c(x2 = 1L) in a
multivariate problem, returns the hat operator for that component of the
conditional-distribution gradient. This derivative route is intended to match
npcdist(..., gradients = TRUE)$congrad.
This helper is intended for object-fed repeated evaluation once a bandwidth object has already been constructed. It does not perform bandwidth selection.
Examples
if (FALSE) { # \dontrun{
data(cps71)
tx <- data.frame(age = cps71$age)
ty <- data.frame(logwage = cps71$logwage)
bw <- npcdistbw(xdat = tx, ydat = ty, bwtype = "fixed",
bandwidth.compute = FALSE, bws = c(1.0, 1.0))
H <- npcdisthat(bws = bw, txdat = tx, tydat = ty)
dist.hat <- npcdisthat(bws = bw, txdat = tx, tydat = ty,
y = rep(1, nrow(tx)),
output = "apply")
dist.core <- fitted(npcdist(bws = bw, txdat = tx, tydat = ty))
head(cbind(dist.core, dist.hat), n = 2L)
} # }