Learn R Programming

kdensity (version 1.0.1)

parametric_starts: Parametric starts

Description

A parametric start is a density function with an associated estimator which is used as a starting point in kdensity. Several parametric starts are implemented, all with maximum likelihood estimation. Custom-made parametric starts are possible, see the Structure section.

Arguments

Built-in starts

uniform, constant: Selecting the uniform start makes kdensity act like an ordinary kernel density estimator. The default value for any choice of kernel or support. gaussian, normal: The normal distribution. A natural choice for densities on the real line \((-\infty, \infty)\). laplace, gumbel: Distributions on \((-\infty, \infty)\). exponential, gamma, lognormal, inverse_gaussian, weibull: Densities supported on the positive real line \((0, \infty)\). beta, kumaraswamy: The beta and Kumaraswamy distributions, supported on the unit interval \([0, 1]\). pareto: The Pareto distribution, supported on \([1, \infty)\). Has heavy tails.

Structure

The parametric start contains three elements: The density function, an estimation function, and the support of the density. The parameters of the density function must partially match the parameters of the estimator function. The estimator function takes one argument, a numeric vector, which is passed from kdensity.

See Also

kdensity; kernels; bandwidths

Examples

Run this code
# NOT RUN {
start_exponential = list(
 density = dexp,
 estimator = function(data) {
   c(rate = 1/mean(data))
 },
 support = c(0, Inf)
)

start_inverse_gaussian = list(
 density = extraDistr::dwald,
 estimator = function(data) {
  c(mu = mean(data),
    lambda = mean(1/data - 1/mean(data)))
  },
 support = c(0, Inf)
)

# }

Run the code above in your browser using DataLab