transdens: Transform a biased sample to estimate probability density

View source: R/transformed_density_fcn.R

transdensR Documentation

Transform a biased sample to estimate probability density

Description

Calculate a kernel density estimate while correcting for selection bias by transforming the data.

Usage

transdens(x, w, reflect = FALSE, a = NULL, b = NULL, ...)

Arguments

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 x.

reflect

Logical: should boundary reflection be applied?

a

The lower limit for density estimation, on the original, untransformed scale. Default is min(x).

b

The upper limit for density estimation, on the original, untransformed scale. Default is max(x).

...

Further arguments passed on to density.

Details

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.

Value

An S3 density, with the additional attribute $xTrans, which is the location of $x values along the transformed axis.

References

\insertRef

Barmi00kerneval

See Also

wdens


GwenAntell/kerneval documentation built on July 21, 2023, 6:23 p.m.