Back to Article
N4: Spillover modeling
Download Notebook

Open In Colab

This notebook estimates 8 econometric models to analyze convergence in nighttime light intensity across 520 Indian districts (1996–2010). It compares standard OLS regressions with Spatial Durbin Models (SDM) that account for spatial spillovers between neighboring districts. The models follow a 2×2×2 design: OLS vs SDM, unconditional vs conditional, without vs with state fixed effects. For details on the model design and spatial weights, see the Background & Context section below.

Running Stata in Jupyter Notebooks

This notebook uses the stata_kernel package, which lets you run Stata code natively inside Jupyter notebooks. Each code cell works like the Stata command window — the kernel maintains a live Stata session in the background, so variables, datasets, and estimation results persist across cells.

Prerequisites

  • Stata installed on your machine (SE, MP, or BE — version 14 or later recommended)
  • Python 3.6+ with Jupyter (pip install jupyter or via Anaconda)
  • A valid Stata license activated on your system

Installation

Install the stata_kernel package and register it with Jupyter:

pip install stata_kernel
python -m stata_kernel.install

If you use conda, you can install from conda-forge instead:

conda install -c conda-forge stata_kernel

Configuration

After installation, edit (or create) the configuration file ~/.stata_kernel.conf to point to your Stata executable:

[stata_kernel]

# Path to Stata executable (adjust for your system)
# macOS examples:
stata_path = /Applications/Stata/StataSE.app/Contents/MacOS/StataSE
# stata_path = /Applications/Stata/StataMP.app/Contents/MacOS/StataMP

# Windows examples:
# stata_path = C:\Program Files\Stata18\StataSE-64.exe

# Linux examples:
# stata_path = /usr/local/stata18/stata-se

Verify the installation

Run the following in a terminal to confirm the kernel is registered:

jupyter kernelspec list

You should see stata in the output. Then open a new Jupyter notebook, select the Stata kernel, and run a simple command like display "Hello from Stata!" to confirm it works.

Basic usage tips

Feature Description
State persistence Variables, datasets, and scalars carry over from cell to cell (like a live Stata session)
Graphics Stata graphs display inline automatically
%help magic Type %help regress to display Stata help in the notebook
%browse magic Type %browse to view the current dataset
%head / %tail Preview the first or last rows of the dataset
Long commands Use /// for line continuation, just as in a .do file

Troubleshooting

Problem Solution
Kernel not found Re-run python -m stata_kernel.install and restart Jupyter
“Stata not found” error Check that stata_path in ~/.stata_kernel.conf points to the correct executable
License error Ensure Stata is activated — try launching Stata normally first
Slow startup The first cell may take a few seconds while Stata initializes; subsequent cells run faster
graph export fails Stata requires a display server on Linux; use xvfb-run jupyter notebook if running headless

1. Background & Context

The cell below documents the research context as inline Stata comments. Key points:

  • Research question: Does nighttime light growth (a proxy for economic activity) converge across Indian districts, and do neighboring districts generate spatial spillovers?
  • Dependent variable: light_growth96_10rcr_cap — annualized growth in per-capita nighttime light intensity (1996–2010)
  • Key regressor: log_light96_rcr_cap — log of initial (1996) per-capita light intensity. A negative coefficient indicates convergence (initially brighter districts grow more slowly)
  • Controls: 16 variables capturing terrain, climate, demographics, infrastructure, and human capital
  • Spatial weights: W6nn — the row-normalized 6NN matrix loaded from W_matrix.dta
In [90]:
/*==============================================================================
   Spatial Convergence Analysis of NTL in India
   -------------------------------------------
   Purpose:
   This do-file explores regional convergence across Indian regions 
   between 1996 and 2010. It compares OLS and Spatial Durbin Model (SDM) 
   specifications (both unconditional and conditional), as well as models 
   with and without state fixed effects (FE). We use a spatial weights matrix 
   (W6nn) to construct spatial lags.

   Key Features/Outcomes:
   1) OLS vs. SDM estimates with and without state FE.
   2) Extraction of AIC values for model comparison.
   3) Calculation of direct and indirect spatial impacts.
==============================================================================*/


/*------------------------------------------------------------------------------
   1. BACKGROUND & CONTEXT
   ----------------------------------------
   - Research Motivation:
     Investigate how local characteristics and neighboring regions' values 
     affect light growth (a proxy for economic activity).

   - Theoretical Framework:
     Spatial Durbin Model (SDM) allows both the dependent variable and 
     explanatory variables to have spatial lags (i.e., influence from neighbors).

   - Data Description:
     1) "W_matrix.dta": Contains a 520×520 matrix constructed using a 6 nearest neighbors approach, row-normalized to create W6nn.
     2) "india520.dta": Dataset with 520 observations representing regions/districts.
        Variables include:
         • light_growth96_10rcr_cap: Dependent variable (light-based growth).
         • log_light96_rcr_cap: Logged initial light measure.
         • Controls (terrain, climate, demographics, etc.): 
           suit_mean_snd, rain_mean_snd, mala_mean_snd, temp_mean_snd,
           rug_mean_snd, distance, latitude, rur_percent96_rcr,
           log_tot_density_rcr, sc_percent96, st_percent96, 
           workp_percent96, lit_percent96, higheredu_percent96, 
           elechh_percent96, log_puccaroads
         • state: Categorical variable for Indian states.

   - Key Variables:
     • light_growth96_10rcr_cap
     • log_light96_rcr_cap
     • W6nn: Spatial weights matrix (row-normalized)
------------------------------------------------------------------------------*/
In [1]:
/*==============================================================================
   2. SETUP
   ======================================
   Purpose: 
   - Initialize Stata environment
   - Load required datasets
   - Define spatial settings and IDs
   - Prepare for regression analysis
==============================================================================*/

clear all
macro drop _all
capture log close


* Basic environment settings
version 15
set more off

* Ensure working directory is notebooks/
* The Stata kernel may retain its directory from previous sessions
local _nb_found 0

* (1) Already in notebooks/?
capture confirm file "c04_spillover_modeling_6nn.ipynb"
if _rc == 0  local _nb_found 1

* (2) In project root? Try cd notebooks
if !`_nb_found' {
    quietly capture cd "notebooks"
    capture confirm file "c04_spillover_modeling_6nn.ipynb"
    if _rc == 0  local _nb_found 1
}

* (3) Kernel is somewhere else entirely — reset to home, walk to project
if !`_nb_found' {
    quietly cd "~"
    foreach p in "Documents/GitHub/project2025s" "GitHub/project2025s" "project2025s" {
        quietly capture cd "~"
        quietly capture cd "`p'/notebooks"
        capture confirm file "c04_spillover_modeling_6nn.ipynb"
        if _rc == 0 {
            local _nb_found 1
            continue, break
        }
    }
}

* (4) Give up with a helpful error
if !`_nb_found' {
    display as error "Could not find notebooks/ directory."
    display as error "Current directory: `c(pwd)'"
    display as error "Run this in the first cell:  cd ~/path/to/project2025s/notebooks"
}
*display "Working directory: `c(pwd)'"

* Start logging
capture log using "c04_spillover_modeling.log", replace


*------------------------------------------------------------------------------
* (2.1) Define a global macro for repeated control variables
*     Multi-line approach without quotes
*------------------------------------------------------------------------------
global controls suit_mean_snd rain_mean_snd ///
    mala_mean_snd temp_mean_snd ///
    rug_mean_snd distance ///
    latitude rur_percent96_rcr ///
    log_tot_density_rcr sc_percent96 ///
    st_percent96 workp_percent96 ///
    lit_percent96 higheredu_percent96 ///
    elechh_percent96 log_puccaroads

*------------------------------------------------------------------------------
* (2.2) Load Spatial Weights Matrix
*------------------------------------------------------------------------------

use "https://github.com/quarcs-lab/project2025s/raw/refs/heads/master/data/W_matrix.dta", clear

* Generate ID for each observation and set spatial data
gen id = _n
order id, first
spset id

* Create a row-normalized spatial weights matrix from data
spmatrix fromdata W6nn = _0 - _519, normalize(row) replace

* Summarize the spatial weights to ensure correctness
spmatrix summarize W6nn

*------------------------------------------------------------------------------
* (2.3) Load Main Dataset and Set Spatial IDs
*------------------------------------------------------------------------------
use "https://github.com/quarcs-lab/project2025s/raw/refs/heads/master/data/india520.dta", clear

encode state, generate(state_encoded)
gen id = _n
spset id












