###########################
# SET BASELINE PARAMETERS #
###########################

par <- list(
  # Paths. --------------------------------------------------------------------------
  # Current STATPOP release.
  in_pop  = "~/data/appl-wb/01_raw_data/allgemein/go/BEVOELKERUNG/espop.rdata",
  # Current rent registry extract.
  in_rr   = "~/data/appl-wb/01_raw_data/ahv/go/supercube_15042025.csv",
  # Current BFS population scenario.
  in_scen = "~/data/appl-wb/02_data_container_TEST/allgemein/go/BEV_SCENARIO.csv",
  # Widow pension projections from complementary model (source: Thomas Borek 
  # @BSV, departement mathematics).
  in_wid  = "data/proj_hila_go.csv",
  # Current minimal pension projections.
  in_mp   = "~/data/appl-wb/14_basismodell/24042025/data/mpen_VA26003.csv",
  # Current inflation projections.
  in_inf  = "~/data/appl-wb/14_basismodell/24042025/data/eckwerte_VA26003.csv",
  # Current ZAS Abschlussrechnung.
  in_zas  = "~/data/appl-wb/01_raw_data/allgemein/go/sv_ahv_fin.xlsx",
  # Data for Liechtenstein model calculations.
  in_lim  = "~/data/appl-wb/01_raw_data/ahv/go/hist_mort_rent_15042025.csv",
  
  # Parameters. ---------------------------------------------------------------------
  # Respect 13th AHV pension payment from 2026 onwards.
  ahv13 = TRUE,
  # Include exogenous AHV21 cost vector derived from Delfin.
  ahv21 = TRUE,
  # Deflate results.
  real  = FALSE,
  # Use exogenous widow projections due to time series break in 2023.
  wid   = TRUE,
  # Return aggregate results.
  agg   = TRUE,
  # Projection interval *including* the current year.
  pint  = 2024:2050,
  # Reference ages in multiples of years by sex, starting from GO in current year (first
  # element in parameter 'pint'). Beyond the current year, only dates where changes occur 
  # must be provided.
  reftab =
    tribble(
      ~ year, ~ sex, ~ refage,
      2024,   "f",       64,
      2024,   "m",       65),
  # Conduct CV to fix parameters.
  cv = FALSE,
  # Admissible value range for number of trend estimation points during CV.
  pr = list("tr" = 4:6, "tot" = 4:6),
  # Pooling function within k-step error estimates.
  err = function(pred, obs) abs(pred - obs),
  # Pooling function across pooled k-step error estimates.
  glo = function(x) mean(x),
  # Length out-of-sample prediction horizon during CV.
  out = 10,
  # Cost differentials due to AHV21 (exogenous Delfin projection).
  ahv21_cost =
    tibble(
      year = 2024:2070,
      cost = 1e6 *
        c(0, -239, -523, -793, -1039, -968, -848, -739, -632, -548, -481, -475, -400, 
             -369, -328, -305,  -290, -303, -288, -329, -350, -363, -380, -379, -394, 
             -430, -447, -475,  -537, -577, -614, -641, -658, -663, -657, -777, -786, 
             -785, -763, -775,  -790, -933, -932, -950, -1745, -1791, -1799) 
      ),
  # Save output.
  write = TRUE,
  # Return results in console.
  show  = TRUE,
  # Calculate confidence bands.
  pband = TRUE,
  # Simulate Student-t draws and store for resampling.
  sim   = FALSE,
  # Visualize confidencebands.
  band_plot = TRUE
)
