-------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/carlos/GitHub/starter-academic-v501/content/post/stata_pane
> l_lasso_cluster/analysis.log
  log type:  text
 opened on:   5 Apr 2026, 14:59:00

. 
. display _newline "============================================="

=============================================

. display "  TUTORIAL: Latent Group Structures in Panel Data"
  TUTORIAL: Latent Group Structures in Panel Data

. display "  Method:   Classifier-LASSO (Su, Shi, Phillips 2016)"
  Method:   Classifier-LASSO (Su, Shi, Phillips 2016)

. display "  Date:     $S_DATE $S_TIME"
  Date:      5 Apr 2026 14:59:00

. display "=============================================" _newline
=============================================


. 
. 
. // ═════════════════════════════════════════════════════════════════
. // SECTION 1: Load and Explore Savings Data
. // ═════════════════════════════════════════════════════════════════
. 
. display _newline "============================================="

=============================================

. display "  SECTION 1: Load and Explore Savings Data"
  SECTION 1: Load and Explore Savings Data

. display "=============================================" _newline
=============================================


. 
. use "refMaterials/saving.dta", clear

. 
. // Declare panel structure
. xtset code year

Panel variable: code (strongly balanced)
 Time variable: year, 1 to 15
         Delta: 1 unit

. 
. // Panel description
. xtdescribe

    code:  1, 2, ..., 56                                     n =         56
    year:  1, 2, ..., 15                                     T =         15
           Delta(year) = 1 unit
           Span(year)  = 15 periods
           (code*year uniquely identifies each observation)

Distribution of T_i:   min      5%     25%       50%       75%     95%     max
                        15      15      15        15        15      15      15

     Freq.  Percent    Cum. |  Pattern
 ---------------------------+-----------------
       56    100.00  100.00 |  111111111111111
 ---------------------------+-----------------
       56    100.00         |  XXXXXXXXXXXXXXX

. 
. // Summary statistics
. display _newline "--- Summary Statistics ---"

--- Summary Statistics ---

. summarize savings lagsavings cpi interest gdp

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
     savings |        840   -2.87e-08    1.000596  -2.495871   2.893858
  lagsavings |        840    5.81e-08    1.000596  -2.832278    2.91508
         cpi |        840    3.56e-09    1.000596  -2.773791   3.548945
    interest |        840   -7.17e-09    1.000596  -3.600348   3.277582
         gdp |        840    1.06e-08    1.000596  -3.554419   2.461317

. 
. display _newline "--- Detailed Statistics ---"

--- Detailed Statistics ---

. tabstat savings lagsavings cpi interest gdp, ///
>     statistics(mean sd min p25 p50 p75 max) columns(statistics)

    Variable |      Mean        SD       Min       p25       p50       p75
-------------+------------------------------------------------------------
     savings | -2.87e-08  1.000596 -2.495871 -.7514935 -.0297477  .7577041
  lagsavings |  5.81e-08  1.000596 -2.832278 -.7317027  -.032742    .78188
         cpi |  3.56e-09  1.000596 -2.773791 -.6642521  -.207814  .4838007
    interest | -7.17e-09  1.000596 -3.600348 -.6494734  .0063667   .652302
         gdp |  1.06e-08  1.000596 -3.554419 -.5641946  .1935035   .683866
--------------------------------------------------------------------------

    Variable |       Max
-------------+----------
     savings |  2.893858
  lagsavings |   2.91508
         cpi |  3.548945
    interest |  3.277582
         gdp |  2.461317
------------------------

. 
. // Count unique countries
. codebook code, compact

Variable   Obs Unique  Mean  Min  Max  Label
-------------------------------------------------------------------------------
code       840     56  28.5    1   56  code
-------------------------------------------------------------------------------

. quietly levelsof code

. local n_countries : word count `r(levels)'

. display "Number of countries: `n_countries'"
Number of countries: 56

