pvaldens {bootruin}R Documentation

Density Estimation of Data in the Unit Interval

Description

This function computes density estimators for densities with the unit interval as support. One example of data with such a density are p-values. Currently, two methods are implemented that differ in the kernel function used for estimation.

Usage

pvaldens(x, bw, rho, method = c("jh", "chen"))

Arguments

x

a numeric vector of data points between 0 and 1.

bw

a number indicating the bandwidth used for the density estimation.

rho

a number determining the correlation coefficient, only used if method = "jh"

method

a character string determining the kernel function that is used, see Details.

Details

Depending on which method is selected, a different kernel function is used for the estimation. Since the support of the estimated function is bounded, those kernel functions are location-dependent.

If method = "jh", a Gaussian copula-based kernel function according to Jones and Henderson (2007) is used. In this case the bandwidth can either be specified directly or as correlation coefficient: if rho > 0 denotes the correlation coefficient and h > 0 the bandwidth, then h^2 = 1 - rho. Note that rho and bw are mutually exclusive.

For method = "chen", the kernel function is based on a beta density, according to Chen (1999).

See the cited articles for more details.

Value

A function with a single vector-valued argument that returns the estimated density at any given point(s).

References

Jones, M. C. and Henderson, D. A. (2007) Kernel-Type Density Estimation on the Unit Interval. Biometrika, 94(4), pp. 977–984.

Chen, S. X. (1999) A Beta Kernel Estimation for Density Functions. Computational Statistics and Data Analysis, 31(2), pp. 131–145.

See Also

density

Examples

require(graphics)

x <- rbeta(100, 2, 5)
fhat <- pvaldens(x, rho = 0.9, method = "jh")

hist(x, freq = FALSE, xlim = c(0, 1))
curve(fhat(x), from = 0, to = 1, add = TRUE, col = 2)
box()

[Package bootruin version 1.2-4 Index]