distr_density function

Compute Density

Compute Density

A function computing density or its logarithm of a given distribution.

distr_density(y, f, distr, param = NULL, par_link = NULL, trans = NULL)

Arguments

  • y: Observations. For an univariate distribution, a numeric vector. For a multivariate distribution, a numeric matrix with observations in rows or a numeric vector of a single observation.
  • f: Parameters. For the same parameters for all observations, a numeric vector. For individual parameters for each observation, a numeric matrix with rows corresponding to observations.
  • distr: A distribution.
  • param: A parametrization of the distribution.
  • par_link: An optional logical vector indicating whether the logarithmic/logistic link should be applied to restricted parameters in order to obtain unrestricted values. Defaults to keeping the original link for all parameters.
  • trans: An optional transformation of the density. The supported transformation is the logarithm of the density (trans = "log").

Returns

The (transformed) density.

Examples

# Density of the negative binomial distribution distr_density(y = c(1, 8, 5, 0, 0), f = c(13.50, 0.03), distr = "negbin")

See Also

distr()

  • Maintainer: Vladimír Holý
  • License: GPL-3
  • Last published: 2024-02-02