Generate and propagate Monte Carlo Simulations based on a template input file.
Source:R/fct_combine_mcs_E.R
fct_combine_mcs_E.Rd
TBD
Arguments
- .ad
Activity Data input table for the shiny app (AD_lu_transitions)
- .cs
Carbon Stock input table for the shiny app (c_stocks)
- .usr
User inputs' table for the shiny app (user_inputs). Contains the number of iterations of the MCS, carbon fraction if needed and if truncated PDFs should be used when necessary.
Value
A list of dataframes with Monte Carlo simulations for input variables, REDD+ activities CO2 emissions and removals and emission reductions levels.
Examples
library(readxl)
library(dplyr)
library(mocaredd)
cs <- read_xlsx(
system.file("extdata/example1.xlsx", package = "mocaredd"),
sheet = "c_stocks",
na = "NA"
)
ad <- read_xlsx(
system.file("extdata/example1.xlsx", package = "mocaredd"),
sheet = "AD_lu_transitions",
na = "NA"
)
usr <- read_xlsx(
system.file("extdata/example1.xlsx", package = "mocaredd"),
sheet = "user_inputs",
na = "NA"
)
cs_clean <- cs |> filter(!is.na(c_value) | !is.na(c_pdf_a))
res <- fct_combine_mcs_E(.ad = ad, .cs = cs_clean, .usr = usr)
#> Random simulations with seed: 93
hist(res$E_sim)
round(median(res$E_sim))
#> [1] 75830