Input: reanalysis/serie_auditada.csv  (n = 35, 1991-2025); break dates 1994-2023; B = 1999; procs = 4

======================================================================================
D0. Reproduction of the fixed-2020 NB2 model set
======================================================================================
  [ok] NB2 AICc single_mean (2020 fixed, k=2): 290.7735 (reference 290.77)
  [ok] NB2 AICc two_means (2020 fixed, k=3): 268.3595 (reference 268.36)
  [ok] NB2 AICc trend (2020 fixed, k=3): 234.0422 (reference 234.04)
  [ok] NB2 AICc trend_shift (2020 fixed, k=4): 231.8916 (reference 231.89)
  [ok] NB2 AICc segmented (2020 fixed, k=5): 234.3487 (reference 234.35)
  [ok] NB2 AICc stock_shift (2020 fixed, k=4): 235.2625 (reference 235.26)
  [ok] NB2 AICc unbounded (2020 fixed, k=4): 271.5552 (reference 271.56)
  [ok] NB2 AICc bounded (2020 fixed, k=5): 275.6791 (reference 275.68)
  [ok] NB2 AICc trend_stock (2020 fixed, k=5): 237.8426 (reference 237.84)
  [ok] NB2 AICc trend_plateau (2020 fixed, k=5): 233.6943 (reference 233.69)
  [ok] NB2 AICc trend_bounded_Kfree (2020 fixed, k=6): 233.7281 (reference 233.73)

======================================================================================
D2. Break date tau profiled over 1994-2023 (date counted, k + 1)
======================================================================================
  two_means: max |AICc_date - 06_break_scan_nb.csv| over 30 dates = 4.75e-05
  trend_shift: max |AICc_date - 06_break_scan_nb.csv| over 30 dates = 4.74e-05
              model  k_date  best_tau  AICc_best_tau_date  AICc_2020_date  dAICc_2020_vs_best  rank_of_2020                                                                    tau_set_dAICc_le2  RR_shift_best_tau  dAICc_best_tau_vs_nested
          two_means       4      2005              262.27          270.92                8.64            17                                                                       2004 2005 2008               6.04                    -28.50
        trend_shift       5      2020              234.63          234.63                0.00             1                                                                  2019 2020 2021 2022               1.57                      0.59
          segmented       6      2022              235.82          237.28                1.46             3                                                                       2015 2020 2022               1.98                      1.77
        stock_shift       5      2020              238.00          238.00                0.00             1                                                                            2019 2020               1.69                     -0.62
          unbounded       5      2003              240.17          274.29               34.12            27                                                                            2003 2004                NaN                    -50.61
            bounded       6      2003              242.01          278.61               36.60            27                                                                            2003 2004                NaN                    -48.76
        trend_stock       6      2019              240.77          240.77                0.00             2 1998 1999 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023                NaN                       NaN
      trend_plateau       6      2020              236.63          236.63                0.00             1                                                                  2019 2020 2021 2022                NaN                       NaN
trend_bounded_Kfree       7      2020              236.88          236.88                0.00             1                                                                       2019 2020 2021                NaN                       NaN
  [ok] trend_shift best tau: 2020.00 (reference 2020)
  [ok] trend_shift AICc at 2020, date counted (k=5): 234.6272 (reference 234.63)
  [ok] two_means best tau: 2005.00 (reference 2005)
  [ok] two_means AICc at best tau, date counted: 262.2740 (reference 262.27)
  [ok] two_means AICc at 2020, date counted: 270.9186 (reference 270.92)

======================================================================================
D1. The 8 NB2 models with the 2020 date counted as a parameter
======================================================================================
      model  logLik_2020  k_fixed  AICc_fixed  dAICc_fixed  weight_fixed  rank_fixed uses_2020_date  k_date  AICc_date  dAICc_date  weight_date  rank_date  best_tau  AICc_best_tau_date  dAICc_best_tau_date  weight_best_tau_date  rank_best_tau_date
      trend     -113.634        3     234.042        2.151         0.188           2             no       3    234.042       0.000        0.480          1       NaN             234.042                0.000                 0.423                   1
