Learn R Programming

EMC2 (version 2.0.2)

get_prior_blocked: Prior specification or prior sampling for blocked estimation

Description

Works analogous to get_prior_standard. Blocks of the covariance matrix to estimate are only considered in sampling. To get the default prior for a created design: get_prior_diag(design = design, sample = FALSE)

Usage

get_prior_blocked(
  prior = NULL,
  n_pars = NULL,
  sample = TRUE,
  N = 1e+05,
  selection = "mu",
  design = NULL,
  par_groups = NULL
)

Value

A list with a single entry of type of samples from the prior (if sample = TRUE) or else a prior object

Arguments

prior

A named list that can contain the prior mean (theta_mu_mean) and variance (theta_mu_var) on the group-level mean, or the scale (A), or degrees of freedom (v) for the group-level variance-covariance matrix. For NULL entries, a default prior gets created.

n_pars

Often inferred from the design, but if design = NULL, n_pars will be used to determine the size of prior.

sample

Boolean, defaults to TRUE, sample from the prior or simply return the prior specifications?

N

How many samples to draw from the prior, the default is 1e5

selection

Character. If sample = TRUE, what prior to sample from. Options: "mu", "sigma2", "covariance" "Sigma", "alpha", "correlation".

design

The design obtained from design(), required when map = TRUE

par_groups

Integer vector indicating which parts of the covariance matrix should be blocked together

Details

For details see Huang, A., & Wand, M. P. (2013). Simple marginally noninformative prior distributions for covariance matrices. Bayesian Analysis, 8, 439-452. https://doi.org/10.1214/13-BA815.

Note that if sample = FALSE, prior$theta_mu_invar (the inverse of the prior covariance matrix on the group-level mean) is returned, which is only used for computational efficiency

Examples

Run this code
# First define a design for the model
design_DDMaE <- design(data = forstmann,model=DDM,
                           formula =list(v~0+S,a~E, t0~1, s~1, Z~1, sv~1, SZ~1),
                           constants=c(s=log(1)))
# Now get the default prior
prior <- get_prior_blocked(design = design_DDMaE, sample = FALSE)
# We can change values in the default prior or use `prior`
# Then we can get samples from this prior e.g.
samples <- get_prior_blocked(prior = prior, design = design_DDMaE,
  sample = TRUE, selection = "mu")

Run the code above in your browser using DataLab