prepare_optim_layout: Prepare optimization layout for a model

View source: R/prepare_optim_layout.R

prepare_optim_layoutR Documentation

Prepare optimization layout for a model

Description

Build a bookkeeping structure that maps a flat optimization vector (theta, in real/unconstrained space) to per-component parameter blocks. This is used throughout the package to:

  • Define a consistent parameter order for optimization.

  • Provide an initial parameter vector (theta0) in real space.

  • Record which subset of theta belongs to each component model.

Usage

prepare_optim_layout(model)

Arguments

model

A time_series_model or sum_model.

Details

The function handles two cases:

  • time_series_model: returns a single block of parameters.

  • sum_model: concatenates all component blocks and records their indices.

Value

A list with:

  • kind: "single" or "sum" depending on the model class.

  • theta0: named numeric vector of initial parameters in real space.

  • pnames: (single model) parameter names for the block.

  • layout: (sum model) list of per-component layouts, each containing: i (component index), idx (indices into theta0), and pnames (parameter names for that component).


gmwmx2 documentation built on June 10, 2026, 5:06 p.m.