This function simulates sample paths from the prior over effect functions implied by a fitted fash object. The prior is treated as a finite mixture over predictive standard deviation (PSD) values stored in fash_obj$prior_weights. Each sample path is drawn from an integrated Wiener process (IWP) prior plus a global polynomial trend.

simulate_fash_prior(
  fash_obj,
  M = 100,
  constraints = c("none", "initial", "orthogonal"),
  x_range = NULL,
  x_new = NULL
)

Arguments

fash_obj

A fitted fash object containing:

  • prior_weights: a data frame with columns psd and prior_weight;

  • settings: a list with elements num_basis, order, pred_step, betaprec.

M

Integer; total number of prior samples to draw.

constraints

Character; one of: "none", "initial", "orthogonal".

x_range

Optional numeric vector of length 2 defining the simulation domain. If missing, inferred from the data.

x_new

Optional numeric vector giving evaluation points for the samples.

Value

A list containing:

samples

A matrix of size length(x_new) × M; each column is a sampled function.

x_new

Evaluation grid.

psd

Length-M vector giving the PSD used for each sample.

component

Length-M vector giving mixture component index used.

prior_weights

Original prior weights.

settings

Settings used in the simulation.

Details

The function provides optional constraints on the global polynomial component:

  • "none": use the polynomial variance from the fitted model (default)

  • "initial": force the polynomial part to be identically zero (equivalent to letting betaprec = Inf)

  • "orthogonal": regress out the polynomial trend from each sample so that the resulting sample path is orthogonal to all global polynomial basis functions