Working directory: /Users/carlosmendez/Documents/GitHub/project2025s/notebooks







      Sp dataset: W_matrix.dta
Linked shapefile: <none>
            Data: Cross sectional
 Spatial-unit ID: _ID (equal to id)
     Coordinates: <none>



Weighting matrix W6nn
---------------------------------------
           Type |               custom
  Normalization |                  row
      Dimension |            520 x 520
Elements        |
   minimum      |                    0
   minimum > 0  |             .1666667
   mean         |             .0019231
   max          |             .1666667
---------------------------------------





      Sp dataset: india520.dta
Linked shapefile: <none>
            Data: Cross sectional
 Spatial-unit ID: _ID (equal to id)
     Coordinates: <none>

3. Main Analysis

We estimate 8 models in a systematic 2×2×2 design:

  • Estimator: OLS vs. Spatial Durbin Model (SDM)
  • Specification: Unconditional (only initial light) vs. Conditional (with 16 controls)
  • Fixed effects: None vs. State FE

For each model we store: - The estimation results via eststo (for potential use with esttab) - The AIC via estat ic for model comparison - Scalar coefficients and standard errors for the summary table

For SDM models, estat impact decomposes the marginal effect of log_light96_rcr_cap into: - Direct effect: The impact of a district’s own initial light on its own growth - Indirect effect: The spillover impact from neighbors’ initial light - Total effect: Direct + Indirect

For OLS models, the coefficient is the direct (and total) effect; indirect effects are not applicable.

In [92]:
/*==============================================================================
   3. MAIN ANALYSIS
   ======================================
   Purpose:
   - Estimate and compare multiple model specifications 
     (OLS vs. SDM, unconditional vs. conditional, with/without state FE).
   - Store AIC for model comparison.
   - Assess spatial impacts for SDM specifications.
==============================================================================*/

* We'll use eststo/estadd from the estout package to store results (e.g. AIC).

3.1 Unconditional Models

These models test for unconditional (absolute) convergence — whether initially poorer districts grow faster, without controlling for structural differences. The only regressor is log_light96_rcr_cap.

  • Model 1 (OLS): Baseline convergence regression
  • Model 2 (SDM): Adds spatial lags of both the dependent variable and the regressor
  • Model 3 (OLS + State FE): Controls for unobserved state-level heterogeneity
  • Model 4 (SDM + State FE): Full spatial model with state fixed effects

After each SDM estimation, estat impact computes the direct/indirect/total effects. These are saved into scalars for the summary table.

In [93]:
***************************************************************
* MODEL 1: Unconditional OLS
***************************************************************
regress light_growth96_10rcr_cap log_light96_rcr_cap, robust
eststo m1
estat ic
mat s = r(S)
quietly estadd scalar AIC = s[1,5]
scalar m1_d_b  = _b[log_light96_rcr_cap]
scalar m1_d_se = _se[log_light96_rcr_cap]
scalar m1_aic  = s[1,5]


Linear regression                               Number of obs     =        520
                                                F(1, 518)         =      94.27
                                                Prob > F          =     0.0000
                                                R-squared         =     0.2547
                                                Root MSE          =     .03722

-------------------------------------------------------------------------------
              |               Robust
light_growt~p | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
--------------+----------------------------------------------------------------
log_light96~p |  -.0198811   .0020476    -9.71   0.000    -.0239037   -.0158584
        _cons |  -.0722739   .0092154    -7.84   0.000     -.090378   -.0541698
-------------------------------------------------------------------------------



Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
          m1 |        520   897.9766   974.4141       2  -1944.828  -1936.321
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.




In [94]:
***************************************************************
* MODEL 2: Unconditional SDM
***************************************************************
quietly spregress light_growth96_10rcr_cap ///
    log_light96_rcr_cap, ///
    ml vce(robust) ///
    dvarlag(W6nn) ///
    ivarlag(W6nn: log_light96_rcr_cap)

eststo m2
estat ic
mat s = r(S)
quietly estadd scalar AIC = s[1,5]
estat impact
matrix _bd = r(b_direct)
matrix _bi = r(b_indirect)
matrix _bt = r(b_total)
matrix _Vd = r(V_direct)
matrix _Vi = r(V_indirect)
matrix _Vt = r(V_total)
scalar m2_d_b  = _bd[1,1]
scalar m2_d_se = sqrt(_Vd[1,1])
scalar m2_i_b  = _bi[1,1]
scalar m2_i_se = sqrt(_Vi[1,1])
scalar m2_t_b  = _bt[1,1]
scalar m2_t_se = sqrt(_Vt[1,1])
scalar m2_aic  = s[1,5]




Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
          m2 |        520          .   1149.866       5  -2289.732  -2268.462
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.




progress   :100% 

Average impacts                                 Number of obs     =        520

-------------------------------------------------------------------------------
              |            Delta-Method
              |      dy/dx   std. err.      z    P>|z|     [95% conf. interval]
--------------+----------------------------------------------------------------
direct        |
log_light96~p |  -.0212342   .0018263   -11.63   0.000    -.0248137   -.0176546
--------------+----------------------------------------------------------------
indirect      |
log_light96~p |   -.000505   .0056827    -0.09   0.929    -.0116429    .0106329
--------------+----------------------------------------------------------------
total         |
log_light96~p |  -.0217392   .0057028    -3.81   0.000    -.0329165   -.0105619
-------------------------------------------------------------------------------












In [95]:
***************************************************************
* MODEL 3: Unconditional OLS with State FE
***************************************************************
regress light_growth96_10rcr_cap log_light96_rcr_cap i.state_encoded, robust
eststo m3
estat ic
mat s = r(S)
quietly estadd scalar AIC = s[1,5]
scalar m3_d_b  = _b[log_light96_rcr_cap]
scalar m3_d_se = _se[log_light96_rcr_cap]
scalar m3_aic  = s[1,5]


Linear regression                               Number of obs     =        520
                                                F(26, 491)        =          .
                                                Prob > F          =          .
                                                R-squared         =     0.7246
                                                Root MSE          =     .02324

-------------------------------------------------------------------------------
              |               Robust
light_growt~p | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
--------------+----------------------------------------------------------------
log_light96~p |  -.0216683   .0025087    -8.64   0.000    -.0265975   -.0167391
              |
state_encoded |
Arunachal ..  |   .0072529    .010514     0.69   0.491    -.0134051    .0279109
       Bihar  |   -.051117   .0084225    -6.07   0.000    -.0676656   -.0345684
  Chandigarh  |  -.0037725   .0027363    -1.38   0.169    -.0091487    .0016038
Chhattisgarh  |   .0057804   .0077214     0.75   0.454    -.0093906    .0209515
         Goa  |   -.001508   .0056931    -0.26   0.791     -.012694    .0096779
     Gujarat  |  -.0264199   .0045966    -5.75   0.000    -.0354513   -.0173886
     Haryana  |   .0010313   .0031035     0.33   0.740    -.0050665    .0071291
Himachal P..  |   .0381278   .0059529     6.40   0.000     .0264314    .0498242
Jammu & Ka..  |   .0339063   .0114585     2.96   0.003     .0113926      .05642
   Jharkhand  |  -.0293129   .0089411    -3.28   0.001    -.0468805   -.0117453
   Karnataka  |    .001836   .0030141     0.61   0.543    -.0040861    .0077582
      Kerala  |  -.0200941   .0046498    -4.32   0.000    -.0292301    -.010958
Madhya Pra..  |  -.0690919   .0044331   -15.59   0.000    -.0778021   -.0603817
 Maharashtra  |  -.0296486   .0033553    -8.84   0.000    -.0362411    -.023056
     Manipur  |  -.0513537   .0049463   -10.38   0.000    -.0610723   -.0416352
   Meghalaya  |  -.0082277    .013146    -0.63   0.532     -.034057    .0176016
     Mizoram  |  -.0862988   .0170979    -5.05   0.000    -.1198929   -.0527048
NCT of Delhi  |  -.0097119   .0024406    -3.98   0.000    -.0145072   -.0049167
    Nagaland  |   .0012727   .0169863     0.07   0.940    -.0321022    .0346476
      Orissa  |  -.0382598   .0066584    -5.75   0.000    -.0513422   -.0251773
      Punjab  |   .0008518   .0034688     0.25   0.806    -.0059637    .0076673
   Rajasthan  |  -.0019562   .0032338    -0.60   0.546    -.0083099    .0043975
      Sikkim  |   .0454198   .0114618     3.96   0.000     .0228997      .06794
  Tamil Nadu  |   -.004947   .0033908    -1.46   0.145    -.0116093    .0017153