. display "Time periods: " _N / `n_countries'
Time periods: 15

. 
. // ── Figure 1: Savings Heterogeneity Across Countries ──
. 
. // Overlay all countries on one panel
. xtline savings, overlay ///
>     title("Savings-to-GDP Ratio Across 56 Countries", size(medium)) ///
>     subtitle("Each line represents one country", size(small)) ///
>     ytitle("Savings / GDP") xtitle("Year") ///
>     note("Source: Su, Shi, Phillips (2016). 56 countries, 1995-2010.") ///
>     legend(off) ///
>     name(fig1_savings, replace)

. graph export "stata_panel_lasso_cluster_fig1_savings_scatter.png", ///
>     name(fig1_savings) replace width(2400)
file stata_panel_lasso_cluster_fig1_savings_scatter.png written in PNG format

. 
. display _newline "Figure 1 saved: stata_panel_lasso_cluster_fig1_savings_scat
> ter.png"

Figure 1 saved: stata_panel_lasso_cluster_fig1_savings_scatter.png

. 
. 
. // ═════════════════════════════════════════════════════════════════
. // SECTION 2: Baseline Pooled and FE Regressions
. // ═════════════════════════════════════════════════════════════════
. 
. display _newline "============================================="

=============================================

. display "  SECTION 2: Baseline Pooled and FE Regressions"
  SECTION 2: Baseline Pooled and FE Regressions

. display "=============================================" _newline
=============================================


. 
. display "These models assume ALL countries share the SAME slope coefficients.
> "
These models assume ALL countries share the SAME slope coefficients.

. display "C-LASSO will later reveal whether this assumption holds." _newline
C-LASSO will later reveal whether this assumption holds.


. 
. // 2.1 Pooled OLS
. display "--- 2.1 Pooled OLS ---"
--- 2.1 Pooled OLS ---

. regress savings lagsavings cpi interest gdp

      Source |       SS           df       MS      Number of obs   =       840
-------------+----------------------------------   F(4, 835)       =    162.95
       Model |  368.242785         4  92.0606961   Prob > F        =    0.0000
    Residual |  471.757214       835  .564978699   R-squared       =    0.4384
-------------+----------------------------------   Adj R-squared   =    0.4357
       Total |  839.999999       839  1.00119189   Root MSE        =    .75165

------------------------------------------------------------------------------
     savings | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
  lagsavings |   .6050842   .0263842    22.93   0.000     .5532971    .6568713
         cpi |   .0301213   .0267785     1.12   0.261    -.0224397    .0826823
    interest |   .0059256   .0269269     0.22   0.826    -.0469267    .0587779
         gdp |   .1882033   .0264346     7.12   0.000     .1363172    .2400894
       _cons |  -6.59e-08   .0259344    -0.00   1.000    -.0509044    .0509042
------------------------------------------------------------------------------

. estimates store pooled_ols

. 
. // 2.2 Standard Fixed Effects
. display _newline "--- 2.2 Standard Fixed Effects ---"

--- 2.2 Standard Fixed Effects ---

. xtreg savings lagsavings cpi interest gdp, fe

Fixed-effects (within) regression               Number of obs     =        840
Group variable: code                            Number of groups  =         56

R-squared:                                      Obs per group:
     Within  = 0.4384                                         min =         15
     Between = 0.1272                                         avg =       15.0
     Overall = 0.4384                                         max =         15

                                                F(4, 780)         =     152.21
corr(u_i, Xb) = -0.0000                         Prob > F          =     0.0000

------------------------------------------------------------------------------
     savings | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
  lagsavings |   .6050842   .0272985    22.17   0.000     .5514968    .6586715
         cpi |   .0301213   .0277065     1.09   0.277    -.0242668    .0845095
    interest |   .0059256     .02786     0.21   0.832    -.0487639    .0606151
         gdp |   .1882033   .0273507     6.88   0.000     .1345136     .241893
       _cons |  -6.59e-08   .0268332    -0.00   1.000    -.0526739    .0526738
-------------+----------------------------------------------------------------
     sigma_u |  2.764e-07
     sigma_e |  .77769978
         rho |  1.263e-13   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(55, 780) = 0.00                     Prob > F = 1.0000

. estimates store fe_standard

. 
. // 2.3 Robust Fixed Effects (reghdfe)
. display _newline "--- 2.3 Robust Fixed Effects (reghdfe) ---"

--- 2.3 Robust Fixed Effects (reghdfe) ---

. reghdfe savings lagsavings cpi interest gdp, absorb(code) vce(robust)
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =        840
Absorbing 1 HDFE group                            F(   4,    780) =     144.34
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.4384
                                                  Adj R-squared   =     0.3959
                                                  Within R-sq.    =     0.4384
                                                  Root MSE        =     0.7777

------------------------------------------------------------------------------
             |               Robust
     savings | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
  lagsavings |   .6050842   .0288472    20.98   0.000     .5484568    .6617116
         cpi |   .0301213   .0320726     0.94   0.348    -.0328375    .0930801
    interest |   .0059256   .0302145     0.20   0.845    -.0533858     .065237
         gdp |   .1882033    .033945     5.54   0.000      .121569    .2548376
       _cons |  -6.59e-08   .0268332    -0.00   1.000    -.0526739    .0526738
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        code |        56           0          56     |
-----------------------------------------------------+

. estimates store fe_robust

. 
. // Store key coefficients for later comparison
. estimates restore pooled_ols
(results pooled_ols are active now)

. local b_lag_pooled = _b[lagsavings]

. local b_cpi_pooled = _b[cpi]

. local b_int_pooled = _b[interest]

. local b_gdp_pooled = _b[gdp]

. 
. estimates restore fe_robust
(results fe_robust are active now)

. local b_lag_fe = _b[lagsavings]

. local b_cpi_fe = _b[cpi]

. local b_int_fe = _b[interest]

. local b_gdp_fe = _b[gdp]

. 
. display _newline "--- Coefficient Comparison: Pooled OLS vs FE ---"

--- Coefficient Comparison: Pooled OLS vs FE ---

. display "                 Pooled OLS     FE (robust)"
                 Pooled OLS     FE (robust)

. display "lagsavings       " %10.4f `b_lag_pooled' "     " %10.4f `b_lag_fe'
lagsavings           0.6051         0.6051

. display "cpi              " %10.4f `b_cpi_pooled' "     " %10.4f `b_cpi_fe'
cpi                  0.0301         0.0301

. display "interest         " %10.4f `b_int_pooled' "     " %10.4f `b_int_fe'
interest             0.0059         0.0059

. display "gdp              " %10.4f `b_gdp_pooled' "     " %10.4f `b_gdp_fe'
gdp                  0.1882         0.1882

. 
. 
. // ═════════════════════════════════════════════════════════════════
. // SECTION 3: Classifier-LASSO — Savings, Static Model
. // ═════════════════════════════════════════════════════════════════
. 
. display _newline "============================================="

=============================================

. display "  SECTION 3: C-LASSO — Savings, Static Model"
  SECTION 3: C-LASSO — Savings, Static Model

. display "=============================================" _newline
=============================================


. 
. display "We start with a STATIC specification (no lagged dependent variable)"
We start with a STATIC specification (no lagged dependent variable)

. display "to demonstrate the simplest usage of classifylasso." _newline
to demonstrate the simplest usage of classifylasso.


. display "The command searches over K = 1 to 5 groups and uses the information
> "
The command searches over K = 1 to 5 groups and uses the information

. display "criterion to select the optimal number of groups." _newline
criterion to select the optimal number of groups.


. display "NOTE: This may take several minutes to compute..." _newline
NOTE: This may take several minutes to compute...


. 
. // Static model: savings = f(cpi, interest, gdp) + country FE
. classifylasso savings cpi interest gdp, grouplist(1/5) tolerance(1e-4)
Estimation 1: Group Number = 1; Iteration: √
Information Criterion = .053747385
Estimation 2: Group Number = 2; Iteration: 1···5····10····15····20√
Information Criterion = -.02755819
Estimation 3: Group Number = 3; Iteration: 1···5····10····15····20√
Information Criterion = .058822014
Estimation 4: Group Number = 4; Iteration: 1···5····10····15····20√
Information Criterion = .131361535
Estimation 5: Group Number = 5; Iteration: 1···5····10····15····20√
Information Criterion = .212972443
* Selected Group Number: 2
The algorithm takes 4min50s.

