Matrix whose rows are MCMC states: the initial state theta0 and N subsequent states.
Arguments
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 mcmc code will not check this.
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 FALSE (the default) a progress bar and intermediate results plots are shown.
plotEvery
How often to plot the results if silent==FALSE.
Details
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).
References
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 exampleout = mcmc(x, N=1000, theta0=c(mean(x),sd(x),0,0), Sigma0=0.1*diag(4))