Learn R Programming

mederrRank (version 0.1.0)

mixnegbinom.em: Expectation-Maximization Algorithm for the Mixture of Negative Binomial Distributions

Description

This function provides the empirical Bayes estimates for the parameters theta of a mixture of two negative binomial distributions (see dmixnegbinom) using an Expectation-Maximization algorithm.

Usage

mixnegbinom.em(dat, theta0, maxiter = 50000, toler = 0.01,
	se = TRUE, stratified = FALSE)

Value

mixnegbinom.em returns a list with components:

theta.hat

The best set of parameters found.

final.err

The last change in the log-likelihood; it has to be smaller than the toler argument.

final.ll

The likelihood value corresponding to theta.hat.

final.score

The log-likelihood score value corresponding to theta.hat.

num.iter

The number of iterations performed to find the proposed solution.

se

Only if argument se is true. A vector of estimates standard errors for the solution found.

N

The vector of observed error profiles counts.

E

The vector of expected error profiles counts.

prior

A character string giving the prior used; for this function is set to "mixgamma", i.e. a mixture of two gamma distributions as in DuMouchel (1999).

Arguments

dat

an object of class "mederrData".

theta0

initial values for the parameters to be optimized over.

maxiter

a positive integer specifying the maximum number of iterations to be performed before the program is terminated.

toler

a positive scalar giving the tolerance at which the change in the log-likelihood is considered close enough to zero to terminate the algorithm.

se

logical; if TRUE the standard errors of the estimates are also returned.

stratified

logical; if TRUE the analysis will be performed by stratifying on the hospitals.

Author

Sergio Venturini sergio.venturini@unicatt.it,

Jessica A. Myers jmyers6@partners.org

Details

For further details see Myers et al. (2011).

References

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

Myers, J. A., Venturini, S., Dominici, F. and Morlock, L. (2011), "Random Effects Models for Identifying the Most Harmful Medication Errors in a Large, Voluntary Reporting Database". Technical Report.

See Also

dmixnegbinom, EBGM, negbinom.em.

Examples

Run this code
if (FALSE) {
data("simdata", package = "mederrRank")
summary(simdata)

fit <- bhm.mcmc(simdata, nsim = 1000, burnin = 500, scale.factor = 1.1)
resamp <- bhm.resample(fit, simdata, p.resample = .1,
	k = c(3, 6, 10, 30, 60, Inf), eta = c(.5, .8, 1, 1.25, 2))
fit2 <- bhm.constr.resamp(fit, resamp, k = 3, eta = .8)
plot(fit, fit2, simdata)

theta0 <- c(10, 6, 100, 100, .1)
ans <- mixnegbinom.em(simdata, theta0, 50000, 0.01,
	se = TRUE, stratified = TRUE)
ans$theta
ans$se

summary(fit2, ans, simdata)}

Run the code above in your browser using DataLab