Beta {DELTD} | R Documentation |
Estimate Density Values by Beta kernel
Description
This function provide the estimated Kernel density values by using Beta Kernel. The Beta kernel is developed by Chen (2000) by using Beta distribution of first kind. He was first to introduce asymetrical kernels to control boundary Bias. Beta Kernel is
K_{Beta( \frac{x}{h}+1, \frac{1-x}{h}+1)}(y)=\frac{y^ \frac{x}{h} (1-y)^{\frac{1-x}{b}}} { B \{ \frac{x}{h}+1, \frac{(1-x)}{h}+1 \}}
Usage
Beta(x = NULL, y, k = NULL, h = NULL)
Arguments
x |
scheme for generating grid points |
y |
a numeric vector of positive values |
k |
number of gird points |
h |
the bandwidth |
Details
In this function, choice of bandwidth, number of grid points and scheme that how these grid points are generated are user based. If any parameter(s) is missing then function used default parameters.
But at least x
or k
should be specified otherwise NA
will be produced. If x
is missing then function will generate k
grid points by using uniform distribution. Similarly, if
k
is missing then function consider it same to length of main vector. In case if h
is missing then function used normal scale rule bandwidth for non-normal data and described in Silverman (1986). This function can be only used if
data is between (0, 1). Similarly, x
should be also lies between (0, 1).
Value
x |
grid points |
y |
estimated values of density |
Author(s)
Javaria Ahmad Khan, Atif Akbar.
References
Chen, S. X. 2000. Beta kernel smothers for regression curves. Statistica Sinica 10, 73-91. Silverman, B. W. 1986. Density Estimation. Chapman & Hall/ CRC, London.
See Also
For further kernels see Erlang
, BS
, Gamma
and LogN
. To plot its density see plot.Beta
and to calculate MSE mse
.
Examples
## Data: Simulated or real data can be used
## 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 <- runif(50)
xx <- sample(0.00001:900, 500, replace = FALSE)/1000
h <- 0.9
Beta(x = xx, y = y, k = 500, h = h)
## If scheme for generating grid points is unknown
y <- runif(500)
h <- 0.9
Beta(x = xx, y = y, k = 500, h = h)
## Not run:
## If user do not mention the number of grid points
y <- runif(1000)
xx <- seq(0.001, 1000, length = 2000)
## any bandwidth can be used
require(kedd)
h <- h.bcv(y) ## Biased cross validation
Beta(x = xx, y = y, h = h)
## End(Not run)
## Not run:
##if both generating scheme and number of grid points are missing then function generate NA
y <- runif(1000)
band = 0.8
Beta(y = y, h = band)
## End(Not run)
## if bandwidth is missing
y <- runif(100)
xx <- seq(0.001, 100, length = 300)
Beta(x = xx, y = y, k = 200)