# kdeGaussInt: Arc length of Gaussian KDE. In alR: Arc Lengths of Statistical Functions

## Description

Calculate the arc length for a univariate Gaussian kernel density estimator over a specified interval.

## Usage

 ```1 2 3 4 5 6 7``` ```kdeGaussInt(mu, h, q1, q2, quantile) kdeGaussInt2(mu, h, q1, q2, quantile) kdeGaussIntApprox(mu, h, q1, q2, quantile) kdeGaussIntApprox2(mu, h, q1, q2, quantile) ```

## Arguments

 `mu` A vector of data points on which the kernel density estimator is based. `h` The kernel density estimator bandwidth. `q1` The point (or vector for `kdeGaussInt2`) specifying the lower limit of the arc length integral. `q2` The point (or vector for `kdeGaussInt2`) specifying the upper limit of the arc length integral. `quantile` Logical, TRUE/FALSE, whether `q1` and `q2` are quantiles, or actual points in the domain.

## Details

For `kdeGaussInt` and `kdeGaussInt2`, the arc length of a univariate Gaussian kernel density estimator is approximated using the numerical integration C code implimented for R's integrate functions, i.e. using Rdqags. For this approximation, subdiv = 100 (100 subdivisions), and eps_abs = eps_rel = 1e-10, i.e. the absolute and relative errors respectively.

For `kdeGaussIntApprox`, the arc length is approximated by constructing the KDE, and then calculated as the sum of a finite collection of straight lines, based on the Pythagorean theorem.

## Value

kdeGaussInt: A list with the following components:

• value: The resultant arc length.

• abs.err: The absolute error between iterations. subdivisions: Number of subdivisions used in the numerical approximation.

• neval: Number of function evaluations used by the numerical approximation.

kdeGaussInt2: A vector having length equal to that of the vector of lower quantile bounds, containing the arc lengths requested for a Gaussian kernel density estimator.

kdeGaussIntApprox: The resultant arc length.

kdeGaussIntApprox2: A vector having length equal to that of the vector of lower quantile bounds, containing the discrete arc lengths requested for a Gaussian kernel density estimator.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ```library(alR) mu <- rnorm(100) h <- bw(mu, type=1) kdeGaussInt(mu, h, 0.025, 0.975, TRUE) kdeGaussInt(mu, h, -1.96, 1.96, FALSE) kdeGaussInt2(mu, h, c(0.025, 0.5), c(0.5, 0.975), TRUE) kdeGaussInt2(mu, h, c(-1.96, 0), c(0, 1.96), FALSE) kdeGaussIntApprox(mu, h, 0.025, 0.975, TRUE) kdeGaussIntApprox(mu, h, -1.96, 1.96, FALSE) kdeGaussIntApprox2(mu, h, c(0.025, 0.5), c(0.5, 0.975), TRUE) kdeGaussIntApprox2(mu, h, c(-1.96, 0), c(0, 1.96), FALSE) ```

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