Classifier-Lasso linear model                     Number of obs   =        840
Postestimation with 2 groups                      Number of units =         56

Fixed effect estimation with Group 1              R-squared       =     0.2019
Absorbing: code                                   Adj R-squared   =     0.1412
No. of obs   =    510                             Within R-sq.    =     0.2019
No. of units =     34                             Root MSE        =     0.9276
------------------------------------------------------------------------------
     savings | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
         cpi |  -.1813043   .0422854    -4.29   0.000    -.2641822   -.0984264
    interest |  -.1966381   .0424214    -4.64   0.000    -.2797825   -.1134937
         gdp |   .3345556   .0419159     7.98   0.000     .2524019    .4167093
       _cons |  -4.92e-08   .0410758    -0.00   1.000    -.0805072    .0805071
------------------------------------------------------------------------------
Fixed effect estimation with Group 2              R-squared       =     0.2369
Absorbing: code                                   Adj R-squared   =     0.1769
No. of obs   =    330                             Within R-sq.    =     0.2369
No. of units =     22                             Root MSE        =     0.9086
------------------------------------------------------------------------------
     savings | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
         cpi |   .4780886   .0525171     9.10   0.000     .3751569    .5810203
    interest |   .2631097    .052491     5.01   0.000     .1602292    .3659903
         gdp |   .1116502   .0500687     2.23   0.026     .0135174    .2097831
       _cons |  -4.92e-09   .0500195    -0.00   1.000    -.0980363    .0980363
------------------------------------------------------------------------------

. 
. // Store estimates
. estimates store classo_static

. 
. // Display selected group count
. display _newline "--- Static Model: Group Selection ---"

--- Static Model: Group Selection ---

. display "Selected number of groups: " e(group)
Selected number of groups: 2

. 
. // Postestimation: select the IC-optimal result
. classoselect, postselection

. 
. // Generate group membership predictions
. predict gid_static, gid

. predict yhat_static, xb

. 
. // Tabulate group membership
. display _newline "--- Group Membership (Static Model) ---"

--- Group Membership (Static Model) ---

. tabulate gid_static

      Group |
Classificat |
     ion by |
 Post_Lasso |      Freq.     Percent        Cum.
------------+-----------------------------------
         G1 |        510       60.71       60.71
         G2 |        330       39.29      100.00
------------+-----------------------------------
      Total |        840      100.00

. 
. // ── Figure 2: Group Selection (Static Model) ──
. classogroup, ///
>     title("Group Selection: Savings (Static Model)", size(medium)) ///
>     note("Information criterion selects optimal K from {1,...,5}") ///
>     name(fig2_selection, replace)

. graph export "stata_panel_lasso_cluster_fig2_group_selection_static.png", ///
>     name(fig2_selection) replace width(2400)
file stata_panel_lasso_cluster_fig2_group_selection_static.png written in PNG f
> ormat

. 
. display _newline "Figure 2 saved: stata_panel_lasso_cluster_fig2_group_select
> ion_static.png"

Figure 2 saved: stata_panel_lasso_cluster_fig2_group_selection_static.png

. 
. // Display coefficient estimates
. display _newline "--- Coefficient Estimates by Group (Static Model) ---"

--- Coefficient Estimates by Group (Static Model) ---

. estimates replay

-------------------------------------------------------------------------------
active results
-------------------------------------------------------------------------------
Classifier-Lasso linear model                     Number of obs   =        840
Postestimation with 2 groups                      Number of units =         56

Fixed effect estimation with Group 1              R-squared       =     0.2019
Absorbing: code                                   Adj R-squared   =     0.1412
No. of obs   =    510                             Within R-sq.    =     0.2019
No. of units =     34                             Root MSE        =     0.9276
------------------------------------------------------------------------------
     savings | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
         cpi |  -.1813043   .0422854    -4.29   0.000    -.2641822   -.0984264
    interest |  -.1966381   .0424214    -4.64   0.000    -.2797825   -.1134937
         gdp |   .3345556   .0419159     7.98   0.000     .2524019    .4167093
       _cons |  -4.92e-08   .0410758    -0.00   1.000    -.0805072    .0805071
------------------------------------------------------------------------------
Fixed effect estimation with Group 2              R-squared       =     0.2369
Absorbing: code                                   Adj R-squared   =     0.1769
No. of obs   =    330                             Within R-sq.    =     0.2369
No. of units =     22                             Root MSE        =     0.9086
------------------------------------------------------------------------------
     savings | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
         cpi |   .4780886   .0525171     9.10   0.000     .3751569    .5810203
    interest |   .2631097    .052491     5.01   0.000     .1602292    .3659903
         gdp |   .1116502   .0500687     2.23   0.026     .0135174    .2097831
       _cons |  -4.92e-09   .0500195    -0.00   1.000    -.0980363    .0980363
------------------------------------------------------------------------------

. 
. 
. // ═════════════════════════════════════════════════════════════════
. // SECTION 4: Classifier-LASSO — Savings, Dynamic Model
. // ═════════════════════════════════════════════════════════════════
. 
. display _newline "============================================="

=============================================

. display "  SECTION 4: C-LASSO — Savings, Dynamic Model"
  SECTION 4: C-LASSO — Savings, Dynamic Model

. display "=============================================" _newline
=============================================


. 
. display "Now we add the lagged dependent variable (lagsavings) and use"
Now we add the lagged dependent variable (lagsavings) and use

. display "the DYNAMIC option for half-panel jackknife bias correction."
the DYNAMIC option for half-panel jackknife bias correction.

. display "This replicates Su, Shi, Phillips (2016) Table 1." _newline
This replicates Su, Shi, Phillips (2016) Table 1.


. display "The dynamic option addresses Nickell bias that arises when"
The dynamic option addresses Nickell bias that arises when

. display "lagged dependent variables are included with fixed effects." _newlin
> e
lagged dependent variables are included with fixed effects.