Uttar Prad..  |  -.0378801   .0050217    -7.54   0.000    -.0477468   -.0280134
 Uttaranchal  |   .0678867   .0145503     4.67   0.000     .0392981    .0964753
 West Bengal  |  -.0288714   .0056808    -5.08   0.000     -.040033   -.0177099
              |
        _cons |  -.0605713   .0103618    -5.85   0.000    -.0809303   -.0402124
-------------------------------------------------------------------------------



Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
          m3 |        520   897.9766   1233.293      27  -2412.586  -2297.733
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.




In [96]:
***************************************************************
* MODEL 4: Unconditional SDM with State FE
***************************************************************
quietly spregress light_growth96_10rcr_cap ///
    log_light96_rcr_cap i.state_encoded, ///
    ml vce(robust) ///
    dvarlag(W6nn) ///
    ivarlag(W6nn: log_light96_rcr_cap i.state_encoded)

eststo m4
estat ic
mat s = r(S)
quietly estadd scalar AIC = s[1,5]
estat impact
matrix _bd = r(b_direct)
matrix _bi = r(b_indirect)
matrix _bt = r(b_total)
matrix _Vd = r(V_direct)
matrix _Vi = r(V_indirect)
matrix _Vt = r(V_total)
scalar m4_d_b  = _bd[1,1]
scalar m4_d_se = sqrt(_Vd[1,1])
scalar m4_i_b  = _bi[1,1]
scalar m4_i_se = sqrt(_Vi[1,1])
scalar m4_t_b  = _bt[1,1]
scalar m4_t_se = sqrt(_Vt[1,1])
scalar m4_aic  = s[1,5]




Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
          m4 |        520          .   1290.758      58  -2465.517  -2218.795
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.




progress   :  3%   7%  10%  14%  17%  21%  24%  28%  31%  34%  38%  41% 
              45%  48%  52%  55%  59%  62%  66%  69%  72%  76%  79%  83% 
              86%  90%  93%  97% 100% 

Average impacts                                 Number of obs     =        520

-------------------------------------------------------------------------------
              |            Delta-Method
              |      dy/dx   std. err.      z    P>|z|     [95% conf. interval]
--------------+----------------------------------------------------------------
direct        |
log_light96~p |  -.0210306   .0016403   -12.82   0.000    -.0242456   -.0178157
              |
state_encoded |
Arunachal ..  |  -.1284176   .0491148    -2.61   0.009    -.2246808   -.0321544
       Bihar  |  -.0040413   .0188871    -0.21   0.831    -.0410593    .0329767
  Chandigarh  |  -.0385778   .0286269    -1.35   0.178    -.0946855    .0175298
Chhattisgarh  |   .0184608   .0141667     1.30   0.193    -.0093055    .0462271
         Goa  |  -.0121066   .0187457    -0.65   0.518    -.0488474    .0246343
     Gujarat  |  -.0180585   .0181642    -0.99   0.320    -.0536597    .0175427
     Haryana  |  -.0301148   .0189201    -1.59   0.111    -.0671974    .0069679
Himachal P..  |   .0005555   .0234854     0.02   0.981     -.045475     .046586
Jammu & Ka..  |   .0216086   .0335716     0.64   0.520    -.0441906    .0874079
   Jharkhand  |   .0241435   .0178146     1.36   0.175    -.0107725    .0590595
   Karnataka  |    -.01251   .0117597    -1.06   0.287    -.0355586    .0105386
      Kerala  |  -.0280297   .0162171    -1.73   0.084    -.0598146    .0037553
Madhya Pra..  |  -.0864383   .0158387    -5.46   0.000    -.1174815    -.055395
 Maharashtra  |  -.0320742   .0145034    -2.21   0.027    -.0605002   -.0036481
     Manipur  |  -.1472409   .0539897    -2.73   0.006    -.2530587   -.0414231
   Meghalaya  |   -.064009   .0416269    -1.54   0.124    -.1455962    .0175782
     Mizoram  |  -.1675677   .0504255    -3.32   0.001    -.2663999   -.0687354
NCT of Delhi  |  -.0250677   .0269846    -0.93   0.353    -.0779566    .0278212
    Nagaland  |  -.1015015   .0487576    -2.08   0.037    -.1970646   -.0059383
      Orissa  |  -.0348394   .0116679    -2.99   0.003    -.0577081   -.0119708
      Punjab  |  -.0312794   .0222706    -1.40   0.160    -.0749291    .0123703
   Rajasthan  |  -.0162078   .0174228    -0.93   0.352    -.0503558    .0179402
      Sikkim  |   .0723896   .0238294     3.04   0.002     .0256848    .1190944
  Tamil Nadu  |  -.0085228   .0153034    -0.56   0.578    -.0385169    .0214714
Uttar Prad..  |  -.0473491   .0169917    -2.79   0.005    -.0806522    -.014046
 Uttaranchal  |  -.0193296   .0221647    -0.87   0.383    -.0627716    .0241124
 West Bengal  |   .0119303   .0203113     0.59   0.557     -.027879    .0517396
--------------+----------------------------------------------------------------
indirect      |
log_light96~p |  -.0012329   .0051973    -0.24   0.812    -.0114194    .0089536
              |
state_encoded |
Arunachal ..  |   .1844607   .0616624     2.99   0.003     .0636046    .3053169
       Bihar  |   -.049815   .0263559    -1.89   0.059    -.1014715    .0018415
  Chandigarh  |   .0007358   .0872141     0.01   0.993    -.1702008    .1716723
Chhattisgarh  |   -.024806   .0247703    -1.00   0.317    -.0733549    .0237429
         Goa  |   .0016832   .0561023     0.03   0.976    -.1082753    .1116418
     Gujarat  |  -.0077293   .0220685    -0.35   0.726    -.0509827    .0355242
     Haryana  |   .0349699    .024144     1.45   0.148    -.0123514    .0822912
Himachal P..  |   .0364206   .0299553     1.22   0.224    -.0222907    .0951319
Jammu & Ka..  |   .0095228   .0389639     0.24   0.807    -.0668451    .0858906
   Jharkhand  |  -.0635272   .0251284    -2.53   0.011     -.112778   -.0142764
   Karnataka  |   .0194319   .0179297     1.08   0.278    -.0157096    .0545735
      Kerala  |   .0080767   .0229127     0.35   0.724    -.0368313    .0529848
Madhya Pra..  |   .0253559   .0205244     1.24   0.217    -.0148713    .0655831
 Maharashtra  |   .0038041   .0208067     0.18   0.855    -.0369763    .0445845
     Manipur  |   .0967733   .0556229     1.74   0.082    -.0122456    .2057921
   Meghalaya  |   .0693696   .0499775     1.39   0.165    -.0285844    .1673236
     Mizoram  |  -.0916962   .0362849    -2.53   0.012    -.1628134   -.0205791
NCT of Delhi  |   .1047618   .0754817     1.39   0.165    -.0431796    .2527033
    Nagaland  |    .095562   .0520278     1.84   0.066    -.0064106    .1975347
      Orissa  |   .0031907   .0176605     0.18   0.857    -.0314233    .0378047
      Punjab  |   .0339701   .0270717     1.25   0.210    -.0190895    .0870298
   Rajasthan  |   .0147603   .0227488     0.65   0.516    -.0298265    .0593472
      Sikkim  |   .0084879   .0452911     0.19   0.851    -.0802811     .097257
  Tamil Nadu  |   .0033498   .0203184     0.16   0.869    -.0364735     .043173
Uttar Prad..  |   .0059958    .021906     0.27   0.784    -.0369392    .0489308
 Uttaranchal  |   .1131612    .029109     3.89   0.000     .0561087    .1702138
 West Bengal  |  -.0396766   .0259965    -1.53   0.127    -.0906289    .0112757
--------------+----------------------------------------------------------------
total         |
log_light96~p |  -.0222635   .0053557    -4.16   0.000    -.0327605   -.0117666
              |
state_encoded |
Arunachal ..  |   .0560431   .0297052     1.89   0.059     -.002178    .1142643
       Bihar  |  -.0538563   .0178343    -3.02   0.003    -.0888108   -.0189018
  Chandigarh  |  -.0378421   .0934389    -0.40   0.685    -.2209789    .1452947
Chhattisgarh  |  -.0063452   .0175365    -0.36   0.717    -.0407162    .0280257
         Goa  |  -.0104233   .0556467    -0.19   0.851    -.1194889    .0986422
     Gujarat  |  -.0257878   .0111641    -2.31   0.021    -.0476689   -.0039066
     Haryana  |   .0048552   .0137039     0.35   0.723     -.022004    .0317143
