Description Usage Arguments Details Value References See Also
The samplePosteriorDist
function samples the parameters of a given theoretical distribution using explicit posterior distribution (if it exists), or a Markov Chain Monte Carlo (MCMC) algorithm when the posterior distribution is unknown. See details to know on what kind of S4 objects this function could be applied.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | samplePosteriorDist(object, K, ...)
## S4 method for signature 'fitNormalDist'
samplePosteriorDist(object, K, n)
## S4 method for signature 'fitLogNormalDist'
samplePosteriorDist(object, K, n)
## S4 method for signature 'fitGammaDist'
samplePosteriorDist(object, K, do.pb, seed)
## S4 method for signature 'fitStudentDist'
samplePosteriorDist(object, K, do.pb, seed)
## S4 method for signature 'fitLogisticDist'
samplePosteriorDist(object, K, do.pb, seed)
|
object |
A distribution object. |
K |
A numerical value indicating the length of the sample. |
... |
other parameters passed to methods. |
n |
number of MCMC chains. |
do.pb |
Indicates whther progressing bar or not |
seed |
seed for the random number generator. Integer. |
This method can be applied to the S4 distribution objects that are supported in the optimalThreshold
package: fitNormalDist
, fitLogNormalDist
, fitGammaDist
, fitStudentDist
, and fitLogisticDist
. These methods are applied internally, and you have no need to use it outside of the main function optThresEst
. See below to have details on the expression of the samplePosteriorDist
function according to the type of distribution.
Normal distribution: a noninformative prior is used for the parameters of the normal distribution (mu
=μ, and sd
=σ). The σ^2 parameter is sampled from an inverse Chi-squared distribution, and the μ parameter is sampled from a normal distribution with known variance. So, sampling in the posterior distribution of μ and σ does not involve an MCMC algorithm (see References for more details and justification).
Log-normal distribution: a noninformative prior is used for the parameters of the log-normal distribution (mu
=μ, and sd
=σ). The σ^2 parameter is sampled from an inverse Chi-squared distribution, and the μ parameter is sampled from a normal distribution with known variance. So, sampling in the posterior distribution of μ and σ does not involve an MCMC algorithm (see References for more details and justification).
Gamma distribution: a noninformative prior is used for the parameters of the gamma distribution (shape
=α, and scale
=β). The parameters are sampled using an adaptive rejection sampling (ARS) algorithm. The β parameter is sampled at the first iteration from an inverse gamma distribution using the initial value of the α parameter provided by the user. Then the ARS algorithm is performed to sample α from its posterior distribution (see References for more details and justification).
Scaled t distribution: a vague prior is used for the parameters of the scaled t distribution as a default. However, the user can write its own JAGS model to use different priors (see the fit
function for more details). Sampling from the posterior distribution of the parameters of a scaled t distribution requires JAGS to be installed.
Logistic distribution: a vague prior is used for the parameters of the logistic distribution as a default. However, the user can write its own JAGS model to use different priors (see the fit
function for more details). Sampling from the posterior distribution of the parameters of a logistic distribution requires JAGS to be installed.
Returns an object of class list.
Gelman, A, et al. 2014. Bayesian Data Analysis. 3rd edition, CRC Press, Boca Raton, section 2.8. Sook, Y, and Oh, M. Bayesian estimation of the two-parameter Gamma distribution. Communications in Statistics - Simulation and Computation. 2006; 35: 285-293.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.