loglik: Log-likelihood value of a mixture

View source: R/cnm.R

loglikR Documentation

Log-likelihood value of a mixture

Description

Computes the log-likelihood value

x must belong to a mixture family, as specified by its class.

Usage

loglik(mix, x, beta = NULL, attr = FALSE)

Arguments

mix

a discrete distribution, as defined by class disc.

x

a data object of a mixture model class.

beta

the structural parameter, if any.

attr

=FALSE, by default. If TRUE, also returns attributes "dmix" and "logd"

Value

the log-likelihood value.

Author(s)

Yong Wang <yongwang@auckland.ac.nz>

References

Wang, Y. (2007). On fast computation of the non-parametric maximum likelihood estimate of a mixing distribution. Journal of the Royal Statistical Society, Ser. B, 69, 185-198.

Wang, Y. (2010). Maximum likelihood computation for fitting semiparametric mixture models. Statistics and Computing, 20, 75-86

See Also

cnm, cnmms, npnorm, nppois, disc,

Examples


## Poisson mixture
mix0 = disc(c(1,4), c(0.7,0.3))
x = rnppois(10, mix0)
loglik(mix0, x)

## Normal mixture
x = rnpnorm(10, mix0, sd=2)
loglik(mix0, x, 2)


nspmix documentation built on June 8, 2025, 12:29 p.m.

Related to loglik in nspmix...