Himachal P..  |   .0369761   .0162674     2.27   0.023     .0050926    .0688597
Jammu & Ka..  |   .0311314   .0206025     1.51   0.131    -.0092488    .0715117
   Jharkhand  |  -.0393837   .0166336    -2.37   0.018     -.071985   -.0067824
   Karnataka  |    .006922   .0121682     0.57   0.569    -.0169274    .0307713
      Kerala  |  -.0199529   .0147018    -1.36   0.175    -.0487678     .008862
Madhya Pra..  |  -.0610824   .0106939    -5.71   0.000    -.0820421   -.0401226
 Maharashtra  |  -.0282701   .0117898    -2.40   0.016    -.0513777   -.0051625
     Manipur  |  -.0504676    .016522    -3.05   0.002      -.08285   -.0180852
   Meghalaya  |   .0053606   .0188183     0.28   0.776    -.0315226    .0422438
     Mizoram  |  -.2592639   .0818622    -3.17   0.002    -.4197109   -.0988169
NCT of Delhi  |   .0796941    .082771     0.96   0.336    -.0825342    .2419224
    Nagaland  |  -.0059394   .0228107    -0.26   0.795    -.0506476    .0387688
      Orissa  |  -.0316488   .0129031    -2.45   0.014    -.0569384   -.0063591
      Punjab  |   .0026908    .013528     0.20   0.842    -.0238237    .0292052
   Rajasthan  |  -.0014475   .0120391    -0.12   0.904    -.0250438    .0221488
      Sikkim  |   .0808775    .038215     2.12   0.034     .0059775    .1557776
  Tamil Nadu  |   -.005173   .0117162    -0.44   0.659    -.0281363    .0177903
Uttar Prad..  |  -.0413533   .0123487    -3.35   0.001    -.0655563   -.0171502
 Uttaranchal  |   .0938316   .0171047     5.49   0.000     .0603071    .1273561
 West Bengal  |  -.0277463   .0143079    -1.94   0.052    -.0557892    .0002965
-------------------------------------------------------------------------------












3.2 Conditional Models

These models test for conditional (beta) convergence — whether districts converge after controlling for structural differences in terrain, climate, demographics, infrastructure, and human capital.

The 16 controls stored in $controls include: - Geography: soil suitability, rainfall, malaria risk, temperature, ruggedness, distance to coast, latitude - Demographics: rural share, population density, SC/ST shares, worker participation - Human capital: literacy rate, higher education share - Infrastructure: electrification rate, pucca (paved) road density

Models 5–8 mirror Models 1–4 but include these controls: - Model 5 (OLS): Conditional convergence - Model 6 (SDM): Conditional with spatial spillovers - Model 7 (OLS + State FE): Conditional with state fixed effects - Model 8 (SDM + State FE): Full model — the preferred specification

In [97]:
*------------------------------------------------------------------------------
* (3.2) Conditional Models
*     - Models that include the controls stored in $controls
*------------------------------------------------------------------------------

***************************************************************
* MODEL 5: Conditional OLS
***************************************************************
regress light_growth96_10rcr_cap ///
    log_light96_rcr_cap ///
    $controls, robust

eststo m5
estat ic
mat s = r(S)
quietly estadd scalar AIC = s[1,5]
scalar m5_d_b  = _b[log_light96_rcr_cap]
scalar m5_d_se = _se[log_light96_rcr_cap]
scalar m5_aic  = s[1,5]


Linear regression                               Number of obs     =        520
                                                F(17, 502)        =      26.59
                                                Prob > F          =     0.0000
                                                R-squared         =     0.5797
                                                Root MSE          =     .02839

-------------------------------------------------------------------------------
              |               Robust
light_growt~p | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
--------------+----------------------------------------------------------------
log_light96~p |  -.0246757   .0031661    -7.79   0.000    -.0308961   -.0184554
suit_mean_snd |  -.0311005   .0069184    -4.50   0.000    -.0446932   -.0175078
rain_mean_snd |  -1.73e-06   2.07e-06    -0.84   0.402    -5.80e-06    2.33e-06
mala_mean_snd |    .001687   .0062859     0.27   0.789    -.0106629    .0140368
temp_mean_snd |  -.0009033   .0008134    -1.11   0.267    -.0025014    .0006948
 rug_mean_snd |   .0097749    .002244     4.36   0.000     .0053662    .0141837
     distance |   .0016295    .000791     2.06   0.040     .0000755    .0031835
     latitude |  -.0008772   .0003964    -2.21   0.027    -.0016559   -.0000984
rur_percent~r |  -.0336475   .0120157    -2.80   0.005    -.0572547   -.0100403
log_tot_den~r |   -.003651   .0021713    -1.68   0.093     -.007917     .000615
 sc_percent96 |   .0222248   .0185135     1.20   0.231    -.0141487    .0585982
 st_percent96 |  -.0265269   .0098243    -2.70   0.007    -.0458288    -.007225
workp_perc~96 |   .0492894   .0246648     2.00   0.046     .0008305    .0977482
lit_percent96 |   .0560845   .0192488     2.91   0.004     .0182663    .0939026
higheredu_p~6 |  -.0841233   .0616881    -1.36   0.173    -.2053219    .0370753
elechh_per~96 |  -.0080172   .0095643    -0.84   0.402    -.0268082    .0107739
log_puccaro~s |   .0109411   .0020347     5.38   0.000     .0069434    .0149387
        _cons |  -.0782869   .0434198    -1.80   0.072    -.1635939    .0070201
-------------------------------------------------------------------------------



Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
          m5 |        520   897.9766   1123.335      18  -2210.669    -2134.1
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.




In [98]:
***************************************************************
* MODEL 6: Conditional SDM
***************************************************************
quietly spregress light_growth96_10rcr_cap ///
    log_light96_rcr_cap ///
    $controls, ///
    ml vce(robust) ///
    dvarlag(W6nn) ///
    ivarlag(W6nn: log_light96_rcr_cap $controls)

eststo m6
estat ic
mat s = r(S)
quietly estadd scalar AIC = s[1,5]
estat impact
matrix _bd = r(b_direct)
matrix _bi = r(b_indirect)
matrix _bt = r(b_total)
matrix _Vd = r(V_direct)
matrix _Vi = r(V_indirect)
matrix _Vt = r(V_total)
scalar m6_d_b  = _bd[1,1]
scalar m6_d_se = sqrt(_Vd[1,1])
scalar m6_i_b  = _bi[1,1]
scalar m6_i_se = sqrt(_Vi[1,1])
scalar m6_t_b  = _bt[1,1]
scalar m6_t_se = sqrt(_Vt[1,1])
scalar m6_aic  = s[1,5]




Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
          m6 |        520          .   1214.892      37  -2355.783  -2198.392
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.




progress   :  6%  12%  18%  24%  29%  35%  41%  47%  53%  59%  65%  71% 
              76%  82%  88%  94% 100% 

Average impacts                                 Number of obs     =        520

-------------------------------------------------------------------------------
              |            Delta-Method
              |      dy/dx   std. err.      z    P>|z|     [95% conf. interval]
--------------+----------------------------------------------------------------
direct        |
log_light96~p |  -.0257853   .0022386   -11.52   0.000    -.0301729   -.0213978
suit_mean_snd |   .0004923   .0150898     0.03   0.974    -.0290831    .0300677
rain_mean_snd |  -4.24e-06   3.49e-06    -1.22   0.224    -.0000111    2.59e-06
mala_mean_snd |   .0027316   .0043327     0.63   0.528    -.0057604    .0112237
temp_mean_snd |   .0026584   .0009274     2.87   0.004     .0008407     .004476
 rug_mean_snd |   .0086757   .0019086     4.55   0.000     .0049348    .0124165
     distance |   .0070475   .0057297     1.23   0.219    -.0041825    .0182776
     latitude |   .0045114    .005309     0.85   0.395     -.005894    .0149169
rur_percent~r |  -.0013215   .0117347    -0.11   0.910    -.0243212    .0216781
log_tot_den~r |   -.001078   .0018684    -0.58   0.564    -.0047401    .0025841
 sc_percent96 |   .0021086   .0217961     0.10   0.923     -.040611    .0448282
 st_percent96 |  -.0229311   .0099785    -2.30   0.022    -.0424887   -.0033736
