Learn R Programming

SDGLM (version 0.4.0)

sca_mcmc: Scalable MCMC for Dynamic GLMs

Description

Implements Algorithm 1 of the reference paper with three mutation-rate strategies (ScaI/II/III) and three move types (mutation/crossover/exchange).

Usage

sca_mcmc(
  y,
  X,
  family = c("poisson", "pareto", "gamma"),
  method = c("ScaI", "ScaII", "ScaIII"),
  N_chain = 6L,
  iter = 10000L,
  burn = NULL,
  thin = 1L,
  T_max = 10,
  beta_init = NULL,
  verbose = TRUE
)

Value

List with components:

beta_chain

3-D array (iter/thin x p x N_chain) of posterior samples.

family

Character, distribution family used.

method

Character, mutation-rate strategy used.

Arguments

y

Numeric response vector (length n).

X

n x p design matrix.

family

Character: "poisson", "pareto", or "gamma".

method

Character: "ScaI", "ScaII", or "ScaIII".

N_chain

Integer >= 2, number of parallel chains.

iter

Integer, total MCMC iterations per chain.

burn

Integer, burn-in length (default = iter/2).

thin

Integer, thinning interval (default = 1).

T_max

Numeric > 1, hottest temperature (default = 10).

beta_init

Optional matrix (N_chain x p) of initial coefficients. If NULL, random starts are generated.

verbose

Logical, print progress bar (default = TRUE).

Examples

Run this code
set.seed(1)
X <- matrix(rnorm(200 * 3), 200, 3)
beta <- c(0.5, -0.2, 0.1)
y <- rgamma(200, shape = 2, rate = exp(X %*% beta))
fit <- sca_mcmc(y, X, family = "gamma", method = "ScaII",
                N_chain = 6, iter = 1000, burn = 500)

Run the code above in your browser using DataLab