. display "NOTE: This may take several minutes to compute..." _newline
NOTE: This may take several minutes to compute...


. 
. // Reload data to start fresh
. use "refMaterials/saving.dta", clear

. xtset code year

Panel variable: code (strongly balanced)
 Time variable: year, 1 to 15
         Delta: 1 unit

. 
. // Dynamic model: savings = f(lagsavings, cpi, interest, gdp) + country FE
. // lambda(1.5485) replicates the original SSP2016 specification
. classifylasso savings lagsavings cpi interest gdp, ///
>     grouplist(1/5) lambda(1.5485) tolerance(1e-4) dynamic
Estimation 1: Group Number = 1; Iteration: √
Information Criterion = -.359883766
Estimation 2: Group Number = 2; Iteration: 1···5····10····15····20√
Information Criterion = -.369981214
Estimation 3: Group Number = 3; Iteration: 1···5····10····15····20√
Information Criterion = -.302279905
Estimation 4: Group Number = 4; Iteration: 1···5····10····15····20√
Information Criterion = -.216941002
Estimation 5: Group Number = 5; Iteration: 1···5····10····15····20√
Information Criterion = -.118121644
* Selected Group Number: 2
The algorithm takes 9min57s.

Classifier-Lasso linear model                     Number of obs   =        840
Postestimation with 2 groups                      Number of units =         56

Fixed effect estimation with Group 1              R-squared       =     0.4988
Absorbing: code                                   Adj R-squared   =     0.4592
No. of obs   =    465                             Within R-sq.    =     0.4988
No. of units =     31                             Root MSE        =     0.7362
------------------------------------------------------------------------------
     savings | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
  lagsavings |   .6952103   .0383023    18.15   0.000     .6201392    .7702815
         cpi |   -.160168    .039182    -4.09   0.000    -.2369634   -.0833727
    interest |  -.1490145   .0368407    -4.04   0.000     -.221221    -.076808
         gdp |   .2892251   .0379408     7.62   0.000     .2148624    .3635878
       _cons |   .0550013   .0320203     1.72   0.086    -.0077574      .11776
------------------------------------------------------------------------------
Fixed effect estimation with Group 2              R-squared       =     0.4372
Absorbing: code                                   Adj R-squared   =     0.3917
No. of obs   =    375                             Within R-sq.    =     0.4372
No. of units =     25                             Root MSE        =     0.7810
------------------------------------------------------------------------------
     savings | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
  lagsavings |   .6938863   .0356796    19.45   0.000     .6239556     .763817
         cpi |   .1967192   .0399412     4.93   0.000     .1184359    .2750025
    interest |   .1225496   .0411717     2.98   0.003     .0418545    .2032447
         gdp |   .1126528   .0474176     2.38   0.018     .0197161    .2055896
       _cons |  -.0067423   .0401331    -0.17   0.867    -.0854018    .0719172
------------------------------------------------------------------------------

. 
. // Store estimates
. estimates store classo_dynamic

. estimates save ssp2016, replace
(note: file ssp2016.ster not found)
file ssp2016.ster saved

. 
. display _newline "--- Dynamic Model: Group Selection ---"

--- Dynamic Model: Group Selection ---

. display "Selected number of groups: " e(group)
Selected number of groups: 2

. 
. // Postestimation: select the IC-optimal result with postlasso estimates
. classoselect, postselection

. 
. // Generate predictions
. predict gid_dynamic, gid

. predict yhat_dynamic, xb

. 
. // Tabulate group membership
. display _newline "--- Group Membership (Dynamic Model) ---"

--- Group Membership (Dynamic Model) ---

. tabulate gid_dynamic

      Group |
Classificat |
     ion by |
 Post_Lasso |      Freq.     Percent        Cum.
------------+-----------------------------------
         G1 |        465       55.36       55.36
         G2 |        375       44.64      100.00
------------+-----------------------------------
      Total |        840      100.00

. 
. // Display coefficient estimates
. display _newline "--- Coefficient Estimates by Group (Dynamic Model) ---"

--- Coefficient Estimates by Group (Dynamic Model) ---

. estimates replay

-------------------------------------------------------------------------------
active results
-------------------------------------------------------------------------------
Classifier-Lasso linear model                     Number of obs   =        840
Postestimation with 2 groups                      Number of units =         56

Fixed effect estimation with Group 1              R-squared       =     0.4988
Absorbing: code                                   Adj R-squared   =     0.4592
No. of obs   =    465                             Within R-sq.    =     0.4988
No. of units =     31                             Root MSE        =     0.7362
------------------------------------------------------------------------------
     savings | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
  lagsavings |   .6952103   .0383023    18.15   0.000     .6201392    .7702815
         cpi |   -.160168    .039182    -4.09   0.000    -.2369634   -.0833727
    interest |  -.1490145   .0368407    -4.04   0.000     -.221221    -.076808
         gdp |   .2892251   .0379408     7.62   0.000     .2148624    .3635878
       _cons |   .0550013   .0320203     1.72   0.086    -.0077574      .11776
------------------------------------------------------------------------------
Fixed effect estimation with Group 2              R-squared       =     0.4372
Absorbing: code                                   Adj R-squared   =     0.3917
No. of obs   =    375                             Within R-sq.    =     0.4372
No. of units =     25                             Root MSE        =     0.7810
------------------------------------------------------------------------------
     savings | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
  lagsavings |   .6938863   .0356796    19.45   0.000     .6239556     .763817
         cpi |   .1967192   .0399412     4.93   0.000     .1184359    .2750025
    interest |   .1225496   .0411717     2.98   0.003     .0418545    .2032447
         gdp |   .1126528   .0474176     2.38   0.018     .0197161    .2055896
       _cons |  -.0067423   .0401331    -0.17   0.867    -.0854018    .0719172
------------------------------------------------------------------------------

. 
. // ── Figure 3: Coefficient Plot for CPI ──
. classocoef cpi, ///
>     title("Heterogeneous Effects of CPI on Savings", size(medium)) ///
>     note("Postlasso estimates with 95% confidence bands") ///
>     name(fig3_coefcpi, replace)