workp_perc~96 |   .0076402   .0233941     0.33   0.744    -.0382115    .0534919
lit_percent96 |   .0433536   .0205727     2.11   0.035     .0030319    .0836753
higheredu_p~6 |  -.0050537   .0638691    -0.08   0.937    -.1302348    .1201274
elechh_per~96 |   -.002155   .0106781    -0.20   0.840    -.0230837    .0187737
log_puccaro~s |   .0083759    .001613     5.19   0.000     .0052144    .0115373
--------------+----------------------------------------------------------------
indirect      |
log_light96~p |  -.0154817   .0079342    -1.95   0.051    -.0310325    .0000691
suit_mean_snd |  -.0766954   .0264004    -2.91   0.004    -.1284392   -.0249516
rain_mean_snd |   1.59e-06   7.68e-06     0.21   0.836    -.0000135    .0000166
mala_mean_snd |  -.0057148   .0175956    -0.32   0.745    -.0402015     .028772
temp_mean_snd |  -.0079717   .0028039    -2.84   0.004    -.0134672   -.0024762
 rug_mean_snd |   -.003614   .0063819    -0.57   0.571    -.0161223    .0088944
     distance |  -.0079413   .0063199    -1.26   0.209    -.0203281    .0044454
     latitude |  -.0061021   .0054721    -1.12   0.265    -.0168273    .0046231
rur_percent~r |  -.1711657   .0391033    -4.38   0.000    -.2478067   -.0945247
log_tot_den~r |  -.0167782    .005599    -3.00   0.003     -.027752   -.0058044
 sc_percent96 |    .110434   .0582661     1.90   0.058    -.0037654    .2246334
 st_percent96 |   .0010142   .0225631     0.04   0.964    -.0432087     .045237
workp_perc~96 |   .0773574   .0748111     1.03   0.301    -.0692697    .2239846
lit_percent96 |   .0423349    .050394     0.84   0.401    -.0564355    .1411054
higheredu_p~6 |  -.2230297   .2002694    -1.11   0.265    -.6155506    .1694911
elechh_per~96 |  -.0081774   .0269202    -0.30   0.761      -.06094    .0445853
log_puccaro~s |   .0090947   .0055232     1.65   0.100    -.0017305      .01992
--------------+----------------------------------------------------------------
total         |
log_light96~p |  -.0412671   .0083865    -4.92   0.000    -.0577043   -.0248298
suit_mean_snd |  -.0762031   .0189725    -4.02   0.000    -.1133885   -.0390177
rain_mean_snd |  -2.65e-06   6.59e-06    -0.40   0.687    -.0000156    .0000103
mala_mean_snd |  -.0029831   .0188175    -0.16   0.874    -.0398648    .0338986
temp_mean_snd |  -.0053134    .002716    -1.96   0.050    -.0106366    9.82e-06
 rug_mean_snd |   .0050617   .0062484     0.81   0.418     -.007185    .0173084
     distance |  -.0008938   .0018044    -0.50   0.620    -.0044304    .0026428
     latitude |  -.0015907   .0010688    -1.49   0.137    -.0036856    .0005042
rur_percent~r |  -.1724872   .0411126    -4.20   0.000    -.2530665    -.091908
log_tot_den~r |  -.0178562   .0057767    -3.09   0.002    -.0291784    -.006534
 sc_percent96 |   .1125425    .057817     1.95   0.052    -.0007766    .2258617
 st_percent96 |   -.021917   .0206264    -1.06   0.288    -.0623441    .0185101
workp_perc~96 |   .0849977   .0763112     1.11   0.265    -.0645696    .2345649
lit_percent96 |   .0856886   .0476749     1.80   0.072    -.0077526    .1791297
higheredu_p~6 |  -.2280834   .2106631    -1.08   0.279    -.6409754    .1848086
elechh_per~96 |  -.0103324   .0269909    -0.38   0.702    -.0632336    .0425688
log_puccaro~s |   .0174706   .0059118     2.96   0.003     .0058837    .0290575
-------------------------------------------------------------------------------












In [99]:
***************************************************************
* MODEL 7: Conditional OLS with State FE
***************************************************************
regress light_growth96_10rcr_cap ///
    log_light96_rcr_cap ///
    $controls ///
    i.state_encoded, robust

eststo m7
estat ic
mat s = r(S)
quietly estadd scalar AIC = s[1,5]
scalar m7_d_b  = _b[log_light96_rcr_cap]
scalar m7_d_se = _se[log_light96_rcr_cap]
scalar m7_aic  = s[1,5]


Linear regression                               Number of obs     =        520
                                                F(42, 475)        =          .
                                                Prob > F          =          .
                                                R-squared         =     0.7677
                                                Root MSE          =      .0217

-------------------------------------------------------------------------------
              |               Robust
light_growt~p | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
--------------+----------------------------------------------------------------
log_light96~p |  -.0246248   .0028208    -8.73   0.000    -.0301675   -.0190821
suit_mean_snd |  -.0197893   .0078754    -2.51   0.012    -.0352643   -.0043143
rain_mean_snd |  -5.63e-07   1.96e-06    -0.29   0.774    -4.42e-06    3.29e-06
mala_mean_snd |  -.0065129   .0056121    -1.16   0.246    -.0175405    .0045147
temp_mean_snd |    .000296   .0007971     0.37   0.711    -.0012703    .0018623
 rug_mean_snd |   .0054988   .0025078     2.19   0.029      .000571    .0104266
     distance |   .0051996   .0012075     4.31   0.000      .002827    .0075723
     latitude |  -.0012537   .0008799    -1.42   0.155    -.0029826    .0004752
rur_percent~r |   .0045767   .0106276     0.43   0.667    -.0163063    .0254596
log_tot_den~r |  -.0010032   .0020494    -0.49   0.625    -.0050302    .0030239
 sc_percent96 |   .0016616   .0181271     0.09   0.927    -.0339577    .0372809
 st_percent96 |  -.0116412   .0100202    -1.16   0.246    -.0313306    .0080482
workp_perc~96 |   .0004791   .0226258     0.02   0.983    -.0439799     .044938
lit_percent96 |   .0431785   .0166937     2.59   0.010     .0103758    .0759811
higheredu_p~6 |   -.027215    .069169    -0.39   0.694    -.1631301    .1087001
elechh_per~96 |   .0197723   .0102446     1.93   0.054     -.000358    .0399026
log_puccaro~s |   .0047918   .0017194     2.79   0.006     .0014133    .0081703
              |
state_encoded |
Arunachal ..  |  -.0164632   .0142307    -1.16   0.248    -.0444261    .0114997
       Bihar  |  -.0334616   .0105965    -3.16   0.002    -.0542833   -.0126398
  Chandigarh  |  -.0303966     .01243    -2.45   0.015    -.0548212    -.005972
Chhattisgarh  |   .0077936   .0082297     0.95   0.344    -.0083776    .0239647
         Goa  |  -.0146177   .0100695    -1.45   0.147     -.034404    .0051686
     Gujarat  |  -.0202791   .0075227    -2.70   0.007     -.035061   -.0054972
     Haryana  |  -.0282083   .0098087    -2.88   0.004    -.0474822   -.0089344
Himachal P..  |  -.0210603   .0149824    -1.41   0.160    -.0505003    .0083798
Jammu & Ka..  |  -.0200735   .0194409    -1.03   0.302    -.0582743    .0181273
   Jharkhand  |  -.0113534   .0103155    -1.10   0.272    -.0316232    .0089163
   Karnataka  |  -.0068925   .0044592    -1.55   0.123    -.0156548    .0018698
      Kerala  |  -.0394251   .0102125    -3.86   0.000    -.0594923   -.0193579
Madhya Pra..  |  -.0741307   .0074878    -9.90   0.000    -.0888439   -.0594174
 Maharashtra  |  -.0380298   .0040551    -9.38   0.000     -.045998   -.0300616
     Manipur  |  -.0543724   .0098463    -5.52   0.000    -.0737201   -.0350247
   Meghalaya  |   .0134044   .0162281     0.83   0.409    -.0184833     .045292
     Mizoram  |  -.0777501   .0178136    -4.36   0.000    -.1127534   -.0427468
NCT of Delhi  |  -.0349851   .0113016    -3.10   0.002    -.0571924   -.0127777
    Nagaland  |  -.0097482   .0201028    -0.48   0.628    -.0492497    .0297532
      Orissa  |  -.0210568   .0077495    -2.72   0.007    -.0362843   -.0058294
      Punjab  |  -.0345914   .0116721    -2.96   0.003    -.0575267   -.0116561
   Rajasthan  |  -.0089162   .0078661    -1.13   0.258     -.024373    .0065405
      Sikkim  |   .0094498   .0169401     0.56   0.577     -.023837    .0427367
  Tamil Nadu  |   -.014783   .0056946    -2.60   0.010    -.0259727   -.0035932
