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().

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

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))
#> $name #> [1] "a" #> #>$sample
#> function(n) rnorm(n)
#> <environment: 0x139e14da0>
#>
#> $prior #> function(x) dnorm(n, log = TRUE) #> <environment: 0x139e14da0> #> #>$min
#> [1] -Inf
#>
#> $max #> [1] Inf #> #>$integer
#> [1] FALSE
#>
#> attr(,"class")
#> [1] "smc2_parameter"