Learn R Programming

EMC2 (version 2.0.2)

get_prior_single: Prior specification or prior sampling for single subject estimation

Description

With this type of estimation, one or multiple subjects are estimated independently, without any hierarchical constraint.

Usage

get_prior_single(
  prior = NULL,
  n_pars = NULL,
  sample = TRUE,
  N = 1e+05,
  selection = "alpha",
  design = NULL,
  map = FALSE
)

Value

A list with a single entry named "alpha" and samples from the prior (if sample = TRUE) or else a prior object

Arguments

prior

A named list containing the prior mean (theta_mu_mean) and variance (theta_mu_var). If NULL, the default prior is used.

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: "alpha".

design

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

map

Boolean, defaults to TRUE. If sample = TRUE, the implied prior is sampled. This includes back-transformations for naturally bounded parameters such as the non-decision time and an inverse mapping from the design matrix back to the cells of the design. If FALSE, the transformed, unmapped, parameters are used. Note that map does not affect the prior used in the sampling process.

Details

To specify a (multivariate normal) prior, prior$theta_mu_mean and prior$theta_mu_var an entry is needed for each parameter.

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_single(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_single(prior = prior, design = design_DDMaE,
  sample = TRUE, selection = "alpha")

Run the code above in your browser using DataLab