trend_shift     -111.279        4     231.892        0.000         0.550           1            yes       5    234.627       0.585        0.358          2  2020.000             234.627                0.585                 0.316                   2
  segmented     -111.140        5     234.349        2.457         0.161           3            yes       6    237.280       3.238        0.095          3  2022.000             235.816                1.774                 0.174                   3
stock_shift     -112.965        4     235.262        3.371         0.102           4            yes       5    237.998       3.956        0.066          4  2020.000             237.998                3.956                 0.059                   4
  two_means     -130.793        3     268.359       36.468         0.000           5            yes       4    270.919      36.876        0.000          5  2005.000             262.274               28.232                 0.000                   7
  unbounded     -131.111        4     271.555       39.664         0.000           6            yes       5    274.291      40.249        0.000          6  2003.000             240.166                6.124                 0.020                   5
    bounded     -131.805        5     275.679       43.787         0.000           7            yes       6    278.610      44.568        0.000          7  2003.000             242.013                7.971                 0.008                   6
single_mean     -143.199        2     290.774       58.882         0.000           8             no       2    290.774      56.731        0.000          8       NaN             290.774               56.731                 0.000                   8
  [ok] Akaike weight trend_shift, 8-model set, 2020 fixed: 0.5497 (reference 0.55)

======================================================================================
D3. Authors' Gaussian Table 4 (constant-free AICc) with the date counted
======================================================================================
  [ok] Gaussian Table 4 AICc single_mean: 219.9255 (reference 219.93)
  [ok] Gaussian Table 4 AICc two_means: 170.9823 (reference 170.98)
  [ok] Gaussian Table 4 AICc unbounded: 185.9163 (reference 185.92)
  [ok] Gaussian Table 4 AICc bounded: 174.6377 (reference 174.64)
                             model  tau      SSE  RMSE  k_fixed  AICc_fixed uses_2020_date  k_date  AICc_date  rank_fixed  rank_date
                       single_mean 2020 16546.57 21.74     2.00      219.93             no       2     219.93        4.00       5.00
                         two_means 2020  3816.19 10.44     3.00      170.98            yes       4     173.54        1.00       1.00
                         unbounded 2020  5434.79 12.46     4.00      185.92            yes       5     188.65        3.00       4.00
                           bounded 2020  3641.57 10.20     5.00      174.64            yes       6     177.57        2.00       3.00
two_means, best tau (date counted) 2020  3816.19 10.44      NaN         NaN      estimated       4     173.54         NaN       1.00
unbounded, best tau (date counted) 2003  3996.89 10.69      NaN         NaN      estimated       5     177.90         NaN        NaN
  bounded, best tau (date counted) 2019  3266.15  9.66      NaN         NaN      estimated       6     173.76         NaN        NaN
    single_mean: 
    two_means: mean_pre=12.9; mean_post=63.5
    unbounded: a=12.9; g=0.166; w2020=1
    bounded: a=13.59; g=0.4019; w2020=0.75; K=719
    two_means, best tau (date counted): mean_pre=12.9; mean_post=63.5; dAICc<=2 dates 2020
    unbounded, best tau (date counted): a=4.923; g=0.1616; w2020=0; dAICc<=2 dates 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
    bounded, best tau (date counted): a=12.86; g=0.3714; w2020=0.49; K=751; dAICc<=2 dates 2003 2004 2019

  Full Gaussian likelihood (constant included), 2020 boundary:
      model  logLik  k_fixed  AICc_fixed uses_2020_date  k_date  AICc_date  dAICc_date
single_mean -157.44        2      319.25             no       2     319.25       62.44
  two_means -131.77        3      270.31            yes       4     272.87       16.05
      trend -128.01        3      262.78             no       3     262.78        5.97
trend_shift -122.37        4      254.08            yes       5     256.81        0.00
  segmented -121.58        5      255.23            yes       6     258.16        1.34
stock_shift -124.87        4      259.07            yes       5     261.80        4.99
  unbounded -137.95        4      285.24            yes       5     287.98       31.16
    bounded -130.95        5      273.96            yes       6     276.89       20.08
  [ok] full Gaussian AICc trend_shift, 2020 fixed: 254.0780 (reference 254.08)
  [ok] full Gaussian AICc trend: 262.7843 (reference 262.78)

