Learn R Programming

Ake (version 1.0.2)

dke.fun: Function for density estimation

Description

The (S3) generic function dkde.fun computes the density. Its default method does so with the given kernel and bandwidth \(h\).

Usage

dke.fun(Vec, ...)
# S3 method for default
dke.fun(Vec, h, type_data = c("discrete", "continuous"), 
ker = c("BE", "GA", "LN", "RIG"), x = NULL, a0 = 0, a1 = 1, ... )

Value

Returns a list containing:

data

The data - same as input Vec.

n

The sample size.

kernel

The asssociated kernel used to compute the density estimate.

h

The bandwidth used to compute the density estimate.

eval.points

The coordinates of the points where the density is estimated.

est.fn

The estimated density values.

C_n

The global normalizing constant.

hist

The histogram corresponding to the observations.

Arguments

Vec

The data sample from which the estimate is to be computed.

h

The bandwidth or smoothing parameter.

type_data

The data sample type. Data can be continuous or discrete (categorical or count). Here, in this function , we deal with continuous data.

ker

A character string giving the smoothing kernel to be used which is the associated kernel: "BE" extended beta, "GA" gamma, "LN" lognormal and "RIG" reciprocal inverse Gaussian.

x

The points of the grid at which the density is to be estimated.

a0

The left bound of the support used for extended beta kernel. Default value is 0 for beta kernel.

a1

The right bound of the support used for extended beta kernel. Default value is 1 for beta kernel.

...

Further arguments.

Author

W. E. Wansouwé, S. M. Somé and C. C. Kokonendji

Details

The associated kernel estimator \(\widehat{f}_n\) of \(f\) is defined in the above sections. We recall that in general, the sum of the estimated values on the support is not equal to 1. In practice, we compute the global normalizing constant \(C_n\) before computing the estimated density \(\tilde{f}_n\); see e.g. Libengué (2013).

References

Libengué, F.G. (2013). Méthode Non-Paramétrique par Noyaux Associés Mixtes et Applications, Ph.D. Thesis Manuscript (in French) to Université de Franche-Comté, Besançon, France and Université de Ouagadougou, Burkina Faso, June 2013, LMB no. 14334, Besançon.

Examples

Run this code
## A sample data with n=100.
V<-rgamma(100,1.5,2.6)
##The bandwidth can be the one obtained by cross validation.
h<-0.052
## We choose Gamma kernel.

est<-dke.fun(V,h,"continuous","GA")

Run the code above in your browser using DataLab