View source: R/transformed_density_fcn.R
transdens | R Documentation |
Calculate a kernel density estimate while correcting for selection bias by transforming the data.
transdens(x, w, reflect = FALSE, a = NULL, b = NULL, ...)
x |
A numeric vector from which the estimate is to be computed. |
w |
A function that gives the probability of observation
at any single value in the range of |
reflect |
Logical: should boundary reflection be applied? |
a |
The lower limit for density estimation,
on the original, untransformed scale. Default is |
b |
The upper limit for density estimation,
on the original, untransformed scale. Default is |
... |
Further arguments passed on to |
transdens
implements the strategy of Barmi and Simonoff (2000)
to correct for selection bias in kernel density estimation. The method
(1) transforms the empirical data based on the cumulative distribution function
of the bias function w
, (2) scales the density so it integrates to
unity, and then (3) back-transforms the density to the original scale.
Depending on the shape of the true probability distribution function and
the bias function, analysts would be wise to inspect kernel density plots on
the transformed scale, just as one might plot estimates (on the original
scale) when selecting a bandwidth. In particular, one should consider whether
the transformed distribution has a long tail or otherwise is difficult
to estimate. If the density estimation problem seems more straightforward
on the original scale, one could weight the kernel density estimate
with wdens()
instead of transforming the data.
An S3 density, with the additional attribute $xTrans
,
which is the location of $x
values along the transformed axis.
Barmi00kerneval
wdens
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.