Learn R Programming

bayestransmission (version 0.1.0)

Param: Construct a parameter with a prior, weight and an update flag.

Description

Construct a parameter with a prior, weight and an update flag.

Usage

Param(
  init,
  weight = if_else(init == 0, 0, 1),
  update = weight > 0,
  prior = init
)

Value

A list with the following elements:

  • init the initial value of the parameter.

  • weight the weight of the prior.

  • update a flag indicating if the parameter shouldbe updated in the MCMC.

  • prior mean value of the prior distribution, may be used with weight to fully determine prior parameters.

Arguments

init

the initial value of the parameter.

weight

the weight of the prior.

update

a flag indicating if the parameter shouldbe updated in the MCMC.

prior

mean value of the prior distribution, may be used with weight to fully determine prior parameters.

Examples

Run this code
# Fully specified parameter.
Param(init = 0, weight = 1, update = TRUE, prior = 0.5)
# Fixed parameter
# Weight = 0 implies update=FALSE and prior is ignored.
Param(0, 0)
# Update parameter that starts at zero.
Param(0, weight =1, update=TRUE)
# Parameters specified at zero implies fixed.
Param(0)

Run the code above in your browser using DataLab