Announcement

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

  • Receiving R(2000) "outcome does not vary" for Heckprob even if DV is coded correctly

    Hi guys!

    Currently doing an experiment regarding infidelity, my dependent variable is sexual_affair which when tab-ed gives you a 0 and a 1, but when I run the heckprob command, it still gives me the error. What may be the problem?

    my main equation is a bit long: heckprob sexual_affair i.educationlevel_men age_men i.relative_productivity Health_Vulnerability i.educationlevel_spouse i.age_spouse workpast12months_spouse Health_VulnerabilitySpouse sexratio infant_mortality life_expectancy premaritalsex, select(paid_sex refusesex_havesex_withanother sex_with_man women_noright_condom embarassed_tobuy_condom keep_it_asecret)

    So I tried to use 3 variables (the DV, one explanatory and one in the select just to see if it would work)

    heckprob sexual_affair urban, select( paid_sex)

    . tab sexual_affair

    Committed |
    Sexual |
    Infidelity | Freq. Percent Cum.
    ------------+-----------------------------------
    0 | 1,946 81.76 81.76
    1 | 434 18.24 100.00
    ------------+-----------------------------------
    Total | 2,380 100.00


    . tab urban

    urban | Freq. Percent Cum.
    ------------+-----------------------------------
    0 | 1,230 51.68 51.68
    1 | 1,150 48.32 100.00
    ------------+-----------------------------------
    Total | 2,380 100.00



    . tab paid_sex

    paid_sex | Freq. Percent Cum.
    ------------+-----------------------------------
    0 | 2,202 92.52 92.52
    1 | 178 7.48 100.00
    ------------+-----------------------------------
    Total | 2,380 100.00

    But it still gives me:


    selection equation:
    outcome does not vary; remember:
    0 = negative outcome,
    all other nonmissing values = positive outcome
    r(2000);

    Thank you in advance!!!












  • #2
    It's the joint distribution that's crucial here, not the marginal distributions. Try

    Code:
     
    ssc inst groups 
    groups sexual_affair urban paid_sex

    Comment


    • #3
      Thank you for the reply!!

      It gives me this:

      groups sexual_affair urban paid_sex

      +-----------------------------------------------+
      | sexual~r urban paid_sex Freq. Percent |
      |-----------------------------------------------|
      | 0 0 0 946 39.75 |
      | 0 0 1 52 2.18 |
      | 0 1 0 852 35.80 |
      | 0 1 1 96 4.03 |
      | 1 0 0 220 9.24 |
      |-----------------------------------------------|
      | 1 0 1 12 0.50 |
      | 1 1 0 184 7.73 |
      | 1 1 1 18 0.76 |
      +-----------------------------------------------+

      Does it mean that I can no longer use heckprob due to the small frequencies? Or is there a remedy? Thanks a lot!
      Last edited by Miguel Rey; 04 Apr 2016, 21:46.

      Comment


      • #4
        Code:
        +-----------------------------------------------+
        | sexual~r urban paid_sex Freq. Percent |
        |-----------------------------------------------|
        | 0 0 0 946 39.75 |
        | 0 0 1 52 2.18 |
        | 0 1 0 852 35.80 |
        | 0 1 1 96 4.03 |
        | 1 0 0 220 9.24 |
        |-----------------------------------------------|
        | 1 0 1 12 0.50 |
        | 1 1 0 184 7.73 |
        | 1 1 1 18 0.76 |
        +-----------------------------------------------+

        Comment


        • #5
          Actually there is an additional complication: cases with missing data will get dropped. So that may cause the outcome does not vary message.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          StataNow Version: 18.5 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://www3.nd.edu/~rwilliam

          Comment


          • #6
            Thank you sir Williams! May I ask if the variables are all coded as 0 and 1, with those as "." replaced with 0. Would that still be the case? Thank you!

            Comment


            • #7
              I am not sure that I understand what you mean. It helped me a great deal to scrutinize the data in the example (http://www.stata.com/manuals13/rheck...f#rheckoprobit) and compare it to the setup of my own data. In this example, you see that :
              1. the selection variable must be [0, 1]
              2. the dependent variable is missing for all values selection == 0; recoding missings to zero of your dependent variable will not change the results, since the values of "dependent" will be ignored iff "selection == 0". To see this, add the line "replace satisfaction=0 if missing(satisfaction)" before the heckman probit model in the abovementioned example: your results will be the same.
              3. the dependent variable ranges from 1 onward, i.e. [1, 2, ...]
              also (and I add this because it took me a while to stumble across this) the selection model has an equality sign between the dependent variable, while the probit itself does not.

              Comment


              • #8
                Dear Members,
                I have a similar problem with my heckprob model.
                I am receiving this message after running my specification: no observations r(2000);

                Could I please ask for your advice whether I have set up my specification correctly?

                Here is my model: heckprob achieved reg_CA reg_EEC reg_RUS reg_SEE reg_SEM reg_TUR sec_fi sec_ica sec_infra ins_D ln_size_agg ln_total ratios ln3_length ln_effect implement fm_SA ln_prep cofin_N synd_N disburs_ratio ln_disburs_cum ln_disburs_no exit_year ln_pl_c noi_c npc_c spc_c ln3_pd_start ln3_pd_exit own_priv sover_N sme_flag ln2_avg_GDP avg_CPI ln_avg_INF fh_2003_F fh_2003_NF fh_2015_F fh_2015_NF trans_yrs avg_POP avg_STAB avg_CORR avg_BURE, select (pselect2 = reg_CA reg_EEC reg_RUS reg_SEE reg_SEM reg_TUR ln_size_agg exp_date status_d life_ba life_cr life_ex life_fr stat_can sec_fi sec_ica sec_infra ins_D sovert_dir sovert_gur sec_nv sec_s ln3_pd_start ln_pl_c noi_c npc_c spc_c exp_y ln2_avg_GDP avg_CPI ln_avg_INF fh_2003_F fh_2003_NF fh_2015_F fh_2015_NF trans_yrs avg_POP avg_STAB avg_CORR avg_BURE )

                My DV ‘achieved’ refers to the success of a project performance (1 – achieved, 0 otherwise) and my explanatory variables and controls include a mixed of variables which could determine project performance (e.g. region, sector, size of the project, project length and so on).

                In my selection equation I have similar explanatory variables but few new ones like project status dummies, life cycle stage dummies etc.

                My selection variable (i.e. pselect2) is set correctly (1 – project selected, 0 – project not selected)

                I am not sure what to do with the missing values as I understood that I should not replace them with zeros etc as heckprob takes care of that. Also, I have some ‘real’ missing values inside each of the sub-sample and wondering if they could be stopping my regressions?

                I am attaching the summary table with missing values indication as well as high level overview of the variables I am including in my specification

                Look forward to hearing from you.
                Regards,
                Natalie
                Attached Files
                Last edited by Natalie Kyrg; 19 Jan 2017, 13:58.

                Comment


                • #9
                  probit school i.sex loginc i.motivation

                  outcome does not vary; remember:
                  0 = negative outcome,
                  all other nonmissing values = positive outcome
                  r(2000);
                  Please provide a solution to this problem while running a probit model

                  Comment


                  • #10
                    All of your values for school that are in the regression are either 0 or 1.

                    Welcome to Statalist, Puja. Just so you know, you should've shared an example of your data, but fortunately that's not needed here.
                    Last edited by Jared Greathouse; 29 Jan 2022, 16:53.

                    Comment

                    Working...
                    X