Learn R Programming

BayesGOF (version 4.0)

DS.sampler: 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: \(\alpha\) and \(\beta\); normal prior: \(\mu\) and \(\tau^2\); gamma prior: \(\alpha\) and \(\beta\)).

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.

Value

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

Details

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

References

Mukhopadhyay, S. and Fletcher, D., 2018. "Bayesian Modeling via Goodness-of-Fit," Technical report, https://arxiv.org/abs/1802.00474 .

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

Examples

Run this code
# NOT RUN {
##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)
# }

Run the code above in your browser using DataLab