df.bhatta: \insertCitebhattacharyya1988;textualWData density estimator

View source: R/df.bhatta.R

df.bhattaR Documentation

\insertCitebhattacharyya1988;textualWData density estimator

Description

This function computes \insertCitebhattacharyya1988;textualWData density estimator given a sample and the corresponding biased function.

Usage

df.bhatta(
  y,
  w = function(y) {
     ifelse(y >= 0, y, NA)
 },
  plot = TRUE,
  ...
)

Arguments

y

A numeric vector containing the biased sample.

w

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

plot

Logical indicating whether to plot the estimated density. Default is TRUE.

...

Additional arguments to be passed to density function as, for instance, kernel or bw:

  • kernel A character string giving the kernel to be used. This must partially match one of "gaussian", "rectangular", "triangular", "epanechnikov", "biweight", "cosine" or "optcosine", with default "gaussian", and may be abbreviated to a unique prefix (single letter).

  • bw The smoothing bandwidth to be used in the density estimation. bw can also be a character string giving a rule to choose the bandwidth. Options available can be checked in bw.nrd. Default is "nrd0".

Details

\insertCite

bhattacharyya1988;textualWData density estimator is computed as follows:

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

and \widehat{g}_{h_{g}}(y) is the kernel density estimate of the given data y using density function with main arguments bw and kernel.

Value

A list with the following components:

y.seq

The points where the density is estimated.

f.hat

The estimated density 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

Examples

# Rule of thumb
df.bhatta(shrub.data$Width, bw = "nrd0")
# Cross Validation
df.bhatta(shrub.data$Width, bw = "ucv")
# Sheather & Jones
bhata_sj <- df.bhatta(shrub.data$Width, bw = "SJ-ste")
# Rectangular kernel
df.bhatta(shrub.data$Width, bw = "nrd0", kernel = "epanechnikov")


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