area.between: Area between a Density Function and a Kernel Estimate

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/GoFKernel.r

Description

The function area.between is an (internal) function of the GoFKernel package that calculates the area, in a given interval, between a theoretical density function and an empirical kernel estimate. area.between is called by dgeometric.test of the GoFKernel package.

Usage

1
area.between(f, kernel.density, lower = -Inf, upper = Inf)

Arguments

f

a density function.

kernel.density

an empirical kernel estimate, an object of the class density.

lower

lower limit of the support of f, default -Inf.

upper

upper limit of the support of f, default Inf.

Details

area.between is called by dgeometric.test and numerically calculates the area between the density function of the null hypothesis and the kernel density estimate of either the observed sample or a simulated sample from f.

Value

A number corresponding to the numerical value of the area between a density function and a kernel estimate.

Author(s)

Jose M. Pavia

See Also

density.reflected, dgeometric.test, inverse random.function, support.facto and density

Examples

1
2
3
4
5
6
7
8
9
## Unbounded example
x <- rnorm(100)
dx <- density(x)
area.between(dnorm, dx)

## Bounded example
x <- rbeta(100, 1.3, 2)
dx <- density.reflected(x, lower=0, upper=1)
area.between(dunif, dx)

Example output

Loading required package: KernSmooth
KernSmooth 2.23 loaded
Copyright M. P. Wand 1997-2009
[1] 0.1604134
[1] 0.3501884

GoFKernel documentation built on May 2, 2019, 11:41 a.m.