Uttar Prad..  |   -.048089    .008082    -5.95   0.000    -.0639699   -.0322081
 Uttaranchal  |   .0122098   .0151852     0.80   0.422    -.0176286    .0420483
 West Bengal  |    -.00786   .0090273    -0.87   0.384    -.0255984    .0098784
              |
        _cons |  -.1070367   .0398034    -2.69   0.007    -.1852492   -.0288243
-------------------------------------------------------------------------------



Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
          m7 |        520   897.9766    1277.54      43  -2469.079  -2286.164
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.




In [100]:
***************************************************************
* MODEL 8: Conditional SDM with State FE
***************************************************************
quietly spregress light_growth96_10rcr_cap ///
    log_light96_rcr_cap ///
    $controls ///
    i.state_encoded, ///
    ml vce(robust) ///
    dvarlag(W6nn) ///
    ivarlag(W6nn: ///
        log_light96_rcr_cap ///
        $controls ///
        i.state_encoded)

eststo m8
estat ic
mat s = r(S)
quietly estadd scalar AIC = s[1,5]
estat impact
matrix _bd = r(b_direct)
matrix _bi = r(b_indirect)
matrix _bt = r(b_total)
matrix _Vd = r(V_direct)
matrix _Vi = r(V_indirect)
matrix _Vt = r(V_total)
scalar m8_d_b  = _bd[1,1]
scalar m8_d_se = sqrt(_Vd[1,1])
scalar m8_i_b  = _bi[1,1]
scalar m8_i_se = sqrt(_Vi[1,1])
scalar m8_t_b  = _bt[1,1]
scalar m8_t_se = sqrt(_Vt[1,1])
scalar m8_aic  = s[1,5]




Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
          m8 |        520          .   1339.461      90  -2498.922  -2116.077
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.




progress   :  2%   4%   7%   9%  11%  13%  16%  18%  20%  22%  24%  27% 
              29%  31%  33%  36%  38%  40%  42%  44%  47%  49%  51%  53% 
              56%  58%  60%  62%  64%  67%  69%  71%  73%  76%  78%  80% 
              82%  84%  87%  89%  91%  93%  96%  98% 100% 

Average impacts                                 Number of obs     =        520

-------------------------------------------------------------------------------
              |            Delta-Method
              |      dy/dx   std. err.      z    P>|z|     [95% conf. interval]
--------------+----------------------------------------------------------------
direct        |
log_light96~p |  -.0247397   .0020104   -12.31   0.000    -.0286801   -.0207993
suit_mean_snd |   .0086393   .0141667     0.61   0.542     -.019127    .0364056
rain_mean_snd |  -3.12e-06   3.35e-06    -0.93   0.351    -9.68e-06    3.44e-06
mala_mean_snd |  -.0021732   .0054213    -0.40   0.689    -.0127987    .0084523
temp_mean_snd |   .0022809   .0008888     2.57   0.010     .0005388    .0040229
 rug_mean_snd |   .0054354   .0020288     2.68   0.007     .0014591    .0094117
     distance |  -.0009921   .0054613    -0.18   0.856     -.011696    .0097118
     latitude |   .0054878   .0048623     1.13   0.259    -.0040422    .0150177
rur_percent~r |   .0190718   .0110204     1.73   0.084    -.0025277    .0406714
log_tot_den~r |  -.0012611   .0018465    -0.68   0.495    -.0048802    .0023581
 sc_percent96 |   .0099777   .0207295     0.48   0.630    -.0306513    .0506068
 st_percent96 |   -.017603   .0096611    -1.82   0.068    -.0365384    .0013324
workp_perc~96 |  -.0130344   .0212344    -0.61   0.539    -.0546531    .0285843
lit_percent96 |  -.0078746    .019896    -0.40   0.692    -.0468701    .0311209
higheredu_p~6 |   .1678238   .0661546     2.54   0.011     .0381632    .2974843
elechh_per~96 |   .0056616   .0112211     0.50   0.614    -.0163313    .0276546
log_puccaro~s |   .0058611   .0015308     3.83   0.000     .0028608    .0088614
              |
state_encoded |
Arunachal ..  |  -.1727082    .058026    -2.98   0.003    -.2864371   -.0589793
       Bihar  |   .0063386     .01859     0.34   0.733    -.0300971    .0427743
  Chandigarh  |  -.0205183   .0285897    -0.72   0.473     -.076553    .0355164
Chhattisgarh  |   .0248744   .0140802     1.77   0.077    -.0027223    .0524711
         Goa  |  -.0324612   .0191507    -1.70   0.090     -.069996    .0050735
     Gujarat  |    -.02401     .01755    -1.37   0.171    -.0584074    .0103874
     Haryana  |   -.031256   .0185022    -1.69   0.091    -.0675196    .0050076
Himachal P..  |  -.0043131   .0238283    -0.18   0.856    -.0510157    .0423895
Jammu & Ka..  |  -.0182355   .0415786    -0.44   0.661    -.0997282    .0632571
   Jharkhand  |   .0207052   .0172498     1.20   0.230    -.0131039    .0545142
   Karnataka  |  -.0176847   .0114458    -1.55   0.122     -.040118    .0047486
      Kerala  |  -.0248471   .0166924    -1.49   0.137    -.0575636    .0078694
Madhya Pra..  |  -.0784834   .0158375    -4.96   0.000    -.1095244   -.0474424
 Maharashtra  |  -.0375999   .0139216    -2.70   0.007    -.0648857   -.0103141
     Manipur  |  -.1968156   .0650658    -3.02   0.002    -.3243422    -.069289
   Meghalaya  |    -.06425   .0521586    -1.23   0.218    -.1664791     .037979
     Mizoram  |   -.167577   .0637726    -2.63   0.009     -.292569    -.042585
NCT of Delhi  |  -.0361401   .0265458    -1.36   0.173     -.088169    .0158887
    Nagaland  |  -.1440312   .0594033    -2.42   0.015    -.2604596   -.0276028
      Orissa  |  -.0305524   .0120926    -2.53   0.012    -.0542535   -.0068512
      Punjab  |  -.0366983   .0219989    -1.67   0.095    -.0798154    .0064187
   Rajasthan  |   -.011015   .0172283    -0.64   0.523    -.0447819    .0227519
      Sikkim  |   .0740796    .024936     2.97   0.003     .0252059    .1229534
  Tamil Nadu  |  -.0003747   .0148385    -0.03   0.980    -.0294576    .0287082
Uttar Prad..  |   -.047913   .0167244    -2.86   0.004    -.0806922   -.0151339
 Uttaranchal  |  -.0253071   .0225835    -1.12   0.262    -.0695698    .0189557
 West Bengal  |   .0165069    .019542     0.84   0.398    -.0217946    .0548084
--------------+----------------------------------------------------------------
indirect      |
log_light96~p |  -.0123926   .0067116    -1.85   0.065     -.025547    .0007618
suit_mean_snd |  -.0534302   .0263199    -2.03   0.042    -.1050163   -.0018441
rain_mean_snd |   3.94e-06   6.88e-06     0.57   0.567    -9.55e-06    .0000174
mala_mean_snd |   -.056909   .0205235    -2.77   0.006    -.0971342   -.0166837
temp_mean_snd |  -.0119643    .002752    -4.35   0.000    -.0173582   -.0065704
 rug_mean_snd |  -.0272719    .006786    -4.02   0.000    -.0405723   -.0139715
     distance |    .004771   .0065954     0.72   0.469    -.0081558    .0176978
     latitude |  -.0094677    .005779    -1.64   0.101    -.0207943    .0018589
rur_percent~r |  -.0446695   .0357358    -1.25   0.211    -.1147103    .0253714
log_tot_den~r |   -.005159   .0056903    -0.91   0.365    -.0163118    .0059939
 sc_percent96 |  -.0112732   .0574145    -0.20   0.844    -.1238036    .1012572
 st_percent96 |  -.0069686   .0219095    -0.32   0.750    -.0499105    .0359732
workp_perc~96 |   .0431481   .0576514     0.75   0.454    -.0698466    .1561428
lit_percent96 |   .0541814   .0493807     1.10   0.273    -.0426029    .1509658
higheredu_p~6 |   .0356402   .2192163     0.16   0.871    -.3940158    .4652963
elechh_per~96 |    .005632   .0278545     0.20   0.840    -.0489618    .0602257
log_puccaro~s |  -.0042321   .0048842    -0.87   0.386     -.013805    .0053408
              |
