| npudisthat | R Documentation |
Constructs the unconditional distribution hat operator associated with
npudist bandwidth objects. The returned operator maps a
right-hand side y to H y; with y = 1 this reproduces the
fitted unconditional distribution function.
npudisthat(bws,
tdat = stop("training data 'tdat' missing"),
edat,
y = NULL,
output = c("matrix", "apply"))
These arguments identify the fitted bandwidth object, training data, and evaluation data.
bws |
A fitted unconditional distribution bandwidth object of class |
edat |
Optional evaluation data. If omitted, the operator is built on the training data. |
tdat |
Training data used to construct the operator. |
These arguments control whether the operator is returned as a matrix or applied directly.
output |
Either |
y |
Optional right-hand side vector or matrix with one row per training observation. |
For output = "matrix", the return value is a matrix with class
c("npudisthat", "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.
This helper is intended for object-fed repeated evaluation once a bandwidth object has already been constructed. It does not perform bandwidth selection.
Either a hat matrix of class "npudisthat" or the applied result
H y, depending on output.
## Not run:
data(cps71)
tx <- data.frame(age = cps71$age)
bw <- npudistbw(dat = tx, bwtype = "fixed",
bandwidth.compute = FALSE, bws = 1.0)
H <- npudisthat(bws = bw, tdat = tx)
dist.hat <- npudisthat(bws = bw, tdat = tx,
y = rep(1, nrow(tx)),
output = "apply")
dist.core <- fitted(npudist(bws = bw, tdat = tx))
head(cbind(dist.core, dist.hat), n = 2L)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.