cdf.bd: \insertCitebose2022;textualWData kernel distribution...

View source: R/cdf.bd.R

cdf.bdR Documentation

\insertCitebose2022;textualWData kernel distribution estimator

Description

This function computes \insertCitebose2022;textualWData kernel distribution estimator given a sample and the corresponding biased function.

Usage

cdf.bd(
  y,
  w = function(y) {
     ifelse(y >= 0, y, NA)
 },
  y.seq,
  bw = "bw.F.SBC.rt",
  kernel = c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight",
    "cosine", "optcosine"),
  from,
  to,
  nb = 512L,
  plot = TRUE,
  correction = c("none", "left", "right", "both"),
  ...
)

Arguments

y

A numeric vector containing the biased sample.

w

A function representing the bias function applied to the data points. It must be evaluable and positive in each point of the sample y. By default, it is set to the length-biased function.

y.seq

A numeric vector specifying the points where the distribution is estimated. Alternatively, from, to and nb can be used to define the evaluation points.

bw

The bandwidth to be used in the distribution estimation. bw can also be a character string giving a rule to choose the bandwidth. In this case, options available are bw.F.SBC.rt, bw.F.BD, bw.F.SBC.cv and bw.F.SBC.pi. Default is bw.F.SBC.rt.

kernel

A character string specifying the kernel function. Available options: "gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine" and "optcosine".

from

Numeric value specifying the lower bound of the grid where the estimator is computed when y.seq is not provided. Default is computed based on the range of input data.

to

Numeric value specifying the upper bound of the grid where the estimator is computed when y.seq is not provided. Default is computed based on the range of input data.

nb

An integer specifying the number of points at which the estimator is computed when y.seq is not provided. Default is 512.

plot

A logical value indicating whether to plot the estimation. Default is TRUE.

correction

A character string specifying the boundary correction to be applied. Options are "none", "left", "right" and "both". Default is "none".

...

Additional arguments to be passed to bandwidth selection functions.

Details

\insertCite

bose2022;textualWData kernel distribution estimator is expressed as

\widehat{F}_{h_{F}}(y) = \frac{\widehat{\mu}_w}{n} \sum_{i=1}^n \frac{1}{w(Y_i)} W_{h_{F}}\left(y-Y_i\right), \quad \text{where}\quad \widehat{\mu}_w=n \left(\sum_{i=1}^{n}\frac{1}{w(Y_i)}\right)^{-1},

h_{F} is the bandwidth, W is the kernel distribution function and W_{h_{F}}(u) = W(u/{h_{F}}). \insertCitebose2022;textualWData propose a truncation correction for variables with compact support [a,b] for the estimator as follows:

\widehat{F}_{[a,b], h_{F}}(y)=\left\{ \begin{array}{ll} 0, & y<a \\ \dfrac{\widehat{F}_{h_{F}}(y)-\widehat{F}_{h_{F}}(a)}{\widehat{F}_{h_{F}}(b)-\widehat{F}_{h_{F}}(a)}, & a \leq y<b \\ 1, & y \geq b. \end{array} \right.

The truncation correction is also valid for variables supported on [a, +\infty) or (-\infty, b], replacing \widehat{F}_{h_{F}}(b) by 1 or \widehat{F}_{h_{F}}(a) by 0, respectively, in the above expression. This correction is implemented in the correction argument, which can take values "none", "left", "right" or "both". If "left", the estimator is corrected to 0 for values less than the minimum of y.seq; if "right", it is corrected to 1 for values greater than the maximum of y.seq; if "both", it applies both corrections simultaneously.

Value

A list with the following components:

y.seq

The points where the distribution is estimated.

F.hat

The estimated distribution values.

bw

The bandwidth value.

n

The sample size after removal of NaN, Na and Inf.

call

The call which produced the result.

has.na

Logical; indicates whether the original vector y contains any NaN, Na or Inf.

References

\insertAllCited

See Also

bw.F.SBC.rt, bw.F.BD, bw.F.SBC.cv, bw.F.SBC.pi

Examples

cdf.bd(shrub.data$Width, kernel = "epanechnikov")
cdf.bd(shrub.data$Width, bw = "bw.F.SBC.cv")

WData documentation built on Nov. 2, 2026, 1:10 a.m.