Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • CIVREG: A Stata package for synthetic (coplanar) instrumental variables estimation

    Dear Statalist users,

    I would like to announce civreg, a new Stata package for instrumental variables estimation based on the Synthetic Instrumental Variables (SIV) methodology.

    The package implements the approach proposed by Dzhumashev and Tursunalieva (2025), which addresses endogeneity without requiring external instruments. Instead, valid instruments are constructed directly from the observed data by exploiting the coplanar structure of the regression system and a data-driven Dual Tendency (DT) condition. The method identifies both the synthetic instrument and the direction of endogeneity from the data itself

    To install, type:
    HTML Code:
    net install civreg, from("https://raw.githubusercontent.com/ManhHB94/civreg/main/")
    Key features of civreg include:
    • Estimation without requiring external instruments.
    • Support for models with or without exogenous control regressors.
    • Support for both homoskedastic and heteroskedastic SIV identification procedures.
    • Automatic determination of the direction of endogeneity.
    • Compatibility with fixed-effects and two-way fixed-effects settings for panel data.
    The example below replicates the SIV results presented in Table 1 of Dzhumashev and Tursunalieva (2025):
    HTML Code:
    . . webuse mroz, clear
    
    . . civreg hours (lwage = ) educ age kidslt6 kidsge6 nwifeinc , hete(0) reps(49) small rcode
    
    ------------------------------------------------------------------------------
    Coplanar instrumental variables (CIV) regression
    ------------------------------------------------------------------------------
    Dual Tendency:  Homoscedastic
    Effects:        None
    Reference:      Dzhumashev and Tursunalieva (2025)
    
    IV (2SLS) estimation
    --------------------
    
    Estimates efficient for homoskedasticity only
    Statistics consistent for homoskedasticity only
    
                                                          Number of obs =      428
                                                          F(  6,   421) =    18.26
                                                          Prob > F      =   0.0000
    Total (centered) SS     =  257311019.9                Centered R2   =  -1.3833
    Total (uncentered) SS   =    983895094                Uncentered R2 =   0.3767
    Residual SS             =  613254452.5                Root MSE      =     1207
    
    ------------------------------------------------------------------------------
           hours | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           lwage |    1369.47   138.4851     9.89   0.000     1097.261    1641.678
            educ |  -159.1529   30.84987    -5.16   0.000    -219.7919   -98.51395
             age |  -10.44129    8.83987    -1.18   0.238    -27.81706    6.934493
         kidslt6 |   -225.613   160.0919    -1.41   0.159     -540.292    89.06597
         kidsge6 |  -55.12937   49.49267    -1.11   0.266    -152.4129    42.15416
        nwifeinc |  -8.687533   5.853077    -1.48   0.138    -20.19243    2.817362
           _cons |   2396.561   544.0511     4.41   0.000     1327.166    3465.956
    ------------------------------------------------------------------------------
    Underidentification test (Anderson canon. corr. LM statistic):         167.557
                                                       Chi-sq(1) P-val =    0.0000
    ------------------------------------------------------------------------------
    Weak identification test (Cragg-Donald Wald F statistic):              270.853
    Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                             15% maximal IV size              8.96
                                             20% maximal IV size              6.66
                                             25% maximal IV size              5.53
    Source: Stock-Yogo (2005).  Reproduced by permission.
    ------------------------------------------------------------------------------
    Sargan statistic (overidentification test of all instruments):           0.000
                                                     (equation exactly identified)
    ------------------------------------------------------------------------------
    Instrumented:         lwage
    Included instruments: educ age kidslt6 kidsge6 nwifeinc
    Excluded instruments: civ_lwage
    ------------------------------------------------------------------------------

    Comments, suggestions, and bug reports are welcome.

    Reference:
    Dzhumashev, R., Tursunalieva, A. 2025. A synthetic instrumental variable method: Using the dual tendency condition for coplanar instruments. https://doi.org/10.48550/arXiv.2512.17301.
    Manh Hoang-Ba,
    Facebook,
    Eureka! Uni - YouTube,
    ManhHB94 (Manh Hoang Ba),
    Hoàng Bá Mạnh – Kinh tế lượng: Lý thuyết và ứng dụng

  • #2
    crashed my Stata twice

    Comment


    • #3
      George Ford Could you show them? Additionally, when using option rcode, your computer needs to have the R programming language and the rcall package installed in STATA.
      Manh Hoang-Ba,
      Facebook,
      Eureka! Uni - YouTube,
      ManhHB94 (Manh Hoang Ba),
      Hoàng Bá Mạnh – Kinh tế lượng: Lý thuyết và ứng dụng

      Comment


      • #4
        The command has been updated to version 2.1.2. This includes fixing bugs related to determining the direction of endogeneity and the d0 parameter, and adding some warnings related to the publication status of the original study.
        To update, users should run the following command in the STATA window:
        HTML Code:
          net install civreg, from("https://raw.githubusercontent.com/ManhHB94/civreg/main/") replace
        Manh Hoang-Ba,
        Facebook,
        Eureka! Uni - YouTube,
        ManhHB94 (Manh Hoang Ba),
        Hoàng Bá Mạnh – Kinh tế lượng: Lý thuyết và ứng dụng

        Comment


        • #5
          Many thanks to Prof. Kit Baum. The latest update of civreg is now available on SSC. To update, run:
          Code:
          ssc install civreg, replace
          This release fixes several issues related to determining the direction of endogeneity, identifying the optimal scaling parameters, and correctly adjusting the degrees of freedom in FE and TWFE estimations.
          It also introduces a new option for graphing the covariance and correlation between squared first-stage residuals and the coplanar instrumental variable.

          In a special case where neither direction of endogeneity is valid, the CIV cannot be identified. In such situations, civreg now stops execution and displays a warning message.

          Code:
          . . webuse mroz, clear
          
          . civreg hours (lwage educ kidslt6 = ) age  kidsge6 nwifeinc, hete(1) reps(5) cgraph
          
          determining the direction of endogeneity for kidslt6
          
          Cov(e^2,civ) does not change sign under either endogeneity-direction assumption.
          this suggests that kidslt6 may be considered exogenous.
          
          __00000M[2,5]
                assm_sign  cov_signchg   cov_abs_nd  cor_signchg   cor_abs_nd
          r1            1            0            1            0            0
          r2           -1            0            1            0            1
          r(198);
          In the example above, for the variable kidslt6, both assumptions (cov(u,kidslt6)>0 and cov(u,kidslt6)<0) regarding the direction of endogeneity fail. Neither cov(e², siv_kidslt6) nor cor(e², siv_kidslt6) exhibits the required sign change pattern, and the covariance function appears to be monotonically increasing (see the attached graphs).
          Dzhumashev and Tursunalieva (2025) suggest that, in such cases, kidslt6 may be treated as an exogenous variable.

          Click image for larger version

Name:	Capture1.PNG
Views:	1
Size:	46.3 KB
ID:	1786298

          Click image for larger version

Name:	Capture2.PNG
Views:	1
Size:	46.9 KB
ID:	1786299

          Last edited by Manh Hoang Ba; 10 Jun 2026, 07:49. Reason: Add the ssc command to update package
          Manh Hoang-Ba,
          Facebook,
          Eureka! Uni - YouTube,
          ManhHB94 (Manh Hoang Ba),
          Hoàng Bá Mạnh – Kinh tế lượng: Lý thuyết và ứng dụng

          Comment

          Working...
          X