Skip to contents

Set the bounds, fixed flag, prior distribution, or starting value of a single model parameter. Pass the result to the parameters argument of any model_*() constructor.

Usage

model_parameter(
  parameter,
  value = NULL,
  lower = NULL,
  upper = NULL,
  fixed = NULL,
  prior = NULL
)

Arguments

parameter

the parameter to constrain, as a name ("scale") or a 1-based position. In a model carrying trends the parameter vector is wider than the distribution's, so a position is required there.

value

optional starting value. A parameter_values vector on the model wins over this.

lower, upper

optional bounds used by the estimators and samplers.

fixed

logical; hold the parameter at its value instead of estimating it.

prior

optional distribution() object used as the parameter's prior.

Value

An object of class corehydro_model_parameter.

Details

Supplying a prior replaces the model's default. Do that together with use_default_flat_priors = FALSE on the model, so a later data assignment cannot overwrite what you set.

Examples

model_parameter("scale", lower = 0.5, upper = 40)
#> <corehydro_model_parameter> scale: lower = 0.5, upper = 40
model_parameter("mean", prior = distribution("Normal", c(15000, 4000)))
#> <corehydro_model_parameter> mean: prior = Normal