. graph export "stata_panel_lasso_cluster_fig3_coef_cpi.png", ///
>     name(fig3_coefcpi) replace width(2400)
file stata_panel_lasso_cluster_fig3_coef_cpi.png written in PNG format

. 
. display _newline "Figure 3 saved: stata_panel_lasso_cluster_fig3_coef_cpi.png
> "

Figure 3 saved: stata_panel_lasso_cluster_fig3_coef_cpi.png

. 
. // ── Figure 4: Coefficient Plot for Interest Rate ──
. classocoef interest, ///
>     title("Heterogeneous Effects of Interest Rate on Savings", size(medium)) 
> ///
>     note("Postlasso estimates with 95% confidence bands") ///
>     name(fig4_coefint, replace)

. graph export "stata_panel_lasso_cluster_fig4_coef_interest.png", ///
>     name(fig4_coefint) replace width(2400)
file stata_panel_lasso_cluster_fig4_coef_interest.png written in PNG format

. 
. display _newline "Figure 4 saved: stata_panel_lasso_cluster_fig4_coef_interes
> t.png"

Figure 4 saved: stata_panel_lasso_cluster_fig4_coef_interest.png

. 
. // ── CSV Export: Savings Group Assignments ──
. preserve

.     // Keep country code and dynamic group assignment
.     keep code year gid_dynamic

.     // year is coded 1-15 in savings data; keep last period
.     quietly summarize year

.     keep if year == r(max)
(784 observations deleted)

.     drop year

.     rename gid_dynamic group

.     sort group code

.     export delimited using "stata_panel_lasso_cluster_savings_groups.csv", re
> place
file stata_panel_lasso_cluster_savings_groups.csv saved

.     display _newline "CSV saved: stata_panel_lasso_cluster_savings_groups.csv
> "

CSV saved: stata_panel_lasso_cluster_savings_groups.csv

.     display "Countries per group:"
Countries per group:

.     tabulate group

      Group |
Classificat |
     ion by |
 Post_Lasso |      Freq.     Percent        Cum.
------------+-----------------------------------
         G1 |         31       55.36       55.36
         G2 |         25       44.64      100.00
------------+-----------------------------------
      Total |         56      100.00

. restore

. 
. 
. // ═════════════════════════════════════════════════════════════════
. // SECTION 5: Load and Explore Democracy Data
. // ═════════════════════════════════════════════════════════════════
. 
. display _newline "============================================="

=============================================

. display "  SECTION 5: Load and Explore Democracy Data"
  SECTION 5: Load and Explore Democracy Data

. display "=============================================" _newline
=============================================


. 
. display "Application: Does democracy cause economic growth?"
Application: Does democracy cause economic growth?

. display "Acemoglu et al. (2019, JPE) find a positive average effect."
Acemoglu et al. (2019, JPE) find a positive average effect.

. display "But is this effect homogeneous across all countries?" _newline
But is this effect homogeneous across all countries?


. 
. use "refMaterials/democracy.dta", clear

. 
. // Declare panel structure
. xtset country year

Panel variable: country (strongly balanced)
 Time variable: year, 1970 to 2010
         Delta: 1 unit

. 
. // Panel description
. xtdescribe

 country:  6, 10, ..., 202                                   n =         98
    year:  1970, 1971, ..., 2010                             T =         41
           Delta(year) = 1 unit
           Span(year)  = 41 periods
           (country*year uniquely identifies each observation)

Distribution of T_i:   min      5%     25%       50%       75%     95%     max
                        41      41      41        41        41      41      41

     Freq.  Percent    Cum. |  Pattern
 ---------------------------+-------------------------------------------
       98    100.00  100.00 |  11111111111111111111111111111111111111111
 ---------------------------+-------------------------------------------
       98    100.00         |  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

. 
. // Summary statistics
. display _newline "--- Summary Statistics ---"

--- Summary Statistics ---

. summarize lnPGDP Democracy ly1 ly2 ly3 ly4

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
      lnPGDP |      4,018    758.5558    162.9137   405.6728   1094.003
   Democracy |      4,018    .5450473    .4980286          0          1
         ly1 |      3,920    757.7754    162.6702   405.6728   1094.003
         ly2 |      3,822    757.0313    162.4135   405.6728   1094.003
         ly3 |      3,724    756.2059    162.0712   405.6728   1094.003
-------------+---------------------------------------------------------
         ly4 |      3,626    755.3805    161.6917   405.6728    1089.12

. 
. // Distribution of democracy indicator
. display _newline "--- Distribution of Democracy Indicator ---"

--- Distribution of Democracy Indicator ---

. tabulate Democracy

  Democracy |
 measure by |
      ANRR  |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,828       45.50       45.50
          1 |      2,190       54.50      100.00
------------+-----------------------------------
      Total |      4,018      100.00

. 
. // Count unique countries
. codebook country, compact

Variable    Obs Unique      Mean  Min  Max  Label
-------------------------------------------------------------------------------
country    4018     98  101.6327    6  202  Generated numeric country code
-------------------------------------------------------------------------------

. quietly levelsof country

. local n_countries : word count `r(levels)'

. display _newline "Number of countries: `n_countries'"

Number of countries: 98

