smc2_parameter: Describe single pmcmc parameter

View source: R/smc2_parameters.R

smc2_parameterR Documentation

Describe single pmcmc parameter

Description

Describe a single parameter for use within the SMC^2. Note that the name is not set here, but will end up being naturally defined when used with smc2_parameters, which collects these together for use with smc2().

Usage

smc2_parameter(
  name,
  sample,
  prior,
  min = -Inf,
  max = Inf,
  discrete,
  integer = FALSE
)

Arguments

name

Name for the parameter (a string)

sample

A sampling function; it must take a single argument representing the number of sampled to be returned. Typically this will be a r probability function corresponding to the sampling version of your prior (e.g., you might use runif and dunif for sample and prior). If you provide min, max or integer you must ensure that your function returns values that satisfy these constraints, as this is not (yet) checked.

prior

A prior function. It must be a function that takes a single argument, being the value of this parameter.

min

Optional minimum value for the parameter (otherwise -Inf). If given, then initial must be at least this value.

max

Optional max value for the parameter (otherwise Inf). If given, then initial must be at most this value.

discrete

Deprecated; use integer instead.

integer

Logical, indicating if this parameter is an integer. If TRUE then the parameter will be rounded after a new parameter is proposed.

Examples

mcstate::smc2_parameter("a",
                        function(n) rnorm(n),
                        function(x) dnorm(n, log = TRUE))

mrc-ide/mcstate documentation built on July 3, 2024, 1:34 p.m.