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

if2_parameter(
  name,
  initial,
  min = -Inf,
  max = Inf,
  discrete,
  integer = FALSE,
  prior = NULL
)

Arguments

name

Name for the parameter (a string)

initial

Initial value of the 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 integer. If TRUE then the parameter will be rounded after a new parameter is proposed.

prior

A prior function (if not given an improper flat prior is used - be careful!). It must be a function that takes a single argument, being the value of this parameter. If given, then prior(initial) must evaluate to a finite value.

Examples

mcstate::if2_parameter("a", 0.1)
#> $name
#> [1] "a"
#> 
#> $initial
#> [1] 0.1
#> 
#> $min
#> [1] -Inf
#> 
#> $max
#> [1] Inf
#> 
#> $integer
#> [1] FALSE
#> 
#> $prior
#> function (p) 
#> 0
#> <bytecode: 0x12e14ea00>
#> <environment: 0x12d7a63f0>
#> 
#> attr(,"class")
#> [1] "if2_parameter"