Announcement

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

  • New package on SSC archive: rbiprobit – Stata module to estimate recursive bivariate probit regressions

    Thanks to Kit Baum, the new package rbiprobit is now available on SSC and can be installed by typing

    Code:
    ssc install rbiprobit
    rbiprobit fits a recursive bivariate probit regression using maximum likelihood estimation. The model involves an outcome equation and a treatment equation, whereas the treatment variable is an endogenous explanatory variable of the outcome equation. Both dependent variables have to be binary and the model assumes that the error terms have a bivariate normal distribution.

    Check out the GitHub Page of the new package for more background information, literature and examples.

    If you find bugs, have problems running the command or request new features, you can DM on Twitter (@cobanomics) or open an issue on the GitHub repo. Updates to the package will be more frequent via GitHub and less frequent via SSC.


    Syntax

    Code:
    rbiprobit depvar [=] [indepvars] [if] [in] [weight], endogenous(depvar_en [=] [indepvars_en] [, enopts]) [options]
    After fitting the model, you can compute various treatment effects and marginal effects of the independent variables. Moreover, a peculiarity of the recursive bivariate probit model is also available: you can decompose the marginal effects of independent variables that are included in both equations.

    Example for treatment effects

    Computation of average treatment effect (ate), average treatment effect on treated (atet), and average treatment effect on conditional probability (atec)

    Code:
      . webuse class10, clear
        (Class of 2010 profile)
    
      . rbiprobit graduate = income i.roommate i.hsgpagrp, ///
        >         endog(program = i.campus i.scholar income i.hsgpagrp)
    
      . rbiprobit tmeffects, tmeffect(ate)
    
        Treatment effect                                Number of obs     =      2,500
        Model VCE    : OIM
    
        Expression   : Pr(graduate=1), predict(pmarg1)
        Effect       : Average treatment effect
        dydx w.r.t.  : 1.program
    
        ------------------------------------------------------------------------------
                     |            Delta-method
                     |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                 ate |   .0981665   .0476222     2.06   0.039     .0048287    .1915044
        ------------------------------------------------------------------------------
    
       . rbiprobit tmeffects, tmeffect(atet)
    
       . rbiprobit tmeffects, tmeffect(atec)

    Example for marginal effects

    Computation of total, direct and indirect marginal effects on joint probability p11

    Code:
        . rbiprobit margdec, dydx(income) effect(total) predict(p11)
    
        Average marginal effects                        Number of obs     =      2,500
        Model VCE    : OIM
    
        Expression   : Pr(graduate=1,program=1), predict(p11)
        dy/dx w.r.t. : income
    
        ------------------------------------------------------------------------------
                     |            Delta-method
                     |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
              income |   .0032146    .002856     1.13   0.260    -.0023831    .0088123
        ------------------------------------------------------------------------------
    
        . rbiprobit margdec, dydx(income) effect(direct) predict(p11)
        . rbiprobit margdec, dydx(income) effect(indirect) predict(p11)


  • #2
    Hi, please I would like to know how to produce the good conditional probabilities and their standard errors with "rbiprobit" command. I'm analyzing the mother's health effect (shh_health) on their offspring's health (health) aged 0-5 years for two years.

    After the rbiprobit regression, I use the predict command as "predict pcond1r_05_`i', pcond1" and "predict pcond2r_05_`i', pcond2" respectively to have my two conditional probabilities notably, the probability to be healthy for children from healthy mothers ((Pr (Health=1 | shh_health=1)) and the probability to be healthy for children from unhealthy mothers (Pr (Health=1 | shh_health=0)).

    Howewer after typing "rbiprobit tmeffects, tmeffect(ate) post" for Average Treatment Effect (ATE) the result is not the difference between Pr (Health=1 | shh_health=0) - Pr (Health=1 | shh_health=0) obtained with sum pcond1r_05_`i'.

    Click image for larger version

Name:	Capture d’écran (103).png
Views:	1
Size:	21.9 KB
ID:	1671955


    Furthermore sum pcond1r_05_`i' can't give me the standard error of my two conditional probabilities distributions, but just the standard deviation. Please is there anyone who can help me ?

    Cordialy

    Modeste

    Comment


    • #3
      Hello, I need some help regarding rbiprobit regression. I am investigating the effect of agricultural extension service on the adoption of improved varieties.

      The list of independent variables include: Total land, age, education, HH size, Group membership, credit, and few other variables.

      I am using alternate ways to code this function, but receiving r(100) error like on this one:

      rbiprobit extensionservice [housholdmembers hheducation hhage totalland optionariskavoider ], endogenous adopternonadopter [housholdmembers hheducation hhage totalland optionariskavoider]

      Please suggest some codes and bits of advice, and I am happy to provide any further details.

      Comment


      • #4
        Hi Kunz Modeste

        Let me make your suggestion clear with a short example. Let's assume the following regression
        Code:
        rbiprobit y1 = x1 x2 x3, endog(y2 = x1 x2 x4 x5)
        After fitting your model you can predict the probability Pr(y1=1|y2=1) by
        Code:
        predict pcond1, pcond1
        and the probability Pr(y2=1 | y1=1) by
        Code:
        predict pcond2, pcond2
        Since you want to calculate the difference between the probabilities Pr(y1 = 1| y2 = 1) and Pr(y1 = 1 | y2 = 0), that is the average treatment effect on the conditional probability. For that, you have to type the following line after model fit
        Code:
        rbiprobit tmeffects, tmeffect(atec)
        You will get the correct point estimates and standard errors in that case.

        For more background: Check out the repo of the package on Github or my presentation at the Italian Stata Conference.

        Mustafa

        Comment


        • #5
          Hi Ubaid,

          the treatment equation of rbiprobit has to be added in parentheses. Just like

          Code:
          rbiprobit y1 = x1 x2 x3, endog(y2 = x1 x2 x4 x5)

          Comment


          • #6
            Dear all,
            I am using the rbiprobit command to estimate the impact of access to credit on adoption of ICT. I first ran the following : rbiprobit Onetype_ICT = Sex Stat Formal Export Size Mage , endog(CA = Sex Stat Land Formal Export Size Mage); but when i type : "rbiprobit tmeffects, tmeffect(atet) "to obtain the ATT, i have an error code (198). When i also use the predict command to compute the different probabilities (for example: predict p11, p11), Stata gives me the following message : "colnfreeparms not allowed invalid syntax". Could anyone tell me what is the problem ?

            Best regards,

            Guy Martial

            Comment


            • #7
              Hi Guy,

              the error message appears, if you are using Stata 14 or an older version of Stata. Sorry.
              rbiprobit works perfectly well on Stata 15 and newer versions.

              Mustafa

              Comment


              • #8
                Hi, I'd like to ask for post-estimation guidance. I am using Stata 16 to estimate a model that explains state-level adoption of carbon pricing program (binary) using RPS (binary, endogenous) and other state level characteristics, with clustered std errors (state level). I was able to use several post-estimation commands: "rbiprobit tmeffects, tmeffect()" and was able derive predict marginal and conditional probabilities. However, using this command, "rbiprobit margdec, dydx(*) effect(total) predict(p11)" always yields an "invalid syntax" error. What could be the problem? Am I missing something basic? My models run with no errors.

                Comment


                • #9
                  Hi,

                  that's interesting. Using the example from the help-file of rbiprobit everything works fine. For example:

                  Code:
                  webuse class10, clear
                  
                  rbiprobit graduate = income i.roommate i.hsgpagrp, endog(program = i.campus i.scholar income i.hsgpagrp) vce(cluster hscomp)
                  
                  rbiprobit tmeffects, tmeff(ate)
                  rbiprobit margdec, dydx(*) effect(total) predict(p11)
                  If you post your full syntax and the output of the commands, I could get more insights of your model and may find a solution to your problem. See the FAQ for posting Stata syntax and output.

                  Mustafa

                  Comment


                  • #10
                    Thanks for your reply, Mustafa.

                    Yes, I have already tried using the online data (class10) and was able to successfully run all the post-estimation commands on that example. I'm afraid It's my data?

                    My command and output are below:

                    . rbiprobit ///
                    > CarbonPrice2c = ///
                    > GDP_Pop ///
                    > GDP_Pop_sq ///
                    > Houseb Senateb ///
                    > Governorb ///
                    > retailpwr_reg ///
                    > renpotential ///
                    >
                    > period2 period3 period4 ///
                    > popexposedNA_3lagav_pop_mulhd ///
                    > drydisastercount_3lagav colddisastercount_3lagav floodcount_3lagav stormcount_3lagav ///
                    > ffprod_pop_1lag ///
                    > ffelectcons_pop_1lag ///
                    > renewcons_pop_1yrlag ///
                    > percUtil_1lag_pct percMfg_1lag_pct percConstr_1lag_pct ///
                    > prRD_GDP_3lagav_pct ///
                    > PctPeerPass ///
                    > SO2MassAvg_PeerPass ///
                    > percMfgAvg_PeerPass ///
                    > Delta_SO2 ///
                    > if Year>2000 & Year<2021 & StateAbbreviation~="US" & StateAbbreviation~="VI" & StateAbbreviation~="PR" & StateAbbreviation~="
                    > DC" ///
                    > , ///
                    > endog ( ///
                    > RPS_Dummy_rev = ///
                    > popexposedNA_3lagav_pop_mulhd ///
                    > drydisastercount_3lagav colddisastercount_3lagav floodcount_3lagav stormcount_3lagav ///
                    > ffprod_pop_1lag ///
                    > ffelectcons_pop_1lag ///
                    > renewcons_pop_1yrlag ///
                    > percUtil_1lag_pct percMfg_1lag_pct percConstr_1lag_pct ///
                    > GDP_Pop ///
                    > GDP_Pop_sq ///
                    > Houseb Senateb ///
                    > Governorb ///
                    > c.prRD_GDP_3lagav_pct ///
                    > retailpwr_reg ///
                    > renpotential ///
                    >
                    > period2 period3 period4 ///
                    > ) ///
                    > vce(cluster stateid2) nolog

                    Recursive Bivariate Probit Regression Number of obs = 1,000
                    Wald chi2(42) = .
                    Log pseudolikelihood = -430.80049 Prob > chi2 = .

                    (Std. Err. adjusted for 50 clusters in stateid2)
                    -----------------------------------------------------------------------------------------------
                    | Robust
                    | Coef. Std. Err. z P>|z| [95% Conf. Interval]
                    ------------------------------+----------------------------------------------------------------
                    CarbonPrice2c |
                    1.RPS_Dummy_rev | -3.809082 .6344345 -6.00 0.000 -5.052551 -2.565614
                    GDP_Pop | -.4660969 .2429881 -1.92 0.055 -.9423448 .0101511
                    GDP_Pop_sq | .0033479 .0016843 1.99 0.047 .0000467 .0066491
                    Houseb | 2.591127 .8165636 3.17 0.002 .9906921 4.191563
                    Senateb | -.4419621 .7019359 -0.63 0.529 -1.817731 .933807
                    Governorb | 3.259129 .726361 4.49 0.000 1.835488 4.682771
                    retailpwr_reg | .675472 .5727567 1.18 0.238 -.4471106 1.798054
                    renpotential | 1.72e-06 4.49e-07 3.83 0.000 8.42e-07 2.60e-06
                    period2 | 1.828895 .4706167 3.89 0.000 .906503 2.751286
                    period3 | 1.942871 .8338534 2.33 0.020 .3085481 3.577193
                    period4 | 1.142538 .58278 1.96 0.050 .0003098 2.284765
                    popexposedNA_3lagav_pop_mulhd | 34.91884 13.42007 2.60 0.009 8.615982 61.2217
                    drydisastercount_3lagav | 2.462776 .9004505 2.74 0.006 .6979257 4.227627
                    colddisastercount_3lagav | 2.367427 1.119862 2.11 0.035 .1725381 4.562317
                    floodcount_3lagav | -1.913557 1.674772 -1.14 0.253 -5.19605 1.368936
                    stormcount_3lagav | .314725 .3099898 1.02 0.310 -.2928439 .9222938
                    ffprod_pop_1lag | -.0292586 .0146019 -2.00 0.045 -.0578777 -.0006395
                    ffelectcons_pop_1lag | -.0000376 .0000119 -3.15 0.002 -.000061 -.0000142
                    renewcons_pop_1yrlag | .0196982 .0080101 2.46 0.014 .0039987 .0353977
                    percUtil_1lag_pct | 14.30329 4.874029 2.93 0.003 4.750366 23.85621
                    percMfg_1lag_pct | -.7414237 .1415986 -5.24 0.000 -1.018952 -.4638956
                    percConstr_1lag_pct | .193915 .1126201 1.72 0.085 -.0268163 .4146464
                    prRD_GDP_3lagav_pct | .2044027 .3282871 0.62 0.534 -.4390282 .8478335
                    PctPeerPass | 5.840329 1.551721 3.76 0.000 2.799012 8.881646
                    SO2MassAvg_PeerPass | .0324497 .0269112 1.21 0.228 -.0202953 .0851947
                    percMfgAvg_PeerPass | .6071298 .215088 2.82 0.005 .185565 1.028695
                    Delta_SO2 | .0000134 4.25e-06 3.16 0.002 5.09e-06 .0000217
                    _cons | 2.471269 8.422072 0.29 0.769 -14.03569 18.97823
                    ------------------------------+----------------------------------------------------------------
                    RPS_Dummy_rev |
                    popexposedNA_3lagav_pop_mulhd | 1.655085 2.318182 0.71 0.475 -2.888467 6.198638
                    drydisastercount_3lagav | .4143346 .2471569 1.68 0.094 -.070084 .8987532
                    colddisastercount_3lagav | -.5618564 .3423315 -1.64 0.101 -1.232814 .1091009
                    floodcount_3lagav | .3158842 .4400174 0.72 0.473 -.5465341 1.178303
                    stormcount_3lagav | -.2554186 .1274104 -2.00 0.045 -.5051383 -.0056989
                    ffprod_pop_1lag | -.0002268 .0001466 -1.55 0.122 -.000514 .0000604
                    ffelectcons_pop_1lag | -2.85e-06 5.00e-06 -0.57 0.568 -.0000127 6.95e-06
                    renewcons_pop_1yrlag | -.0024303 .0023278 -1.04 0.296 -.0069927 .0021321
                    percUtil_1lag_pct | 1.317017 1.300546 1.01 0.311 -1.232007 3.866041
                    percMfg_1lag_pct | -.0831669 .0690609 -1.20 0.228 -.2185237 .0521899
                    percConstr_1lag_pct | .0115275 .0253558 0.45 0.649 -.0381689 .0612239
                    GDP_Pop | .2874499 .0813947 3.53 0.000 .1279193 .4469805
                    GDP_Pop_sq | -.0020038 .0005496 -3.65 0.000 -.0030809 -.0009266
                    Houseb | .4218011 .2721631 1.55 0.121 -.1116288 .9552311
                    Senateb | .2830723 .2297615 1.23 0.218 -.1672519 .7333964
                    Governorb | .0097969 .1845115 0.05 0.958 -.351839 .3714328
                    prRD_GDP_3lagav_pct | .1409581 .1580583 0.89 0.372 -.1688306 .4507467
                    retailpwr_reg | 1.036663 .2779227 3.73 0.000 .4919444 1.581381
                    renpotential | 2.15e-07 1.22e-07 1.75 0.080 -2.54e-08 4.55e-07
                    period2 | .7399643 .1633058 4.53 0.000 .4198907 1.060038
                    period3 | .7678267 .1796641 4.27 0.000 .4156915 1.119962
                    period4 | .4899795 .094761 5.17 0.000 .3042513 .6757077
                    _cons | -11.14585 3.367742 -3.31 0.001 -17.7465 -4.545193
                    ------------------------------+----------------------------------------------------------------
                    /atanrho | 12.52331 .3689651 33.94 0.000 11.80015 13.24647
                    ------------------------------+----------------------------------------------------------------
                    rho | 1 1.96e-11 1 1
                    -----------------------------------------------------------------------------------------------
                    Wald test of rho=0: chi2(1) = 1152.04 Prob > chi2 = 0.0000

                    . rbiprobit tmeffects, tmeffect(ate)

                    Treatment effect Number of obs = 1,000
                    Model VCE : Robust

                    Expression : Pr(CarbonPrice2c=1), predict(pmarg1)
                    Effect : Average treatment effect
                    dydx w.r.t. : 1.RPS_Dummy_rev

                    ------------------------------------------------------------------------------
                    | Delta-method
                    | dy/dx Std. Err. z P>|z| [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                    ate | -.0934098 .0219391 -4.26 0.000 -.1364096 -.0504101
                    ------------------------------------------------------------------------------

                    . rbiprobit margdec, dydx(*) effect(direct) predict(p11)
                    invalid syntax
                    r(198);


                    I also want to mention that the Wald chi_sq test statistic for the full model is not displayed when I use the cluster command . The help file says there is "no sufficient rank to perform the model test" but "There is no mechanical problem with your model, but you need to consider carefully whether any of the reported standard errors mean anything."

                    Dropping the cluster option results in very similar standard errors and the full Wald test is reported. But, the Wald test of rho=0 is not longer significant (p-value=0.9621) when the cluster option is dropped.

                    In any case, running the rbiprobit margdec command after either variant of models says "invalid synax". I simply copied the format from the online class10 example. I am afraid that the behavior of Wald tests tho=0 indicative of serious problems with the data that I missed and maybe why the post estimation command syntax is invalid?

                    Thank you for your time.


                    Comment

                    Working...
                    X