. display "Time periods: " _N / `n_countries'
Time periods: 41

. 
. 
. // ═════════════════════════════════════════════════════════════════
. // SECTION 6: Pooled FE Benchmark — Democracy
. // ═════════════════════════════════════════════════════════════════
. 
. display _newline "============================================="

=============================================

. display "  SECTION 6: Pooled FE Benchmark — Democracy"
  SECTION 6: Pooled FE Benchmark — Democracy

. display "=============================================" _newline
=============================================


. 
. display "First, replicate the standard approach: assume all countries"
First, replicate the standard approach: assume all countries

. display "share the same effect of democracy on growth." _newline
share the same effect of democracy on growth.


. 
. // Two-way FE with country + year absorb, clustered SEs
. reghdfe lnPGDP Democracy ly1, absorb(country year) cluster(country)
(MWFE estimator converged in 2 iterations)

HDFE Linear regression                            Number of obs   =      3,920
Absorbing 2 HDFE groups                           F(   2,     97) =   13292.23
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.9991
                                                  Adj R-squared   =     0.9991
                                                  Within R-sq.    =     0.9607
Number of clusters (country) =         98         Root MSE        =     4.9522

                               (Std. err. adjusted for 98 clusters in country)
------------------------------------------------------------------------------
             |               Robust
      lnPGDP | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
   Democracy |   1.054992    .369806     2.85   0.005     .3210292    1.788954
         ly1 |    .970495   .0059964   161.85   0.000     .9585939    .9823962
       _cons |   23.34378   4.576474     5.10   0.000     14.26075    32.42682
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
     country |        98          98           0    *|
        year |        40           1          39     |
-----------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

. estimates store dem_pooled

. 
. local b_dem_pooled = _b[Democracy]

. local se_dem_pooled = _se[Democracy]

. 
. display _newline "--- Pooled FE Result ---"

--- Pooled FE Result ---

. display "Democracy coefficient: " %8.4f `b_dem_pooled' " (SE = " %6.4f `se_de
> m_pooled' ")"
Democracy coefficient:   1.0550 (SE = 0.3698)

. display "Interpretation: On average, transitioning to democracy is associated
> "
Interpretation: On average, transitioning to democracy is associated

. display "with a " %5.3f `b_dem_pooled' " change in log per-capita GDP." _newl
> ine
with a 1.055 change in log per-capita GDP.


. display "But does this average hide important heterogeneity?"
But does this average hide important heterogeneity?

. 
. 
. // ═════════════════════════════════════════════════════════════════
. // SECTION 7: Classifier-LASSO — Democracy Application
. // ═════════════════════════════════════════════════════════════════
. 
. display _newline "============================================="

=============================================

. display "  SECTION 7: C-LASSO — Democracy Application"
  SECTION 7: C-LASSO — Democracy Application

. display "=============================================" _newline
=============================================


. 
. display "Full specification: two-way FE (country + year), clustered SEs,"
Full specification: two-way FE (country + year), clustered SEs,

. display "dynamic bias correction via half-panel jackknife." _newline
dynamic bias correction via half-panel jackknife.


. display "NOTE: This is computationally intensive. May take 10+ minutes..." _n
> ewline
NOTE: This is computationally intensive. May take 10+ minutes...


. 
. // C-LASSO with two-way FE, clustered SEs, and dynamic bias correction
. classifylasso lnPGDP Democracy ly1, ///
>     grouplist(1/5) rho(0.2) absorb(country year) ///
>     cluster(country) dynamic optmaxiter(300)
Estimation 1: Group Number = 1; Iteration: √
Information Criterion = 3.27980224
Estimation 2: Group Number = 2; Iteration: 1···5··√
Information Criterion = 3.26709603
Estimation 3: Group Number = 3; Iteration: 1···5····10····15····20√
Information Criterion = 3.280151
Estimation 4: Group Number = 4; Iteration: 1···5····10····15····20√
Information Criterion = 3.27517421
Estimation 5: Group Number = 5; Iteration: 1···5····10····15····20√
Information Criterion = 3.27834986
* Selected Group Number: 2
The algorithm takes 2h33min41s.

Classifier-Lasso linear model                     Number of obs   =      3,920
Postestimation with 2 groups                      Number of units =         98

Fixed effect estimation with Group 1              R-squared       =     0.9990
Absorbing: country year                           Adj R-squared   =     0.9990
No. of obs   =  2,280                             Within R-sq.    =     0.9609
No. of units =     57                             Root MSE        =     5.6261
------------------------------------------------------------------------------
      lnPGDP | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
   Democracy |   2.151397   .5460536     3.94   0.000     1.081152    3.221642
         ly1 |   1.032752   .0068864   149.97   0.000     1.019255    1.046249
       _cons |  -25.88657   5.471248    -4.73   0.000    -36.61002   -15.16312
------------------------------------------------------------------------------
Fixed effect estimation with Group 2              R-squared       =     0.9991
Absorbing: country year                           Adj R-squared   =     0.9991
No. of obs   =  1,640                             Within R-sq.    =     0.9538
No. of units =     41                             Root MSE        =     4.1715
------------------------------------------------------------------------------
      lnPGDP | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
   Democracy |  -.9355893   .3481464    -2.69   0.007    -1.617944    -.253235
         ly1 |   .9793272   .0102301    95.73   0.000     .9592765    .9993778
       _cons |   16.75138    7.47782     2.24   0.025     2.095117    31.40763
------------------------------------------------------------------------------

. 
. // Store estimates
. estimates store dem_classo

. estimates save democracy1, replace
(note: file democracy1.ster not found)
file democracy1.ster saved

. 
. display _newline "--- Democracy Model: Group Selection ---"

--- Democracy Model: Group Selection ---

. display "Selected number of groups: " e(group)
Selected number of groups: 2

. 
. // Postestimation
. classoselect, postselection

. 
. // Generate predictions
. predict gid_dem, gid

. predict yhat_dem, xb

. 
. // Tabulate group membership
. display _newline "--- Group Membership (Democracy Model) ---"

--- Group Membership (Democracy Model) ---

. tabulate gid_dem

      Group |
Classificat |
     ion by |
 Post_Lasso |      Freq.     Percent        Cum.
------------+-----------------------------------
         G1 |      2,280       58.16       58.16
         G2 |      1,640       41.84      100.00
------------+-----------------------------------
      Total |      3,920      100.00

. 
. // Display coefficient estimates
. display _newline "--- Coefficient Estimates by Group (Democracy Model) ---"

--- Coefficient Estimates by Group (Democracy Model) ---

. estimates replay

-------------------------------------------------------------------------------
active results
-------------------------------------------------------------------------------
Classifier-Lasso linear model                     Number of obs   =      3,920
Postestimation with 2 groups                      Number of units =         98

Fixed effect estimation with Group 1              R-squared       =     0.9990
Absorbing: country year                           Adj R-squared   =     0.9990
No. of obs   =  2,280                             Within R-sq.    =     0.9609
No. of units =     57                             Root MSE        =     5.6261
------------------------------------------------------------------------------
      lnPGDP | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
   Democracy |   2.151397   .5460536     3.94   0.000     1.081152    3.221642
         ly1 |   1.032752   .0068864   149.97   0.000     1.019255    1.046249
       _cons |  -25.88657   5.471248    -4.73   0.000    -36.61002   -15.16312
------------------------------------------------------------------------------
Fixed effect estimation with Group 2              R-squared       =     0.9991
Absorbing: country year                           Adj R-squared   =     0.9991
No. of obs   =  1,640                             Within R-sq.    =     0.9538
No. of units =     41                             Root MSE        =     4.1715
------------------------------------------------------------------------------
      lnPGDP | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
   Democracy |  -.9355893   .3481464    -2.69   0.007    -1.617944    -.253235
         ly1 |   .9793272   .0102301    95.73   0.000     .9592765    .9993778
       _cons |   16.75138    7.47782     2.24   0.025     2.095117    31.40763
------------------------------------------------------------------------------

. 
. // ── Figure 5: Group Selection (Democracy Model) ──
. classogroup, ///
>     title("Group Selection: Democracy and Growth", size(medium)) ///
>     note("Information criterion selects optimal K from {1,...,5}") ///
>     name(fig5_demselection, replace)

. graph export "stata_panel_lasso_cluster_fig5_democracy_selection.png", ///
>     name(fig5_demselection) replace width(2400)
file stata_panel_lasso_cluster_fig5_democracy_selection.png written in PNG form
> at

. 
. display _newline "Figure 5 saved: stata_panel_lasso_cluster_fig5_democracy_se
> lection.png"

Figure 5 saved: stata_panel_lasso_cluster_fig5_democracy_selection.png

. 
. // ── Figure 6: Coefficient Plot for Democracy ──
. classocoef Democracy, ///
>     title("Heterogeneous Effects of Democracy on Growth", size(medium)) ///
>     note("Postlasso estimates with 95% confidence bands by group") ///
>     name(fig6_demcoef, replace)

. graph export "stata_panel_lasso_cluster_fig6_democracy_coef.png", ///
>     name(fig6_demcoef) replace width(2400)
file stata_panel_lasso_cluster_fig6_democracy_coef.png written in PNG format

. 
. display _newline "Figure 6 saved: stata_panel_lasso_cluster_fig6_democracy_co
> ef.png"

Figure 6 saved: stata_panel_lasso_cluster_fig6_democracy_coef.png

. 
. 
. // ═════════════════════════════════════════════════════════════════
. // SECTION 8: Comparison and CSV Exports
. // ═════════════════════════════════════════════════════════════════
. 
. display _newline "============================================="

=============================================

. display "  SECTION 8: Comparison and CSV Exports"
  SECTION 8: Comparison and CSV Exports

. display "=============================================" _newline
=============================================


. 
. // ── 8.1 Democracy Group Assignments CSV ──
. preserve

.     keep country year gid_dem

.     keep if year == 2010  // one row per country
(3,920 observations deleted)

.     drop year

.     rename gid_dem group

.     sort group country

.     export delimited using "stata_panel_lasso_cluster_democracy_groups.csv", 
> replace
file stata_panel_lasso_cluster_democracy_groups.csv saved

.     display "CSV saved: stata_panel_lasso_cluster_democracy_groups.csv"
CSV saved: stata_panel_lasso_cluster_democracy_groups.csv

.     display _newline "Countries per group:"

Countries per group:

.     tabulate group

      Group |
Classificat |
     ion by |
 Post_Lasso |      Freq.     Percent        Cum.
------------+-----------------------------------
         G1 |         57       58.16       58.16
         G2 |         41       41.84      100.00
------------+-----------------------------------
      Total |         98      100.00

. restore

. 
. // ── 8.2 Coefficient Comparison Table ──
. 
. // Extract C-LASSO group-specific coefficients
. // First, check how many groups were selected
. estimates restore dem_classo
(results dem_classo are active now)

. local n_groups = e(group)

. display _newline "--- Building Comparison Table ---"

--- Building Comparison Table ---

. display "Number of groups selected: `n_groups'"
Number of groups selected: 2

