Skip to contents

MCMC Algorithm to estimate the parameters in the regression model for multivariate correlated count data

Usage

mcmc_cmp(
  y,
  X,
  S = 10000,
  nburn = 5000,
  initial_beta,
  initial_gamma,
  initial_b,
  prior_mean_beta,
  prior_var_beta,
  prior_mean_gamma,
  prior_var_gamma,
  v_0,
  R_0,
  intercept = FALSE,
  scale_b,
  scale_beta,
  scale_gamma,
  scale_cov_b,
  scale_cov_beta,
  scale_cov_gamma,
  inc_burn = FALSE,
  re_chain = TRUE,
  progress = "acc_rates",
  way = 2,
  random_seed,
  ...
)

Arguments

y

Matrix of observations

X

Covariates list, each element is the design matrix for each column of y

S

Number of MCMC samples to be drawn

nburn

Number of MCMC samples to burn-in

initial_beta

List with initial value of \(beta\) for each response

initial_gamma

List with initial value of \(gamma\) for each response

initial_b

Initital value of \(b\).

prior_mean_beta

Prior mean for \(beta\). (Default zero vector)

prior_var_beta

Prior covariance matrix for \(beta\) (Default \(I\))

prior_mean_gamma

Prior mean for \(beta\). (Default zero vector)

prior_var_gamma

Prior covariance matrix for \(gamma\) (Default \(I\))

v_0

Prior degrees of freedom of random effects

R_0

Prior covariance matrix of random effects

intercept

Logical value indicating whether include the intercept

scale_b

Covariance matrix for RW proposals of the random effects (Default \(I\))

scale_beta

List with initial values for the scale matrices of \(beta\) (Default \(I\))

scale_gamma

List with initial values for the scale matrices of \(gamma\) (Default \(I\))

scale_cov_b

Scale parameter for the RW of random effects. (Default \(2.4/sqrt(2)\))

scale_cov_beta

Scale parameter for the covariance of the proposals.

scale_cov_gamma

Scale parameter for the covariance of the proposals.

inc_burn

logical: include burned samples in the return

re_chain

logical: If the posterior samples for the r.e are include. False return just the mean

progress

output of algorithm: "acc_rates" update each 10 interactions the acceptance ratios, "bar" show a bar of progress

way

How to calculate the MCMC updates, based on Chib (2001)

random_seed

Random seed

...

Additional parameters of the MCMC algorithm

Value

A list:

posterior_b

List with posterior values of the random effects

estimation_beta

Estimation of beta parameters

posterior_beta

List with posterior values of beta

estimation_gamma

Estimation of gamma parameters

posterior_gamma

List with posterior values of gamma

posterior_D

Values of covariance matrix D

fitted_mu

Posterior of location parameters for each response

fitted_nu

Posterior of shape parameters for ecah response

accept_rate_b

Acceptance rate of Random Effects

accept_rate_beta

Acceptance rate of beta

accept_rate_gamma

Acceptance rate of gamma

scale_beta

Estimated Scale matrix for beta parameters

scale_gamma

Estimated Scale matrix for gamma parameters

X

List of covariates used

y

Matrix of observed counts

Examples

if (FALSE) {
  n = 50; J = 2
  X = list(matrix(rnorm(3*n), ncol = 3), matrix(rnorm(3*n), ncol = 3))
  beta <- list(c(1,0.1, 1), c(0, 0.5, -0.5))
  mu <- exp(prod_list(X, beta))
  y = matrix(rpois(n = length(mu), lambda = mu), nrow = n)
  fit <- mcmc_cmp(y, X, S = 10000, nburn = 1000, scale_cov_b = 0.8,
  scale_cov_beta = 0.04, scale_cov_gamma = 0.06)
}