R/mcmc_RCMVN.R
mcmc_RCMVN.RdThis function fits a Bayesian RaCE-NMA model to data from a previous network meta-analysis. The function has input parameters to permit drawing multiple MCMC chains, as well as chain thinning and burn-in.
mcmc_RCMVN(
posterior = NULL,
ybar = NULL,
cov = NULL,
s = NULL,
mu0 = NULL,
sigma0 = NULL,
tau = NULL,
nu0 = NULL,
num_iters = 5000,
nu_reps = 3,
chains = 2,
burn_prop = 0.5,
thin = 1,
seed = NULL,
suppressPrint = FALSE
)A matrix of posterior draws of relative intervention effects based on a previous NMA. The (i,j) is the ith draw of the effect of intervention j.
A vector of estimated average relative intervention effects based on a previous NMA. The jth entry is the effect of intervention j. Ignored if posterior is supplied.
A variance covariance matrix of relative intervention effects based on a previous NMA. The (i,j) entry is the covariane between intervention i and j's effects. Ignored if posterior is supplied.
A vector of the estimated standard deviations of each intervention. The jth entry is the standard deviation of intervention j. Ignored if posterior is supplied.
The hyperparameter mu0. If NULL, set to mean(ybar).
The hyperparameter sigma_0. If NULL, set to sqrt(10*var(ybar)) which aims to be minimally informative.
The standard deviation of the Metropolis Hastings proposal distribution. If NULL, set to min(|ybar_i-ybar_j|).
A numeric vector for the initialization of worth parameters, mu, in the MCMC algorithm. Default to NULL, indicating random initialization.
A numeric indicating the total number of outer MCMC iterations (i.e., the number of times the partition is updated in the Gibbs sampler).
A numeric indicating the number of times each worth parameter is drawn per update of the parameter partition. There will be a total of num_itersxnu_reps samples from the posterior.
A numeric indicating the total number of independent MCMC chains to be run.
A numeric between 0 and 1 indicating the proportion of MCMC samples in each chain to be removed as burn-in.
A numeric indicating that only every thin-th sample should be retained, to save computational memory.
A numeric indicating the random seed that should be set before running the first MCMC chain.
A boolean indicating if the function should not print progress updates as the MCMC chains run.
A (chainsxnum_iters/thin)x(3J+3) matrix of posterior draws, one row per posterior sample of mu, nu, and g, with additional columns indicating the MCMC chain index, iteration index, and number of non-empty partition clusters K of each posterior sample.
chains <- mcmc_RCMVN(ybar=c(0,0,1,1), s=c(.1,.1,.1,.1), mu0=0.5, sigma0=5, tau=0.5,chains=2,seed=1)
#> [1] "Estimating chain 1 of 2."
#> [1] "Estimating chain 2 of 2."
head(chains)
#> chain iteration K mu1 mu2 mu3 mu4 nu1
#> 1 1 7501 2 0.008489937 0.008489937 1.0064411 1.0064411 0.008489937
#> 2 1 7502 2 0.089044520 0.089044520 0.9580729 0.9580729 0.089044520
#> 3 1 7503 2 0.060069313 0.060069313 0.9937041 0.9937041 0.060069313
#> 4 1 7504 2 -0.048153176 -0.048153176 1.0910088 1.0910088 -0.048153176
#> 5 1 7505 2 -0.067422714 -0.067422714 1.1132127 1.1132127 -0.067422714
#> 6 1 7506 2 -0.014061548 -0.014061548 0.8629449 0.8629449 -0.014061548
#> nu2 nu3 nu4 G1 G2 G3 G4
#> 1 1.0064411 NA NA 1 1 2 2
#> 2 0.9580729 NA NA 1 1 2 2
#> 3 0.9937041 NA NA 1 1 2 2
#> 4 1.0910088 NA NA 1 1 2 2
#> 5 1.1132127 NA NA 1 1 2 2
#> 6 0.8629449 NA NA 1 1 2 2