R: Area between a Density Function and a Kernel Estimate
area.between
R Documentation
Area between a Density Function and a Kernel Estimate
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.
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, inverserandom.function, support.facto and
density
Examples
## 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)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GoFKernel)
Loading required package: KernSmooth
KernSmooth 2.23 loaded
Copyright M. P. Wand 1997-2009
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GoFKernel/area.between.Rd_%03d_medium.png", width=480, height=480)
> ### Name: area.between
> ### Title: Area between a Density Function and a Kernel Estimate
> ### Aliases: area.between
> ### Keywords: density
>
> ### ** Examples
>
> ## Unbounded example
> x <- rnorm(100)
> dx <- density(x)
> area.between(dnorm, dx)
[1] 0.09007288
>
> ## Bounded example
> x <- rbeta(100, 1.3, 2)
> dx <- density.reflected(x, lower=0, upper=1)
> area.between(dunif, dx)
[1] 0.4146827
>
>
>
>
>
> dev.off()
null device
1
>