Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

negLLzero

Likelihood with zero counts


Description

negLLzero computes the negative log-likelihood based on the unconditional marginal distribution of N (equation 12 in DuMouchel 1999, except taking negative natural log). This function is minimized to estimate the hyperparameters of the prior distribution. Use this function if including zero counts but not squashing data. Generally this function is not recommended (negLLsquash is typically more efficient).

Usage

negLLzero(theta, N, E)

Arguments

theta

A numeric vector of hyperparameters ordered as: α_1, β_1, α_2, β_2, P.

N

A whole number vector of actual counts from processRaw.

E

A numeric vector of expected counts from processRaw.

Details

The marginal distribution of the counts, N, is a mixture of two negative binomial distributions. The hyperparameters for the prior distribution (mixture of gammas) are estimated by optimizing the likelihood equation from this marginal distribution.

The hyperparameters are:

  • α_1, β_1: Parameters of the first component of the marginal distribution of the counts (also the prior distribution)

  • α_2, β_2: Parameters of the second component

  • P: Mixture fraction

This function will not need to be called directly if using exploreHypers or autoHyper.

Value

A scalar negative log-likelihood value.

Warnings

Make sure N actually contains zeroes before using this function. You should have used the zeroes = TRUE option when calling the processRaw function.

Make sure the data were not squashed before using this function.

References

DuMouchel W (1999). "Bayesian Data Mining in Large Frequency Tables, With an Application to the FDA Spontaneous Reporting System." The American Statistician, 53(3), 177-190.

See Also

nlm, nlminb, and optim for optimization

Other negative log-likelihood functions: negLLsquash(), negLLzeroSquash(), negLL()


openEBGM

EBGM Disproportionality Scores for Adverse Event Data Mining

v0.8.3
GPL-2 | GPL-3
Authors
John Ihrie [cre, aut], Travis Canida [aut], Ismaïl Ahmed [ctb] (author of 'PhViD' package (derived code)), Antoine Poncet [ctb] (author of 'PhViD'), Sergio Venturini [ctb] (author of 'mederrRank' package (derived code)), Jessica Myers [ctb] (author of 'mederrRank')
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.