negbinom.em: Expectation-Maximization Algorithm for the Negative Binomial...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/mederrRank.R

Description

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

Usage

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

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 scaled gradient 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.

Details

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

Value

negbinom.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 "gamma", i.e. a gamma distribution.

Author(s)

Sergio Venturini sergio.venturini@unibocconi.it,

Jessica A. Myers jmyers6@partners.org

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

dnegbinom, EBGM, mixnegbinom.em.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
data("simdata", package = "mederrRank")
summary(simdata)

## Not run: 
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)

## End(Not run)

theta0 <- runif(2, 0, 5)
ans <- negbinom.em(simdata, theta0, 50000, 0.01,
	se = TRUE, stratified = TRUE)
ans$theta
ans$se

## Not run: 
summary(fit2, ans, simdata)

## End(Not run)

mederrRank documentation built on May 30, 2017, 2:55 a.m.