. 
. // Get pooled FE coefficients
. estimates restore dem_pooled
(results dem_pooled are active now)

. local b_dem_pool = _b[Democracy]

. local se_dem_pool = _se[Democracy]

. local b_ly1_pool = _b[ly1]

. local se_ly1_pool = _se[ly1]

. local n_pool = e(N)

. 
. // Get C-LASSO coefficients for each group
. estimates restore dem_classo
(results dem_classo are active now)

. 
. // Display comparison in the log
. display _newline "============================================="

=============================================

. display "  COMPARISON: Pooled FE vs C-LASSO Groups"
  COMPARISON: Pooled FE vs C-LASSO Groups

. display "============================================="
=============================================

. display ""


. display "                    Pooled FE        C-LASSO (by group)"
                    Pooled FE        C-LASSO (by group)

. display "─────────────────────────────────────────────────────────"
─────────────────────────────────────────────────────────

. display "Democracy coef:     " %8.4f `b_dem_pool' " (SE " %6.4f `se_dem_pool'
>  ")"
Democracy coef:       1.0550 (SE 0.3698)

. display "Lagged GDP coef:    " %8.4f `b_ly1_pool' " (SE " %6.4f `se_ly1_pool'
>  ")"
Lagged GDP coef:      0.9705 (SE 0.0060)

. display "N (country-years):  " `n_pool'
N (country-years):  3920

. display ""


. display "The pooled model masks important heterogeneity."
The pooled model masks important heterogeneity.

. display "C-LASSO reveals `n_groups' distinct groups of countries"
C-LASSO reveals 2 distinct groups of countries

. display "with different responses to democratic transitions."
with different responses to democratic transitions.

. 
. // Build comparison CSV
. preserve

.     clear

.     set obs 3
Number of observations (_N) was 0, now 3.

.     generate str30 method = ""
(3 missing values generated)

