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

par <- list(
  # Paths. --------------------------------------------------------------------------
  # Current STATPOP release.
  in_pop  = "data/statpop_2022.rdata",
  # Current rent registry extract.
  in_rr   = "data/supercube.csv",
  # Current BFS population scenario.
  in_scen = "data/scenario.rdata",
  # 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/mpen_VA26001.csv",
  # Current inflation projections.
  in_inf  = "data/disc_VA26001.csv",
  # Historic old-age pension expenses.
  in_ahv  = "data/ahv_data.csv",
  # Current ZAS Abschlussrechnung.
  in_zas  = "data/sv_ahv_fin.xlsx",
  # Data for Liechtenstein model calculations.
  in_lim  = "data/hist_mort_rent.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  = 2023:2040,
  # 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,
      2023,   "f",       64,
      2023,   "m",       65),
  # Conduct CV to fix parameters.
  cv = FALSE,
  # Starting year for historic old-age pension database used during CV.
  sj = 1997,
  # Admissible value range for number of trend estimation points during CV.
  pr = list("tr" = 4:8, "tot" = 4:8),
  # Pooling function within k-step error estimates.
  err = function(pred, obs) abs(pred / obs - 1),
  # 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(  73, -140, -428, -690, -927, -844, -712, -592, -471, -371, -300,
               -270, -200, -150, -110, - 70, -40 , -40 , -20 , -50 , -70 , -70 ,
               -80 , -70 , -80 , -110, -130, -150, -200, -230, -260, -280, -290,
               -280, -270, -400, -410, -400, -390, -400, -410, -570, -570, -580,
               -690, -700, -710) 
      ),
  # Save output.
  write = FALSE,
  # Return results in console.
  show  = TRUE,
  # Calculate confidence bands.
  pband = TRUE,
  # Simulate Student-t draws and store for resampling.
  sim   = TRUE,
  # Visualize confidencebands.
  band_plot = TRUE
)
