dic.fit.mcmc: Fits the distribution to the passed-in data using MCMC as...

Description Usage Arguments Details Value

View source: R/dic.fit.mcmc.R

Description

Similar to dic.fit but uses MCMC instead of a direct likelihood optimization routine to fit the model. Currently, four distributions are supported: log-normal, gamma, Weibull, and Erlang. See Details for prior specification.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
dic.fit.mcmc(
  dat,
  prior.par1 = NULL,
  prior.par2 = NULL,
  init.pars = c(1, 1),
  ptiles = c(0.05, 0.95, 0.99),
  verbose = 1000,
  burnin = 3000,
  n.samples = 5000,
  dist = "L",
  seed = NULL,
  ...
)

Arguments

dat

the data

prior.par1

vector of first prior parameters for each model parameter. If NULL then default parameters are used (as described in Details section).

prior.par2

vector of second prior parameters for each model parameter. If NULL then default parameters are used (as described in Details section).

init.pars

the initial parameter values (vector length = 2 )

ptiles

returned percentiles of the survival survival distribution

verbose

how often do you want a print out from MCMCpack on iteration number and M-H acceptance rate

burnin

number of burnin samples

n.samples

number of samples to draw from the posterior (after the burnin)

dist

distribution to be used (L for log-normal,W for weibull, G for Gamma, and E for erlang, off1G for 1 day right shifted gamma)

seed

seed for the random number generator for MCMC

...

additional parameters to MCMCmetrop1R

Details

The following models are used:

Log-normal model: f(x) = \frac{1}{x*σ √{2 * π}} exp\{-\frac{(\log x - μ)^2}{2 * σ^2}\}

Log-normal Default Prior: μ ~ N(0, 1000), log(σ) ~ N(0,1000)

Weibull model: f(x) = \frac{α}{β}(\frac{x}{β})^{α-1} exp\{-(\frac{x}{β})^{α}\}

Weibull Default Prior Specification: log(α) ~ N( 0, 1000), β ~ Gamma(0.001,0.001)

Gamma model: f(x) = \frac{1}{θ^k Γ(k)} x^{k-1} exp\{-\frac{x}{θ}\}

Gamma Default Prior Specification: p(k,θ) \propto \frac{1}{θ} * √{k*TriGamma(k)-1}

(Note: this is Jeffery's Prior when both parameters are unknown), and

Trigamma(x) = \frac{\partial}{\partial x^2} ln(Γ(x))

.)

Erlang model: f(x) = \frac{1}{θ^k (k-1)!} x^{k-1} exp\{-\frac{x}{θ}\}

Erlang Default Prior Specification: k \sim NBinom(100,1), log(θ) \sim N(0,1000)

(Note: parameters in the negative binomial distribution above represent mean and size, respectively)

Value

a cd.fit.mcmc S4 object


coarseDataTools documentation built on Dec. 11, 2021, 9:29 a.m.