Skip to contents

Creates an S3 object before fitting. Configuration, fitted results, and posterior samples remain ordinary R data. RTMB objectives are cached only within the current session. Explicit inputs are recommended for custom stocks; model identifies a bundled parameter configuration when needed.

Usage

opal_obj(
  data,
  parameters = NULL,
  map = NULL,
  random = character(),
  bounds = NULL,
  control = NULL,
  model = NULL,
  makeadfun_args = list(),
  metadata = list()
)

Arguments

data

Named model data list.

parameters

Named initial parameter list, or NULL for bundled defaults.

map

RTMB map. NULL resolves defaults; list() explicitly frees all parameters.

random

Names of random-effect parameters.

bounds

A data frame with lower and upper columns, or a list of numeric lower and upper vectors in active RTMB parameter order. Use NULL to derive bounds with get_bounds().

control

Optimiser controls.

model

Optional bundled configuration name for get_parameters().

makeadfun_args

Additional portable arguments for RTMB::MakeADFun().

metadata

Named user metadata.

Value

An opal_obj. Construction never optimises or samples.

Details

Use one object throughout the workflow: construct, optionally build, fit, sample, report, and save. summary() reports the lifecycle stage separately from fit and MCMC checks. Results live in $fit, $mcmc, $validation, and $derived; labels live in $provenance$metadata. Use opal_update() to change configuration rather than assigning directly to scientific fields.

Examples

inputs <- opaka_quickstart_inputs()
x <- opal_obj(inputs$data, inputs$parameters, inputs$map)
summary(x)
#> <opal_obj> configured
#> Active parameters: NA 
#> Fit check: not run  | MCMC check: not run