kdeGauss: Gaussian kernel density estimator.

Description Usage Arguments Details Value Examples

Description

Estimate a density function using a kernel density estimator with a Gaussian kernel.

Usage

1
2
3
4
5
dkdeGauss(x, mu, h)

pkdeGauss(x, mu, h)

qkdeGauss(x, mu, h)

Arguments

x

A data point, or quantile, at which the kernel density estimator should be evaluated.

mu

A vector of data points on which the kernel density estimator is based.

h

The kernel density estimator bandwidth.

Details

The cumulative distribution function is calculated using the numerical integration C code implimented for R's integrate functions, i.e. using Rdqagi. For this approximation, subdiv = 100 (100 subdivisions), and eps_abs = eps_rel = 1e-10, i.e. the absolute and relative errors respectively.

The quantiles of the Gaussian kernel density estimator are calculated using Brent's method. This method requires an interval in which a solution is saught. The objective funcion for which a zero is saught is dkdeGauss-x, where x is the quantile saught. The first interval in which a solution is searched for, corresponds to the range of mu, and is expanded in multiples thereof in consequtive steps. The maximum number of iterations is set at 1000, and the accuracy saught between iterations, is set at 1e-10.

Value

dkdeGauss: The estimated value of the density function at the point x.

pkdeGauss: The estimated value of the cumulative distribution function at the point x.

qkdeGauss: A list with the following components:

Examples

1
2
3
4
5
6
library(alR)
x <- rnorm(100)
h_x <- bw(x, type=1)
dkdeGauss(0, x, h_x)
pkdeGauss(0, x, h_x)
qkdeGauss(0.5, x, h_x)

alR documentation built on Dec. 7, 2017, 5:03 p.m.