Announcement

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

  • CMP Convergence, David Roodman, Multivariate Probit with Sample Selection, MVNP/MDRAWS not converging

    Hello All,

    I am trying to model a Multivariate Probit Regression (Trivariate to be precise) with one sample selection, very much like the model (Cappellari et. al. 2006) and using David Roodman's CMP plugin. One might ask why I am not using the Cappellari Jenkins mvnp, mdraws technique?, because I am having a lot of problem with convergence. But somehow my model converged with cmd, and hence I wanted to check if my specification in cmd was correct for my model.

    My model

    Trivariate Probit model with selection. Three outcomes of interest: Self Report Disease, Agree to Participate in Medical Test, Has disease. Everyone gets to Self Report Disease. Some agree to participate in Medical Test, and only these respondents gets a diagnosis of either having/not having a disease. Click image for larger version

Name:	Untitled.jpg
Views:	1
Size:	77.8 KB
ID:	1405991


    My cmp code is as follows,
    Code:
    cmp (krephbp = $cov) (kagrhbp = $cov i.k026) (khashbp = $cov i.bmicat) , ind($cmp_probit $cmp_probit kagrhbp*$cmp_probit) technique(bhhh)
    I had to use bhhh, as nr "cannot compute an improvement -- discontinuous region encountered" and convergence was not achieved. I must say that this group of $cov is something I have played with for over 30 hours because of the combination of discontinuous and not-concave errors I was getting. As you can see in some of the categories, the sample sizes are getting pretty low, and I was asking too much from the data. It finally ran with the above code with a couple of warnings saying it being ill-conditioned. I can live with that since there are quite a few dummies in $cov.

    I would be grateful if someone could confirm that the code is correct for the above model, otherwise, because of my nihilism, I will just assume that I have made an error and probably fitted some other model.

    FYI this was my mvnp/mdraws code that didn't converge

    Code:
    program define myll
        args lnf x1 x2 x3 c21 c31 c32
        tempvar sp2 sp3 k1 k2 k3
    quietly {
        gen double `k1' = 2*$ML_y1 - 1
        gen double `k2' = 2*$ML_y2 - 1
        gen double `k3' = 2*$ML_y3 - 1
        tempname cf21 cf22 cf31 cf32 cf33 C1 C2
        su `c21', meanonly
        scalar `cf21' = r(mean)
        su `c31', meanonly
        scalar `cf31' = r(mean)
        su `c32', meanonly
        scalar `cf32' = r(mean)
        scalar `cf22' = sqrt(1 - `cf21'^2)
        scalar `cf33' = sqrt(1 - `cf31'^2 - `cf32'^2)
        mat `C1' = ( 1, 0, 0 \ `cf21', `cf22', 0 \ `cf31', `cf32', `cf33' )
        mat `C2' = ( 1, 0 \ `cf21', `cf22' )
        egen `sp3' = mvnp(`x1' `x2' `x3') if $ML_y1==1, chol(`C1') dr($dr)  prefix(z) sign(`k1' `k2' `k3')
        egen `sp2' = mvnp(`x1' `x2'     ) if $ML_y1==0, chol(`C2') dr($dr)  prefix(z) sign(`k1' `k2'        )
        replace `lnf' = cond($ML_y1==1, ln(`sp3'), ln(`sp2'), .)
    }
    
    ml model lf myll (kagrhbp: kagrhbp = $cov i.k026 ) (krephbp: krephbp = $cov) (khashbp: khashbp = $cov i.bmicat) /c21 /c31 /c32, technique (bhhh)
    ml init b0
    ml maximize, iterate(150) difficult
    end
    Thanks a Lot
    Soumya
    Last edited by Soumyadeb Chatterjee; 11 Aug 2017, 10:26.

  • #2
    You didn't get a quick answer. While cmp is a great program, routines in Stata 15 (and some in 14) do many of the things cmp did that Stata didn't in earlier versions. I haven't looked to see if Stata 15 does multivariate probit with sample selection. The eprobit routine handles this if you have two outcomes or ordinal dvs.

    Statalist discourages posting pictures - your picture is not readable by my old eyes.

    Knowing whether a model is what you want for complex models like cmp is not something most of us can do by eye. (Roodman might be able to do so.) One way to attack this is to get a textbook example that most closely fits your problem and see if you can replicate it with cmp.

    Comment


    • #3
      The cmp command line looks basically right. But with these nonlinear ML models, there is never a guarantee of convergence. For example. perhaps the extra variables you add in the second and third equations are weak "instruments." If the command line is right in the sense of properly expressing your model, then I doubt switching to another program would help much, because the problem is that your model is hard to fit to the data. To diagnose the trouble, I would try simplifying the model, e.g., by removing variables from $cov and perhaps moving them to the lists of variables outside $cov.

      Comment


      • #4
        Hello Phil,

        Thank you for the reply. The picture should get magnified if clicked on. Currently my model is running, I made some tweaks to it and the code,

        Soumya

        Comment


        • #5
          Hello David,

          First of all, thank you for writing such a wonderful program. I found that my "discontinuity, flatness" was around a variable that was quintessential to my hypothesis. I used a combination changing covariates and technique(nr bhhh) to run the model. I have a follow up question. I am trying to get the marginal effect of "Race" on Probability of Self-Reporting a Disease if someone Agrees to Participate and finally Diagnosed with the Disease. Can I do something like the following to get it, after running cmp? (Agree to Participate is the selection variable) The latent variables are in caps, and when they are positive, the observed variables takes the value 1.

          Code:
          preserve
          replace AGREETOPARTICIPATE=1
          margins, dydx(i.race) predict(pr(. 0) eq(REPORTDISEASE) cond(0 ., eq(HASDISEASE)) )
          restore
          Thanks a lot
          Soumya

          Comment

          Working...
          X