Learn R Programming

DELTD (version 2.6.8)

Gamma: Estimate Density Values by Gamma kernel

Description

This function provide the estimated Kernel density values by using Gamma Kernel.The Gamma kernel is developed by Chen (2000). He was first to introduce asymetrical kernels to control boundary Bias. Gamma Kernel is $$K_{Gam1( \frac{x}{h}+1, h)}(y) = \frac{y^ \frac{x}{h} exp(-\frac{y}{h})}{ \Gamma (\frac{x}{h}+1)h^{ \frac{x}{h}+1}}$$

Usage

Gamma(x = NULL, y, k = NULL, h = NULL)

Value

x

grid points

y

estimated values of density

Arguments

x

scheme for generating grid points

y

a numeric vector of positive values

k

number of gird points

h

the bandwidth

Author

Javaria Ahmad Khan, Atif Akbar.

Details

see the details in the BS.

References

Chen, S. X. 2000. Probability density function estimation using Gamma kernels. Annals of the Institute of Statistical Mathematics 52 (3), 471-480. Silverman, B. W. 1986. Density Estimation. Chapman & Hall/ CRC, London.

See Also

For further kernels see Erlang, BS, Betaand LogN. To plot its density see plot.Gamma and to calculate MSE mse.

Examples

Run this code
##Number of grid points "k" should be at least equal to the data size.
###If user defines the generating scheme of grid points then length
####of grid points should be equal or greater than "k". Otherwise NA will be produced.
y <- rexp(100, 1)
xx <- seq(min(y) + 0.05, max(y), length = 500)
h <- 2
den <- Gamma(x = xx, y = y, k = 200, h = h)

##If scheme for generating grid points is unknown
y <- rexp(200, 1)
h <- 3
Gamma(y = y, k = 90, h = h)

if (FALSE) {
y <- data(TUNA)
xx <- seq(min(y) + 0.05, max(y), length = 500)
h <- 2
den <- Gamma(x = xx, y = y, k = 200, h = h)
}

if (FALSE) {
##If user do not mention the number of grid points
y <- rexp(1000, 1)
xx <- seq(0.001, 1000, length = 1000)

#any bandwidth can be used
require(KernSmooth)
h <- dpik(y)
Gamma(x = xx, y = y, h = h)
}

if (FALSE) {
#if generating scheme and number of grid points are missing then function generate NA
y <- rexp(1000, 1)
band = 3
Gamma(y = y, h = band)
}

#if bandwidth is missing
y <- rexp(100,1)
xx <- seq(0.001, max(y), length = 100)
Gamma(x = xx, y = y, k = 90)

Run the code above in your browser using DataLab