Skip to contents

Run sensitivity analysis on finished model runs

Usage

run.sensitivity.analysis(
  settings,
  plot = TRUE,
  ensemble.id = NULL,
  variable = NULL,
  start.year = NULL,
  end.year = NULL,
  pfts = NULL,
  ...
)

Arguments

settings

a PEcAn settings object

plot

logical. Option to generate sensitivity analysis and variance decomposition plots (plot = TRUE) or to turn these plots off (plot = FALSE).

ensemble.id

ensemble ID

variable

which variable(s) to do sensitivity analysis for. Defaults to all specified in settings

start.year

defaults to what is specified in settings

end.year

defaults to what is specified in settings

pfts

a vector of PFT names found in settings to run sensitivity analysis on

...

currently unused

Value

Nothing (called for side effects). Saves sensitivity.results as sensitivity.results.*.Rdata and optional PDF plots.

Details

Upstream contract (reads from settings$outdir):

samples.Rdata

Produced by get.parameter.samples. Loaded to obtain trait.samples, trait.names, pft.names, and sa.run.ids.

sensitivity.samples.<id>.Rdata

Produced by run.write.configs. If present, overrides sa.run.ids and sa.samples from samples.Rdata.

sensitivity.output.<var>.<years>.<id>.Rdata

Produced by get.results. Contains sensitivity.output: a named list (PFT -> matrix) of model outputs for each SA run.

File-based side effects (saved to settings$outdir):

sensitivity.results.<var>.<years>.<id>.Rdata

Contains sensitivity.results: a named list (PFT -> list) with elements sensitivity.output (partial derivatives) and variance.decomposition.output (elasticities and partial variances).

sensitivityanalysis.<pft>.<var>.<years>.<id>.pdf

Sensitivity analysis diagnostic plots (one per PFT). Generated when plot = TRUE.

variance.decomposition.<pft>.<var>.<years>.<id>.pdf

Variance decomposition "popsicle" plots (one per PFT). Generated when plot = TRUE.

Note: This is a terminal step in the workflow — nothing downstream loads sensitivity.results.*.Rdata programmatically. The results are consumed by visualization or user inspection.

Author

David LeBauer, Shawn Serbin, Ryan Kelly

Examples

if (FALSE) { # \dontrun{
library(PEcAn.settings)
library(PEcAn.uncertainty)
settings <- read.settings("path/to/pecan.xml")
run.sensitivity.analysis(settings)
} # }