JonesCorrectionMuller94BoundaryKernel {bde} | R Documentation |
Class "JonesCorrectionMuller94BoundaryKernel"
Description
This class deals with nonnegative boundary correction of the muller94BoundaryKernel
estimators for bounded densities. In this normalization, two kernel functions are needed. The first kernel funciton -K(u)
- is the kernel function used in muller94BoundaryKernel
(using left boundary, interior or right boundary kernel functions as needed). For the second kernel function, the popular choice L(u) = u * K(u)
is taken. The kernel estimator is computed using the provided data samples. Using this kernel estimator, the methods implemented in the class can be used to compute densities, values of the distribution function, quantiles, sample the distribution and obtain graphical representations. Note that the renormalization of this kernel estimator guarantees nonnegative values for the density function but the cumulative density function may takes values greater than 1.
Objects from the Class
Objects can be created by using the generator function jonesCorrectionMuller94BoundaryKernel
.
Slots
dataPointsCache
:a numeric vector containing points within the
[lower.limit,upper.limit]
intervaldensityCache
:a numeric vector containing the density for each point in
dataPointsCache
distributionCache
:a numeric vector used to cache the values of the distribution function. This slot is included to improve the performance of the methods when multiple calculations of the distribution function are used
dataPoints
:a numeric vector containing data samples within the
[lower.limit,upper.limit]
interval. These data samples are used to obtain the kernel estimatorb
:the bandwidth of the kernel estimator
mu
:a integer value indicating the degree of smoothness for the boundary kernel.
mu
can take the following values: 0 (uniform kernel), 1 (Epanechnikov kernel), 2 (biweight kernel) or 3 (triweight kernel)normalizedKernel
:this slot is used to save a NormalizedBoundaryKernel object used in the normalization. It is only for internal use
lower.limit
:a numeric value for the lower limit of the bounded interval for the data
upper.limit
:a numeric value for the upper limit of the bounded interval for the data
Methods
- density
See
"density"
for details- distribution
See
"distribution"
for details- quantile
See
"quantile"
for details- rsample
See
"rsample"
for details- plot
See
"plot"
for details- getdataPointsCache
See
"getdataPointsCache"
for details- getdensityCache
See
"getdensityCache"
for details- getdistributionCache
See
"getdistributionCache"
for details- getdataPoints
See
"getdataPoints"
for details- getb
See
"getb"
for details- getmu
See
"getmu"
for details
Author(s)
Guzman Santafe, Borja Calvo and Aritz Perez
References
Jones, M. C. and Foster, P. J. (1996). A simple nonnegative boundary correction method for kernel density estimation. Statistica Sinica, 6, 1005-1013.
Muller, H. and Wang, J. (1994). Hazard rate estimation under random censoring with varying kernels and bandwidths. Biometrics, 50(1), 61-76.
Examples
# data points to cache densities and distribution
cache <- seq(0,1,0.01)
# create the model
kernel <-jonesCorrectionMuller94BoundaryKernel(dataPoints = tuna.r, b = 0.01, mu = 2,
dataPointsCache = cache)
# examples of usual functions
density(kernel,0.5)
distribution(kernel,0.5,discreteApproximation=FALSE)
# graphical representation
hist(tuna.r,freq=FALSE,main="Tuna Data")
lines(kernel, col="red",lwd=2)
# graphical representation using ggplot2
graph <- gplot(kernel, show=TRUE, includePoints = TRUE)