Construct parameters for use with smc2(). This creates a utility object that is used internally to work with parameters. Most users only need to construct this object, but see the examples for how it can be used.

Methods


Method new()

Create the smc2_parameters object

Usage

smc2_parameters$new(parameters, transform = NULL)

Arguments

parameters

A list of smc2_parameter objects, each of which describe a single parameter in your model. If parameters is named, then these names must match the $name element of each parameter is used (this is verified).

transform

An optional transformation function to apply to your parameter vector immediately before passing it to the model function. If not given, then as.list is used, as dust models require this. However, if t you need to generate derived parameters from those being actively sampled you can do arbitrary transformations here.


Method sample()

Create n independent random parameter vectors (as a matrix with n rows)

Usage

smc2_parameters$sample(n)

Arguments

n

Number of replicate parameter sets to draw


Method names()

Return the names of the parameters

Usage

smc2_parameters$names()


Method summary()

Return a data.frame with information about parameters (name, min, max, and integer).

Usage

smc2_parameters$summary()


Method prior()

Compute the prior for a parameter vector

Usage

smc2_parameters$prior(theta)

Arguments

theta

a parameter vector in the same order as your parameters were defined in (see $names() for that order.


Method propose()

Propose a new parameter vector given a current parameter vector and variance covariance matrix. After proposal, this rounds any integer values, and reflects bounded parameters until they lie within min:max.

Usage

smc2_parameters$propose(theta, vcv)

Arguments

theta

a parameter vector in the same order as your parameters were defined in (see $names() for that order).

vcv

the variance covariance matrix for the proposal; must be square and have a number of rows and columns equal to the number of parameters, in the same order as theta.


Method model()

Apply the model transformation function to a parameter vector.

Usage

smc2_parameters$model(theta)

Arguments

theta

a parameter vector in the same order as your parameters were defined in (see $names() for that order.