state_encoded |
Arunachal ..  |   .1913607   .0694748     2.75   0.006     .0551926    .3275287
       Bihar  |  -.0720964   .0318292    -2.27   0.024    -.1344805   -.0097123
  Chandigarh  |   .0101011    .078798     0.13   0.898    -.1443402    .1645423
Chhattisgarh  |   -.041586   .0249839    -1.66   0.096    -.0905535    .0073815
         Goa  |  -.0219891   .0534119    -0.41   0.681    -.1266745    .0826963
     Gujarat  |   .0000112   .0260265     0.00   1.000    -.0509998    .0510223
     Haryana  |   .0094065   .0344984     0.27   0.785    -.0582092    .0770223
Himachal P..  |   .0102717   .0498384     0.21   0.837    -.0874098    .1079532
Jammu & Ka..  |  -.0401784   .0577047    -0.70   0.486    -.1532776    .0729207
   Jharkhand  |  -.0516581   .0280791    -1.84   0.066    -.1066921    .0033759
   Karnataka  |  -.0153421   .0190839    -0.80   0.421    -.0527458    .0220615
      Kerala  |  -.0425186   .0327988    -1.30   0.195    -.1068031     .021766
Madhya Pra..  |   .0080904   .0251664     0.32   0.748    -.0412348    .0574156
 Maharashtra  |   .0022755   .0202726     0.11   0.911    -.0374582    .0420091
     Manipur  |   .1524688   .0690614     2.21   0.027     .0171109    .2878267
   Meghalaya  |   .1327018    .062862     2.11   0.035     .0094946     .255909
     Mizoram  |  -.0403569   .0230715    -1.75   0.080    -.0855762    .0048624
NCT of Delhi  |  -.0077924   .0724964    -0.11   0.914    -.1498828     .134298
    Nagaland  |   .1688217   .0653415     2.58   0.010     .0407547    .2968887
      Orissa  |    .013598    .021072     0.65   0.519    -.0277023    .0548984
      Punjab  |    .005097   .0394087     0.13   0.897    -.0721425    .0823366
   Rajasthan  |   .0045454   .0284462     0.16   0.873    -.0512081    .0602989
      Sikkim  |  -.0243743   .0579395    -0.42   0.674    -.1379337    .0891851
  Tamil Nadu  |  -.0208855   .0238289    -0.88   0.381    -.0675894    .0258183
Uttar Prad..  |  -.0082688   .0271926    -0.30   0.761    -.0615653    .0450277
 Uttaranchal  |   .0878414   .0465595     1.89   0.059    -.0034135    .1790963
 West Bengal  |  -.0347074    .032556    -1.07   0.286    -.0985159    .0291011
--------------+----------------------------------------------------------------
total         |
log_light96~p |  -.0371323   .0071402    -5.20   0.000     -.051127   -.0231377
suit_mean_snd |  -.0447909   .0207982    -2.15   0.031    -.0855546   -.0040271
rain_mean_snd |   8.24e-07   5.84e-06     0.14   0.888    -.0000106    .0000123
mala_mean_snd |  -.0590821   .0230091    -2.57   0.010    -.1041792   -.0139851
temp_mean_snd |  -.0096834   .0026546    -3.65   0.000    -.0148863   -.0044806
 rug_mean_snd |  -.0218365   .0071902    -3.04   0.002    -.0359289    -.007744
     distance |   .0037789   .0025625     1.47   0.140    -.0012434    .0088012
     latitude |  -.0039799    .002472    -1.61   0.107    -.0088249     .000865
rur_percent~r |  -.0255976   .0382976    -0.67   0.504    -.1006596    .0494643
log_tot_den~r |    -.00642   .0060774    -1.06   0.291    -.0183315    .0054915
 sc_percent96 |  -.0012955   .0558818    -0.02   0.982    -.1108217    .1082307
 st_percent96 |  -.0245716   .0201863    -1.22   0.224    -.0641361    .0149929
workp_perc~96 |   .0301137   .0571261     0.53   0.598    -.0818514    .1420788
lit_percent96 |   .0463068   .0459488     1.01   0.314    -.0437512    .1363649
higheredu_p~6 |    .203464   .2389536     0.85   0.395    -.2648764    .6718044
elechh_per~96 |   .0112936   .0279571     0.40   0.686    -.0435012    .0660885
log_puccaro~s |    .001629   .0053403     0.31   0.760    -.0088378    .0120959
              |
state_encoded |
Arunachal ..  |   .0186525   .0386619     0.48   0.629    -.0571234    .0944283
       Bihar  |  -.0657578   .0261175    -2.52   0.012    -.1169472   -.0145684
  Chandigarh  |  -.0104172   .0829203    -0.13   0.900    -.1729381    .1521036
Chhattisgarh  |  -.0167116   .0191549    -0.87   0.383    -.0542545    .0208313
         Goa  |  -.0544503   .0546082    -1.00   0.319    -.1614803    .0525797
     Gujarat  |  -.0239988   .0187793    -1.28   0.201    -.0608056    .0128079
     Haryana  |  -.0218494   .0291041    -0.75   0.453    -.0788924    .0351936
Himachal P..  |   .0059586   .0451429     0.13   0.895    -.0825199    .0944371
Jammu & Ka..  |   -.058414   .0472137    -1.24   0.216     -.150951    .0341231
   Jharkhand  |  -.0309529   .0218027    -1.42   0.156    -.0736855    .0117797
   Karnataka  |  -.0330268   .0144113    -2.29   0.022    -.0612725   -.0047812
      Kerala  |  -.0673656   .0294654    -2.29   0.022    -.1251169   -.0096144
Madhya Pra..  |   -.070393   .0190285    -3.70   0.000    -.1076883   -.0330978
 Maharashtra  |  -.0353244   .0130346    -2.71   0.007    -.0608718    -.009777
     Manipur  |  -.0443468   .0307849    -1.44   0.150    -.1046841    .0159906
   Meghalaya  |   .0684518   .0408231     1.68   0.094    -.0115601    .1484637
     Mizoram  |  -.2079339   .0811735    -2.56   0.010    -.3670311   -.0488367
NCT of Delhi  |  -.0439326   .0788152    -0.56   0.577    -.1984075    .1105424
    Nagaland  |   .0247905   .0388317     0.64   0.523    -.0513181    .1008991
      Orissa  |  -.0169543   .0181866    -0.93   0.351    -.0525993    .0186907
      Punjab  |  -.0316013   .0325433    -0.97   0.332    -.0953849    .0321824
   Rajasthan  |  -.0064696   .0224977    -0.29   0.774    -.0505643    .0376251
      Sikkim  |   .0497053   .0550196     0.90   0.366    -.0581312    .1575418
  Tamil Nadu  |  -.0212602   .0170584    -1.25   0.213    -.0546941    .0121736
Uttar Prad..  |  -.0561818   .0206838    -2.72   0.007    -.0967214   -.0156422
 Uttaranchal  |   .0625343   .0414291     1.51   0.131    -.0186652    .1437339
 West Bengal  |  -.0182005   .0262839    -0.69   0.489    -.0697161    .0333151
-------------------------------------------------------------------------------












4. Compile Results Table

This section builds a formatted summary table from the scalars saved after each model estimation. The approach avoids re-running the computationally expensive estat impact commands.

How it works:

  1. _fmt_coef program — A helper that takes a coefficient and its standard error, computes a z-statistic, and returns a formatted string with significance stars (*** p<0.01, ** p<0.05, * p<0.10)

  2. Cell formatting loops — Iterates over OLS models (direct = coefficient, indirect = n/a) and SDM models (direct/indirect/total from estat impact results)

  3. Output — The table is both displayed in the Stata log and written to a markdown file at c04_spillover_modeling_table.md

In [101]:
/*==============================================================================
   4. COMPILE RESULTS TABLE
   ======================================
   Purpose:
   - Build a formatted convergence table from stored scalars
   - Display in log and write to markdown file
   - Columns: 4 model pairs (OLS vs SDM)
   - Rows: Direct, Indirect, Total effects + Controls/FE/AIC
==============================================================================*/

