Skip to contents

Assemble and consolidate in memory the complete structured input list required for sensitivity analysis (model_npv and analyze_uncertainty) for a given project.

Usage

prepare_sa(
  case,
  project,
  reference = getOption("floodam.cba")[["reference"]],
  rate = case["rate"],
  n = getOption("floodam.cba")[["n_uncertainty"]]
)

Arguments

case

An object of class Case.

project

Character scalar, name of the evaluated project.

reference

Character scalar, name of the reference baseline project (defaults to getOption("floodam.cba")[["reference"]]).

rate

Discount rate specification (defaults to case["rate"]).

n

Integer scalar, default Monte Carlo sample size for uncertainty/Sobol analysis (defaults to getOption("floodam.cba")[["n_uncertainty"]]).

Value

A named list containing elements calendar, cost, flood, impact, case, project, reference, rate, and n.

Details

The function coordinates the extraction and preparation of all required components by calling:

  • prepare_sa_calendar(): normalized annual schedules for benefits and costs.

  • prepare_sa_cost(): nominal investment and maintenance cost parameters along with their uncertainty ranges.

  • prepare_sa_flood(): flood hazard parameters, including return periods and hydraulic efficiency bounds.

  • prepare_sa_impact(): nominal avoided damages per flood event and per stake paired with stake uncertainty distributions.

It bundles these elements together with project-level metadata: case (case name from case["name"]), project, reference, discount rate, and default sample size n.

Note on cost calculations: currently, costs for the reference project (reference) are assumed to be zero; costs are not yet calculated as a differential between project and reference.

Author

Frédéric Grelot, frederic.grelot.1994_cran@m4x.org

Examples

case = import_case(
    system.file("extdata", "case", "complete.ods", package = "floodam.cba")
)
#> import Case from /tmp/RtmpvMoJJK/temp_libpath2b69f6f14b9e9/floodam.cba/extdata/case/complete.ods
#>  ... done
project = setdiff(unique(case["project"][["project"]]), "baseline")[1]
sa_input = prepare_sa(case, project)
names(sa_input)
#> [1] "calendar"  "cost"      "flood"     "impact"    "case"      "project"  
#> [7] "reference" "rate"      "n"