vfac: Create a model component object for a variance factor...

View source: R/mc_vfac.R

vfacR Documentation

Create a model component object for a variance factor component in the variance function of a gaussian sampling distribution

Description

This function is intended to be used on the right hand side of the formula.V argument to create_sampler or generate_data.

Usage

vfac(
  factor = "local_",
  prior = pr_invchisq(df = 1, scale = 1),
  name = "",
  debug = FALSE
)

Arguments

factor

The name of a factor variable. The name "local_" has a special meaning, and assigns a different variance scale parameter to each data unit. In case of inverse chi-squared priors this implies that the marginal sampling distribution is a t distribution. In case of exponential priors the marginal sampling distribution is a Laplace or double exponential distribution.

prior

the prior assigned to the variance factors. Currently the prior can be inverse chi-squared or exponential, specified by a call to pr_invchisq or pr_exp, respectively. The default priors are inverse chi-squared with 1 degree of freedom. See the help pages of the prior specification functions for details on how to set non-default priors.

name

The name of the variance model component. This name is used in the output of the MCMC simulation function MCMCsim. By default the name will be 'vfac' with the number of the variance model term attached.

debug

If TRUE a breakpoint is set at the beginning of the posterior draw function associated with this model component. Mainly intended for developers.

Value

An object with precomputed quantities and functions for sampling from prior or conditional posterior distributions for this model component. Intended for internal use by other package functions.


mcmcsae documentation built on Oct. 11, 2023, 1:06 a.m.