======================================================================================
D4. Observed / expected after a split year tau (NB2 trend fitted on 1991..tau-1)
======================================================================================
  tau=2018: trend 8.30%/yr on 1991-2017; 2018-2025 O/E = 436/324.1 = 1.35 (0.91-2.03); E 95% 214.4-481.3; PI 200-505; P(pred>=obs)=0.0945 | 2021-2025: O/E 1.47 (0.96-2.29) | peak 2023: O/E 2.07 (1.36-3.21)
  tau=2019: trend 8.01%/yr on 1991-2018; 2019-2025 O/E = 413/278.7 = 1.48 (1.03-2.13); E 95% 194.2-402.0; PI 179-425; P(pred>=obs)=0.0345 | 2021-2025: O/E 1.55 (1.06-2.26) | peak 2023: O/E 2.19 (1.49-3.18)
  tau=2020: trend 8.02%/yr on 1991-2019; 2020-2025 O/E = 381/247.9 = 1.54 (1.11-2.15); E 95% 177.2-342.1; PI 163-367; P(pred>=obs)=0.0180 | 2021-2025: O/E 1.55 (1.12-2.18) | peak 2023: O/E 2.18 (1.58-3.07)
  tau=2021: trend 8.45%/yr on 1991-2020; 2021-2025 O/E = 332/232.5 = 1.43 (1.08-1.97); E 95% 168.4-308.6; PI 153-343; P(pred>=obs)=0.0375 | 2021-2025: O/E 1.43 (1.08-1.97) | peak 2023: O/E 2.01 (1.52-2.77)
  tau=2022: trend 8.68%/yr on 1991-2021; 2022-2025 O/E = 283/201.5 = 1.40 (1.07-1.86); E 95% 152.5-265.6; PI 132-301; P(pred>=obs)=0.0445 | 2022-2025: O/E 1.40 (1.07-1.86) | peak 2023: O/E 1.93 (1.48-2.53)
split_year  2018  2019  2020  2021  2022
year                                    
2018        0.76   NaN   NaN   NaN   NaN
2019        0.98  1.02   NaN   NaN   NaN
2020        1.39  1.45  1.45   NaN   NaN
2021        1.28  1.35  1.34  1.25   NaN
2022        1.81  1.91  1.90  1.76  1.69
2023        2.07  2.19  2.18  2.01  1.93
2024        1.30  1.37  1.37  1.26  1.20
2025        0.99  1.05  1.05  0.96  0.91
  [ok] O/E tau=2020: observed total: 381.00 (reference 381)
  [ok] O/E tau=2020: expected total: 247.9426 (reference 247.94)
  [ok] O/E tau=2020: O/E: 1.5366 (reference 1.54)
  [ok] O/E tau=2020: expected 2.5%: 177.216 (reference 177.2)
  [ok] O/E tau=2020: expected 97.5%: 342.129 (reference 342.1)
  [ok] O/E tau=2020: O/E lower: 1.1136 (reference 1.11)
  [ok] O/E tau=2020: O/E upper: 2.1499 (reference 2.15)
  [ok] O/E tau=2020: P(pred total >= observed): 0.01800 (reference 0.018)
  [ok] O/E 2022 (tau=2020): 1.9027 (reference 1.9)
  [ok] O/E 2023 (tau=2020): 2.1842 (reference 2.18)
  [ok] O/E 2025 (tau=2020): 1.0468 (reference 1.05)

======================================================================================
D5. Fixed-date LR tests (2020, 2021) and sup-LR with the date estimated
======================================================================================
     date     LR  p_chi2  p_bootstrap    B  crit95_bootstrap     RR  RR_profile_lo  RR_profile_hi  growth_pct  AICc_trend_shift_fixed  AICc_trend_shift_date_counted  AICc_trend                                                                note
     2020 4.7098  0.0300       0.0460 1999            4.4847 1.5702         1.0504         2.3152      7.9083                231.8916                       234.6272    234.0422                                 date chosen after seeing the series
     2021 3.3071  0.0690       0.0915 1999            4.2901 1.4611         0.9678         2.2012      8.3647                233.2943                       236.0299    234.0422             documented start of the institutional support programme
