Announcement

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

  • Convergence issues with XTHECKMANFE

    Dear Stata community,

    I want to estimate the effects of a few climate variables on weekly child labor hours from an unbalanced panel. I have sample selection because the decision to send children to work at all (the extensive margin) selects some children into work with non-zero hours (the intensive margin) and sets working hours to zero for many others.

    Because climate variables often have nonlinear effects on socioeconomic phenomena, I use b-splines to allow for functional flexibility. This is implemented through the command bspline (ssc install bspline).

    Since I would like to control for unobserved and time-invariant heterogeneity, I am using the xtheckmanfe command (ssc install xtheckmanfe) by FernandoRios, which implements the correlated random effects model, proposed in 1995 by Jeff Wooldridge. Unfortunately, I run into convergence issues. I have made sure that all variables are re-scaled properly. The command runs for what feels like forever and then throws the error "convergence not achieved" - that's return code r(430).

    Here is the relevant section...

    Code:
    * create cubic b-splines for climate vars
    * ssc install bspline
    bspline, x(wet) power(3) gen(bs_wet)
    bspline, x(pre) power(3) gen(bs_pre)
    bspline, x(tmp) power(3) gen(bs_tmp)
    bspline, x(tmx) power(3) gen(bs_tmx)
    bspline, x(tmn) power(3) gen(bs_tmn)
    
    *set analysis variables
    global Y childworkchores
    global C bs_wet* bs_pre* bs_tmp* bs_tmx* bs_tmn* bs_tmx*
    global X age age_squared sex MPI log_totcons sector
    
    * declare panel data
    xtset uniqueid t
    
    * Run xtheckmanfe...THIS IS WHERE THINGS GO WRONG
    xtheckmanfe $Y $C $X, select(selection = $C $X hhsize)
    I know that this could be caused by a whole host of different issues. Still, any guidance you can offer would be highly appreciated - also any alternative solutions you may know. Thanks!
    Last edited by Mathias Weidinger; 24 Aug 2021, 12:35.

  • #2
    Hi mathias
    the problem I think is because your model is very complex and you are running into near multicolineratiy or perfect prediction which is causing the problem you report

    if you take a look at the dataset you will see that many new variables have been created, so what you could do is try running the probit model manually and see if that converges
    if not you will have to use a simplified model

    Comment


    • #3
      Hello Fernando

      Thanks so much for your response. Following your suggestion, I ran multicollinearity diagnostics again and to my surprise (at first!) two of my variables were perfectly collinear.
      Looking at my independent vars vector confirms that I made a dumb mistake: $C includes bs_tmx* TWICE - no wonder then it doesn't converge. I sorted this out and re-ran the analysis, which now works like a charm. On that note thanks for this really really useful little package! I returned to Stata from R just so I could use it for this project.

      Cheers!
      Last edited by Mathias Weidinger; 25 Aug 2021, 00:14.

      Comment


      • #4
        FernandoRios Hello dear Fernando! I would kindly ask for help with the 'xtheckmanfe' command. I have a panel data where LnGI (dep var) ESG (ind var) the rest Size Age Board ROA LEV CA are control variables. Will it be correct if run the command this way?:

        xtheckmanfe LnGI ESG, select(Age Size Board LEV ROA CR)

        I tried to do the manual way. But I am not sure which one (automatic way with the command xthechmanfe or the manual) I am doing right and which one wrong (maybe both wrong?). Would you be able to advise me to correct my mistake? Thank you!

        gen GIdum=0
        replace GIdum=1 if LnGI>0
        xtprobit GIdum ESG Age Size Board LEV ROA CTA
        predict GIdum_hat, xb
        generate phi=normalden(GIdum_hat)
        generate PHI=normal(GIdum_hat)
        generate IMR=phi/PHI
        reghdfe LnGI ESG IMR Age Size Board LEV ROA CTA i.year, absorb(sector year) vce(cluster sector)

        Comment

        Working...
        X