DS.sampler {BayesGOF}R Documentation

Samples data from DS(G,m) distribution.

Description

Generates samples of size k from DS(G,m) prior distribution.

Usage

DS.sampler(k, g.par, LP.par, con.prior, LP.type, B)

DS.sampler.post(k, g.par, LP.par, y.0, n.0, 
                con.prior, LP.type, B)

Arguments

k

Total number of samples requested.

g.par

Estimated parameters for specified conjugate prior distribution (i.e beta prior: α and β; normal prior: μ and τ^2; gamma prior: α and β).

LP.par

LP coefficients for DS prior.

con.prior

The distribution type of conjugate prior g; either "Beta", "Normal", or "Gamma".

LP.type

The type of LP means, either "L2" or "MaxEnt".

y.0

Depending on g, y_0 is either (i) the sample mean ("Normal"), (ii) the number of successes ("Beta"), or (iii) the specific count value ("Gamma") for desired posterior distribution(DS.sampler.post only).

n.0

Depending on g, n_0 is either (i) the sample standard error ("Normal"), or (ii) the total number of trials in the sample ("Beta"). Not used for "Gamma". (DS.sampler.post only).

B

The number of grid points, default is 250.

Details

DS.sampler.post uses the same type of sampling as DS.sampler to generate random values from a DS posterior distribution.

Value

Vector of length k containing sampled values from DS prior or DS posterior.

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.

Mukhopadhyay, S., 2017. "Large-Scale Mode Identification and Data-Driven Sciences," Electronic Journal of Statistics, 11(1), pp.215-240.

Examples

##Extracted parameters from rat.ds object
rat.g.par <- c(2.3, 14.1)
rat.LP.par <- c(0, 0, -0.5)
samps.prior <- DS.sampler(25, rat.g.par, rat.LP.par, con.prior = "Beta")
hist(samps.prior,15)
##Posterior for rat data
samps.post <- DS.sampler.post(25, rat.g.par, rat.LP.par, 
							y.0 = 4, n.0 = 14, con.prior = "Beta")
hist(samps.post, 15)

[Package BayesGOF version 5.2 Index]