Skip to contents

Generate joint ensemble design for parameter sampling Creates a joint ensemble design that maintains parameter correlations across all sites in a multi-site run. This function generates sample indices that are shared across sites to ensure consistent parameter sampling.

Usage

generate_joint_ensemble_design(settings, ensemble_size, sobol = FALSE)

Arguments

settings

PEcAn settings object. This function directly uses:

  • settings$outdir - Output directory path for samples.Rdata

  • settings$pfts - List of PFTs (extracts posterior.files)

  • settings$ensemble$samplingspace - Input sampling configuration

  • settings$run$inputs - Input paths for each input type

When samples.Rdata doesn't exist, settings is passed to get.parameter.samples which additionally requires:

  • settings$ensemble - Ensemble configuration

  • settings$database$bety - Database connection (optional)

  • settings$host$name - Host name for dbfile.check (optional)

ensemble_size

Integer specifying the number of ensemble members. The input_design is generated once for the entire model run. You might want to recycle existing ensemble_samples when splitting larger runs into smaller jobs while keeping the same parameters.

sobol

Logical. If TRUE, returns a sensitivity::soboljansen object for Sobol sensitivity analysis.

Value

A list containing ensemble samples and indices. If sobol = FALSE, returns list(X = design_matrix). If sobol = TRUE, returns a sensitivity::soboljansen() result object with the design matrix in $X plus additional components for Sobol index calculations.

Details

Note on internal dependencies

If samples.Rdata doesn't exist we call get.parameter.samples(), which loads parameter distributions.

In practice it: - uses pft$posterior.files directly when it is defined (an Rdata file with post.distns or prior.distns), - otherwise figures out an output directory from pft$outdir or, if needed, via pft$posteriorid in the database, - then looks in that directory for post.distns.Rdata, falling back to prior.distns.Rdata, - and, for MCMC posteriors, looks up trait.mcmc*.Rdata linked to the same posteriorid or a trait.mcmc.Rdata file in that directory.

Difference from generate_OAT_SA_design: This function samples inputs randomly or quasi-randomly, while generate_OAT_SA_design holds all non-parameter inputs constant to isolate parameter effects.