mcmc | R Documentation |
Markov chain Monte Carlo (MCMC) inference for the g-and-k or g-and-h distribution
mcmc(
x,
N,
model = c("gk", "generalised_gh", "tukey_gh", "gh"),
logB = FALSE,
get_log_prior = improper_uniform_log_density,
theta0,
Sigma0,
t0 = 100,
epsilon = 1e-06,
silent = FALSE,
plotEvery = 100
)
x |
Vector of observations. |
N |
Number of MCMC steps to perform. |
model |
Which model to check: "gk", "generalised_gh" or "tukey_gh". For backwards compatibility, "gh" acts the same as "generalised_gh". |
logB |
When true, the second parameter is log(B) rather than B. |
get_log_prior |
A function with one argument (corresponding to a vector of 4 parameters e.g. A,B,g,k) returning the log prior density. This should ensure the parameters are valid - i.e. return -Inf for invalid parameters - as the |
theta0 |
Vector of initial value for 4 parameters. |
Sigma0 |
MCMC proposal covariance matrix |
t0 |
Tuning parameter (number of initial iterations without adaptation). |
epsilon |
Tuning parameter (weight given to identity matrix in covariance calculation). |
silent |
When |
plotEvery |
How often to plot the results if |
mcmc
performs Markov chain Monte Carlo inference for iid data from a g-and-k or g-and-h distribution, using the adaptive Metropolis algorithm of Haario et al (2001).
Matrix whose rows are MCMC states: the initial state theta0
and N subsequent states.
D. Prangle gk: An R package for the g-and-k and generalised g-and-h distributions, 2017. H. Haario, E. Saksman, and J. Tamminen. An adaptive Metropolis algorithm. Bernoulli, 2001.
set.seed(1)
x = rgk(10, A=3, B=1, g=2, k=0.5) ##An unusually small dataset for fast execution of this example
out = mcmc(x, N=1000, theta0=c(mean(x),sd(x),0,0), Sigma0=0.1*diag(4))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.