1994-2023 4.7098     NaN       0.4545 1999           10.1988    NaN            NaN            NaN         NaN                     NaN                            NaN    234.0422 argmax date 2020; parametric bootstrap under the NB2 trend-only fit
2015-2023 4.7098     NaN       0.2360 1999            8.4124    NaN            NaN            NaN         NaN                     NaN                            NaN    234.0422 argmax date 2020; parametric bootstrap under the NB2 trend-only fit
2018-2022 4.7098     NaN       0.1440 1999            7.1032    NaN            NaN            NaN         NaN                     NaN                            NaN    234.0422 argmax date 2020; parametric bootstrap under the NB2 trend-only fit
    2020: Fixed 2020 level shift on a common trend: LR trend+shift vs trend
    2021: Fixed 2021 level shift on a common trend: LR trend+shift vs trend
    1994-2023: sup-LR, one level shift on a common trend, all admissible dates (sup-LR, Andrews)
    2015-2023: sup-LR, one level shift on a common trend, dates restricted to 2015-2023
    2018-2022: sup-LR, one level shift on a common trend, dates restricted to 2018-2022
  [ok] LR trend_shift vs trend at 2020: 4.7098 (reference 4.71)
  [ok] chi2 p at 2020: 0.02999 (reference 0.03)
  [ok] bootstrap p at 2020: 0.04600 (reference 0.046)
  [ok] RR 2020: 1.5702 (reference 1.57)
  [ok] RR 2020 profile lower: 1.0504 (reference 1.05)
  [ok] RR 2020 profile upper: 2.3152 (reference 2.32)
  [ok] sup-LR bootstrap p (1994-2023): 0.454500 (reference 0.4545)
  [ok] sup-LR 95% critical value: 10.1988 (reference 10.2)

======================================================================================
D6. Akaike weights, 8-model and 8 + 3 sets, 2020 fixed vs date counted
======================================================================================
              model           set uses_2020_date  k_fixed  AICc_fixed  k_date  AICc_2020_date  best_tau  AICc_best_tau_date  w8_fixed  w8_2020_date  w8_best_tau_date  w11_fixed  w11_2020_date  w11_best_tau_date
        single_mean        main 8             no        2     290.774       2         290.774       NaN             290.774     0.000         0.000             0.000      0.000          0.000              0.000
          two_means        main 8            yes        3     268.359       4         270.919  2005.000             262.274     0.000         0.000             0.000      0.000          0.000              0.000
              trend        main 8             no        3     234.042       3         234.042       NaN             234.042     0.188         0.480             0.423      0.128          0.380              0.343
        trend_shift        main 8            yes        4     231.892       5         234.627  2020.000             234.627     0.550         0.358             0.316      0.374          0.283              0.256
          segmented        main 8            yes        5     234.349       6         237.280  2022.000             235.816     0.161         0.095             0.174      0.109          0.075              0.141
        stock_shift        main 8            yes        4     235.262       5         237.998  2020.000             237.998     0.102         0.066             0.059      0.069          0.053              0.047
          unbounded        main 8            yes        4     271.555       5         274.291  2003.000             240.166     0.000         0.000             0.020      0.000          0.000              0.016
            bounded        main 8            yes        5     275.679       6         278.610  2003.000             242.013     0.000         0.000             0.008      0.000          0.000              0.006
        trend_stock supplementary            yes        5     237.843       6         240.774  2019.000             240.769       NaN           NaN               NaN      0.019          0.013              0.012
      trend_plateau supplementary            yes        5     233.694       6         236.625  2020.000             236.625       NaN           NaN               NaN      0.152          0.104              0.094
trend_bounded_Kfree supplementary            yes        6     233.728       7         236.876  2020.000             236.876       NaN           NaN               NaN      0.149          0.092              0.083
  [ok] Akaike weight trend_shift, 8-model set, 2020 fixed: 0.5497 (reference 0.55)
  [ok] Akaike weight trend_shift, 8 + 3 set, 2020 fixed: 0.37376 (reference 0.374)
  summed weight of models with a departure from the trend (11-model set): fixed 0.872; 2020_date 0.620; best_tau_date 0.634 | trend only: fixed 0.128; 2020_date 0.380; best_tau_date 0.343

======================================================================================
Reproduction checks
======================================================================================
  46 of 46 reproduced to the stated decimals

Done in 264 s. Outputs in build/reanalysis/fecha_2020