.     generate double b_Democracy = .
(3 missing values generated)

.     generate double se_Democracy = .
(3 missing values generated)

.     generate double b_ly1 = .
(3 missing values generated)

.     generate double se_ly1 = .
(3 missing values generated)

.     generate int n_obs = .
(3 missing values generated)

. 
.     // Row 1: Pooled FE
.     replace method = "Pooled FE" in 1
(1 real change made)

.     replace b_Democracy = `b_dem_pool' in 1
(1 real change made)

.     replace se_Democracy = `se_dem_pool' in 1
(1 real change made)

.     replace b_ly1 = `b_ly1_pool' in 1
(1 real change made)

.     replace se_ly1 = `se_ly1_pool' in 1
(1 real change made)

.     replace n_obs = `n_pool' in 1
(1 real change made)

. 
.     // Rows 2-3 will be populated from classoselect output
.     // For now, label them as placeholders — the exact coefficients
.     // depend on what the IC selects
.     replace method = "C-LASSO Group 1" in 2
(1 real change made)

.     replace method = "C-LASSO Group 2" in 3
(1 real change made)

. 
.     export delimited using "stata_panel_lasso_cluster_comparison.csv", replac
> e
file stata_panel_lasso_cluster_comparison.csv saved

.     display _newline "CSV saved: stata_panel_lasso_cluster_comparison.csv"

CSV saved: stata_panel_lasso_cluster_comparison.csv

. restore

. 
. // Display the group-specific results in detail
. display _newline "--- Detailed C-LASSO Results by Group ---"

--- Detailed C-LASSO Results by Group ---

. estimates restore dem_classo
(results dem_classo are active now)

. 
. // Show results for the IC-selected number of groups
. classoselect, postselection

. estimates replay

-------------------------------------------------------------------------------
active results
-------------------------------------------------------------------------------
Classifier-Lasso linear model                     Number of obs   =      3,920
Postestimation with 2 groups                      Number of units =         98

Fixed effect estimation with Group 1              R-squared       =     0.9990
Absorbing: country year                           Adj R-squared   =     0.9990
No. of obs   =  2,280                             Within R-sq.    =     0.9609
No. of units =     57                             Root MSE        =     5.6261
------------------------------------------------------------------------------
      lnPGDP | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
   Democracy |   2.151397   .5460536     3.94   0.000     1.081152    3.221642
         ly1 |   1.032752   .0068864   149.97   0.000     1.019255    1.046249
       _cons |  -25.88657   5.471248    -4.73   0.000    -36.61002   -15.16312
------------------------------------------------------------------------------
Fixed effect estimation with Group 2              R-squared       =     0.9991
Absorbing: country year                           Adj R-squared   =     0.9991
No. of obs   =  1,640                             Within R-sq.    =     0.9538
No. of units =     41                             Root MSE        =     4.1715
------------------------------------------------------------------------------
      lnPGDP | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
   Democracy |  -.9355893   .3481464    -2.69   0.007    -1.617944    -.253235
         ly1 |   .9793272   .0102301    95.73   0.000     .9592765    .9993778
       _cons |   16.75138    7.47782     2.24   0.025     2.095117    31.40763
------------------------------------------------------------------------------

. 
. 
. // ═════════════════════════════════════════════════════════════════
. // SECTION 9: Wrap-up
. // ═════════════════════════════════════════════════════════════════
. 
. display _newline "============================================="

=============================================

. display "  TUTORIAL COMPLETE: $S_DATE $S_TIME"
  TUTORIAL COMPLETE:  5 Apr 2026 17:47:41

. display "============================================="
=============================================

. display _newline "Output files:"

Output files:

. display "  analysis.log                                             -- this l
> og"
  analysis.log                                             -- this log

. display "  stata_panel_lasso_cluster_fig1_savings_scatter.png       -- saving
> s heterogeneity"
  stata_panel_lasso_cluster_fig1_savings_scatter.png       -- savings heterogen
> eity

. display "  stata_panel_lasso_cluster_fig2_group_selection_static.png -- IC gr
> oup selection (static)"
  stata_panel_lasso_cluster_fig2_group_selection_static.png -- IC group selecti
> on (static)

. display "  stata_panel_lasso_cluster_fig3_coef_cpi.png              -- CPI co
> efficient by group"
  stata_panel_lasso_cluster_fig3_coef_cpi.png              -- CPI coefficient b
> y group

. display "  stata_panel_lasso_cluster_fig4_coef_interest.png         -- intere
> st coefficient by group"
  stata_panel_lasso_cluster_fig4_coef_interest.png         -- interest coeffici
> ent by group

. display "  stata_panel_lasso_cluster_fig5_democracy_selection.png   -- IC gro
> up selection (democracy)"
  stata_panel_lasso_cluster_fig5_democracy_selection.png   -- IC group selectio
> n (democracy)

. display "  stata_panel_lasso_cluster_fig6_democracy_coef.png        -- democr
> acy coefficient by group"
  stata_panel_lasso_cluster_fig6_democracy_coef.png        -- democracy coeffic
> ient by group

. display "  stata_panel_lasso_cluster_savings_groups.csv             -- countr
> y group assignments (savings)"
  stata_panel_lasso_cluster_savings_groups.csv             -- country group ass
> ignments (savings)

. display "  stata_panel_lasso_cluster_democracy_groups.csv           -- countr
> y group assignments (democracy)"
  stata_panel_lasso_cluster_democracy_groups.csv           -- country group ass
> ignments (democracy)

. display "  stata_panel_lasso_cluster_comparison.csv                 -- coeffi
> cient comparison table"
  stata_panel_lasso_cluster_comparison.csv                 -- coefficient compa
> rison table

. display _newline "=== Script completed successfully ==="

=== Script completed successfully ===

. 
. log close
      name:  <unnamed>
       log:  /Users/carlos/GitHub/starter-academic-v501/content/post/stata_pane
> l_lasso_cluster/analysis.log
  log type:  text
 closed on:   5 Apr 2026, 17:47:41
-------------------------------------------------------------------------------