*----------------------------------------------------------------------
* (4.1) Helper program: format coefficient + significance stars
*----------------------------------------------------------------------
capture program drop _fmt_coef
program define _fmt_coef, rclass
    syntax, b(real) se(real)
    local z = abs(`b'/`se')
    local p = 2*(1 - normal(`z'))
    local stars ""
    if `p' < 0.01      local stars "***"
    else if `p' < 0.05 local stars "**"
    else if `p' < 0.10 local stars "*"
    local coef : display %6.3f `b'
    local coef = strtrim("`coef'")
    local se_f : display %5.3f `se'
    local se_f = strtrim("`se_f'")
    return local out   "`coef'`stars'"
    return local se_out "(`se_f')"
end

*----------------------------------------------------------------------
* (4.2) Format all table cells into local macros
*----------------------------------------------------------------------

* --- OLS models (m1, m3, m5, m7): direct = coefficient, no indirect ---
foreach m in 1 3 5 7 {
    local _b = scalar(m`m'_d_b)
    local _se = scalar(m`m'_d_se)
    _fmt_coef, b(`_b') se(`_se')
    local d`m'  "`r(out)'"
    local ds`m' "`r(se_out)'"
    * Total = Direct for OLS
    local t`m'  "`r(out)'"
    local ts`m' "`r(se_out)'"
    * Indirect not applicable
    local i`m'  "--"
    local is`m' ""
}

* --- SDM models (m2, m4, m6, m8): direct/indirect/total from impacts ---
foreach m in 2 4 6 8 {
    local _b = scalar(m`m'_d_b)
    local _se = scalar(m`m'_d_se)
    _fmt_coef, b(`_b') se(`_se')
    local d`m'  "`r(out)'"
    local ds`m' "`r(se_out)'"

    local _b = scalar(m`m'_i_b)
    local _se = scalar(m`m'_i_se)
    _fmt_coef, b(`_b') se(`_se')
    local i`m'  "`r(out)'"
    local is`m' "`r(se_out)'"

    local _b = scalar(m`m'_t_b)
    local _se = scalar(m`m'_t_se)
    _fmt_coef, b(`_b') se(`_se')
    local t`m'  "`r(out)'"
    local ts`m' "`r(se_out)'"
}

* --- AIC values (rounded to integer) ---
foreach m in 1 2 3 4 5 6 7 8 {
    local aic`m' : display %7.0f scalar(m`m'_aic)
    local aic`m' = strtrim("`aic`m''")
}

*----------------------------------------------------------------------
* (4.3) Display formatted table in log
*----------------------------------------------------------------------
display _n(2)
display "Table: Unconditional and conditional convergence across districts"
display "{hline 90}"
display %10s "Effect"   %11s "OLS" %11s "SDM" %11s "OLS" %11s "SDM" %11s "OLS" %11s "SDM" %11s "OLS" %11s "SDM"
display %10s ""         %11s "(1)" %11s "(2)" %11s "(3)" %11s "(4)" %11s "(5)" %11s "(6)" %11s "(7)" %11s "(8)"
display "{hline 90}"
display %10s "Direct"   %11s "`d1'" %11s "`d2'" %11s "`d3'" %11s "`d4'" %11s "`d5'" %11s "`d6'" %11s "`d7'" %11s "`d8'"
display %10s ""         %11s "`ds1'" %11s "`ds2'" %11s "`ds3'" %11s "`ds4'" %11s "`ds5'" %11s "`ds6'" %11s "`ds7'" %11s "`ds8'"
display %10s "Indirect" %11s "`i1'" %11s "`i2'" %11s "`i3'" %11s "`i4'" %11s "`i5'" %11s "`i6'" %11s "`i7'" %11s "`i8'"
display %10s ""         %11s "`is1'" %11s "`is2'" %11s "`is3'" %11s "`is4'" %11s "`is5'" %11s "`is6'" %11s "`is7'" %11s "`is8'"
display %10s "Total"    %11s "`t1'" %11s "`t2'" %11s "`t3'" %11s "`t4'" %11s "`t5'" %11s "`t6'" %11s "`t7'" %11s "`t8'"
display %10s ""         %11s "`ts1'" %11s "`ts2'" %11s "`ts3'" %11s "`ts4'" %11s "`ts5'" %11s "`ts6'" %11s "`ts7'" %11s "`ts8'"
display "{hline 90}"
display %10s "Controls" %11s "No" %11s "No" %11s "No" %11s "No" %11s "Yes" %11s "Yes" %11s "Yes" %11s "Yes"
display %10s "State FE" %11s "No" %11s "No" %11s "Yes" %11s "Yes" %11s "No" %11s "No" %11s "Yes" %11s "Yes"
display %10s "AIC"      %11s "`aic1'" %11s "`aic2'" %11s "`aic3'" %11s "`aic4'" %11s "`aic5'" %11s "`aic6'" %11s "`aic7'" %11s "`aic8'"
display "{hline 90}"
display "Note: Robust SE in parentheses. ***p<0.01, **p<0.05, *p<0.10."
display "SDM = Spatial Durbin Model (ML). OLS Indirect = not applicable."

*----------------------------------------------------------------------
* (4.4) Write markdown table to file
*----------------------------------------------------------------------
capture noisily {
local tbl "c04_spillover_modeling_table.md"

tempname fh
file open `fh' using "`tbl'", write replace

file write `fh' "|          | Model 1 |       | Model 2 |         | Model 3 |       | Model 4 |         |" _n
file write `fh' "|----------|---------|-------|---------|---------|---------|-------|---------|---------|" _n
file write `fh' "|          | OLS     | SDM   | OLS     | SDM     | OLS     | SDM   | OLS     | SDM     |" _n
file write `fh' "| Direct   | `d1' | `d2' | `d3' | `d4' | `d5' | `d6' | `d7' | `d8' |" _n
file write `fh' "|          | `ds1' | `ds2' | `ds3' | `ds4' | `ds5' | `ds6' | `ds7' | `ds8' |" _n
file write `fh' "| Indirect | `i1' | `i2' | `i3' | `i4' | `i5' | `i6' | `i7' | `i8' |" _n
file write `fh' "|          | `is1' | `is2' | `is3' | `is4' | `is5' | `is6' | `is7' | `is8' |" _n
file write `fh' "| Total    | `t1' | `t2' | `t3' | `t4' | `t5' | `t6' | `t7' | `t8' |" _n
file write `fh' "|          | `ts1' | `ts2' | `ts3' | `ts4' | `ts5' | `ts6' | `ts7' | `ts8' |" _n
file write `fh' "| Controls | No      | No    | No      | No      | Yes     | Yes   | Yes     | Yes     |" _n
file write `fh' "| State FE | No      | No    | Yes     | Yes     | No      | No    | Yes     | Yes     |" _n
file write `fh' "| AIC      | `aic1' | `aic2' | `aic3' | `aic4' | `aic5' | `aic6' | `aic7' | `aic8' |" _n

file write `fh' _n
file write `fh' ": Unconditional and conditional convergence across districts. {#tbl-models}" _n

file close `fh'
display _n "Table written to: `tbl'"
}










Table: Unconditional and conditional convergence across districts

--------------------------------------------------------------------------------
> ----------

    Effect        OLS        SDM        OLS        SDM        OLS        SDM    
>     OLS        SDM

                  (1)        (2)        (3)        (4)        (5)        (6)    
>     (7)        (8)

--------------------------------------------------------------------------------
> ----------

    Direct  -0.020***  -0.021***  -0.022***  -0.021***  -0.025***  -0.026***  -0
> .025***  -0.025***

              (0.002)    (0.002)    (0.003)    (0.002)    (0.003)    (0.002)    
> (0.003)    (0.002)

  Indirect         --     -0.001         --     -0.001         --    -0.015*    
>      --    -0.012*

                         (0.006)               (0.005)               (0.008)    
>            (0.007)

     Total  -0.020***  -0.022***  -0.022***  -0.022***  -0.025***  -0.041***  -0
> .025***  -0.037***

              (0.002)    (0.006)    (0.003)    (0.005)    (0.003)    (0.008)    
> (0.003)    (0.007)

--------------------------------------------------------------------------------
> ----------

  Controls         No         No         No         No        Yes        Yes    
>     Yes        Yes

  State FE         No         No        Yes        Yes         No         No    
>     Yes        Yes

       AIC      -1945      -2290      -2413      -2466      -2211      -2356    
>   -2469      -2499

--------------------------------------------------------------------------------
> ----------

Note: Robust SE in parentheses. ***p<0.01, **p<0.05, *p<0.10.

SDM = Spatial Durbin Model (ML). OLS Indirect = not applicable.

(file c04_spillover_modeling_table.md not found)

Table written to: c04_spillover_modeling_table.md