DS.macro.inf {BayesGOF}R Documentation

Execute MacroInference (mean or mode) on a DS object

Description

A function that generates macro-estimates with their uncertainty (standard error).

Usage

DS.macro.inf(DS.GF.obj, num.modes = 1, 
             method = c("mean", "mode"), 
             iters = 25, exposure = NULL)

Arguments

DS.GF.obj

Object from DS.prior.

num.modes

The number of modes indicated by DS.prior object.

method

Returns mean or mode(s) (based on user choice) along with the associated standard error(s).

iters

Integer value of total number of iterations.

exposure

In the case where DS.GF.obj is from a Poisson family with exposure, exposure is the vector of exposures. Otherwise, the default is NULL.

Value

DS.GF.macro.obj

Object of class DS.GF.macro associated with either mean or mode.

model.modes

For method = "mode", returns mode(s) of estimated DS prior.

mode.sd

For method = "mode", provides the bootstrapped standard error for each mode.

boot.modes

For method = "mode", returns all generated mode(s).

model.mean

For method = "mean", returns mean of estimated DS prior.

mean.sd

For method = "mean", provides the bootstrapped standard error for the mean.

boot.mean

For method = "mean", returns all generated means.

prior.fit

Fitted values of estimated prior imported from the DS.prior object.

Author(s)

Doug Fletcher, Subhadeep Mukhopadhyay

References

Mukhopadhyay, S. and Fletcher, D., 2018. "Generalized Empirical Bayes via Frequentist Goodness of Fit," Nature Scientific Reports, 8(1), p.9983, https://www.nature.com/articles/s41598-018-28130-5.

Examples

## Not run: 
### MacroInference: Mode
data(rat)
rat.start <- gMLE.bb(rat$y, rat$n)$estimate
rat.ds <- DS.prior(rat, max.m = 4, rat.start. family = "Binomial")
rat.ds.macro <- DS.macro.inf(rat.ds, num.modes = 2, method = "mode", iters = 5)
rat.ds.macro
plot(rat.ds.macro)
### MacroInference: Mean
data(ulcer)
ulcer.start <- gMLE.nn(ulcer$y, ulcer$se)$estimate
ulcer.ds <- DS.prior(ulcer, max.m = 4, ulcer.start)
ulcer.ds.macro <- DS.macro.inf(ulcer.ds, num.modes = 1, method = "mean", iters = 5)
ulcer.ds.macro
plot(ulcer.ds.macro)
## End(Not run)

[Package BayesGOF version 5.2 Index]