Announcement

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

  • Heckman Selection Model

    Dear Statalisters, I am having an issue running the Heckman selection model on gambling data. I want to instrument win_lose with upset, I keep getting no observations.

    Variables:
    "bookbet_2weeks bookbet_blacklist handicap bookbet_reg_control" are treatments.
    "win_lose" 1 = win, 0 = lose
    "pay_back" is missing for people who won. Out of the people who lost; "pay_back"==1 if they paid back and "pay_back"==0 if they didn't paid back.
    "upset" == 0 if favorite won

    My equation and sample data. I would really appreciate any help on this. Thanks.

    heckman pay_back handicap bookbet_2weeks bookbet_blacklist i.city_encode, select(win_lose = upset handicap bookbet_2weeks bookbet_blacklist i.city_encode) vce(cluster participant_id)

    [CODE]
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte(win_lose pay_back) long city_encode byte(upset bookbet_2weeks bookbet_blacklist handicap bookbet_reg_control) str8 participant_id
    1 . 40 0 1 0 0 0 "ABC1"
    0 0 40 1 0 0 0 1 "ABC10"
    0 . 7 1 0 0 1 0 "ABC100"
    0 0 40 0 0 1 0 0 "ABC1000"
    0 . 41 1 1 0 0 0 "ABC10000"
    0 . 40 1 1 0 0 0 "ABC10001"
    0 . 40 1 0 1 0 0 "ABC10002"
    0 1 40 1 0 0 1 0 "ABC10003"
    1 . 40 0 0 0 0 1 "ABC10004"
    1 . 40 0 0 0 1 0 "ABC10005"
    0 . 40 1 0 0 0 1 "ABC10006"
    0 . 40 1 1 0 0 0 "ABC10007"
    1 . 50 0 0 1 0 0 "ABC10008"
    1 . 49 0 0 0 1 0 "ABC10009"
    0 . 12 0 1 0 0 0 "ABC1001"
    0 0 40 1 0 0 1 0 "ABC10010"
    1 . 40 0 0 1 0 0 "ABC10011"
    1 . 40 0 0 1 0 0 "ABC10012"
    0 . 34 0 0 0 0 1 "ABC10013"
    0 . 42 0 1 0 0 0 "ABC10014"
    0 . 25 0 0 0 0 1 "ABC10015"
    0 . 40 0 0 0 1 0 "ABC10016"
    0 . 17 0 0 0 1 0 "ABC10017"
    1 . 40 0 0 0 1 0 "ABC10018"
    0 . 40 0 0 1 0 0 "ABC10019"
    0 1 40 1 0 0 1 0 "ABC1002"
    0 . 18 1 0 0 0 1 "ABC10020"
    0 . 40 0 1 0 0 0 "ABC10021"
    0 0 40 0 1 0 0 0 "ABC10022"
    0 . 23 1 1 0 0 0 "ABC10023"
    0 1 40 1 0 0 1 0 "ABC10024"
    0 . 40 1 0 1 0 0 "ABC10025"
    0 . 40 0 0 0 1 0 "ABC10026"
    0 . 40 0 1 0 0 0 "ABC10027"
    0 . 40 1 0 0 1 0 "ABC10028"
    1 . 40 0 1 0 0 0 "ABC10029"
    1 . 40 0 0 0 1 0 "ABC1003"
    0 . 40 1 0 0 0 1 "ABC10030"
    0 . 12 0 0 0 1 0 "ABC10031"
    1 . 40 0 0 1 0 0 "ABC10032"
    0 . 15 1 0 0 0 1 "ABC10033"
    1 . 40 0 0 1 0 0 "ABC10034"
    0 . 40 1 0 0 1 0 "ABC10035"
    1 . 40 0 0 0 0 1 "ABC10036"
    0 . 40 0 0 0 1 0 "ABC10037"
    0 . 40 1 0 0 1 0 "ABC10038"
    0 0 26 1 1 0 0 0 "ABC10039"
    0 . 42 0 0 1 0 0 "ABC1004"
    0 . 33 0 0 1 0 0 "ABC10040"
    1 . 40 0 0 1 0 0 "ABC10041"
    1 . 40 0 0 0 1 0 "ABC10042"
    0 1 43 1 0 1 0 0 "ABC10043"
    0 . 40 0 0 0 0 1 "ABC10044"
    0 . 40 0 0 0 1 0 "ABC10045"
    0 . 35 0 0 0 1 0 "ABC10046"
    0 . 40 1 0 0 1 0 "ABC10047"
    1 . 40 0 0 1 0 0 "ABC10048"
    1 . 6 0 0 0 0 1 "ABC10049"
    0 . 40 0 0 1 0 0 "ABC1005"
    0 1 40 1 0 0 1 0 "ABC10050"
    0 1 2 1 0 0 0 1 "ABC10051"
    1 . 40 0 0 0 1 0 "ABC10052"
    0 0 40 1 0 0 1 0 "ABC10053"
    0 . 40 0 0 1 0 0 "ABC10054"
    0 1 40 1 0 0 0 1 "ABC10055"
    0 . 40 1 0 0 1 0 "ABC10056"
    1 . 40 0 1 0 0 0 "ABC10057"
    0 0 40 1 1 0 0 0 "ABC10058"
    0 1 42 1 0 0 1 0 "ABC10059"
    1 . 40 0 0 1 0 0 "ABC1006"
    0 . 40 0 1 0 0 0 "ABC10060"
    1 . 40 0 0 0 0 1 "ABC10061"
    1 . 15 0 1 0 0 0 "ABC10062"
    1 . 40 0 0 0 1 0 "ABC10063"
    0 0 40 1 0 1 0 0 "ABC10064"
    1 . 40 0 1 0 0 0 "ABC10065"
    1 . 40 0 0 1 0 0 "ABC10066"
    0 . 40 0 0 0 1 0 "ABC10067"
    0 . 40 1 0 0 1 0 "ABC10068"
    0 . 40 0 0 1 0 0 "ABC10069"
    0 1 44 1 1 0 0 0 "ABC1007"
    0 . 40 0 1 0 0 0 "ABC10070"
    1 . 50 0 0 0 0 1 "ABC10071"
    0 . 3 0 1 0 0 0 "ABC10072"
    0 . 40 0 1 0 0 0 "ABC10073"
    0 . 40 0 1 0 0 0 "ABC10074"
    0 . 40 0 0 1 0 0 "ABC10075"
    0 . 40 1 0 1 0 0 "ABC10076"
    1 . 40 0 0 1 0 0 "ABC10077"
    0 . 40 0 0 0 1 0 "ABC10078"
    0 . 40 1 0 0 1 0 "ABC10079"
    0 0 40 1 1 0 0 0 "ABC1008"
    0 . 12 1 0 0 0 1 "ABC10080"
    0 . 40 0 0 0 1 0 "ABC10081"
    0 0 40 1 0 0 1 0 "ABC10082"
    1 . 40 0 0 0 0 1 "ABC10083"
    0 . 40 1 1 0 0 0 "ABC10084"
    1 . 5 0 1 0 0 0 "ABC10085"
    0 0 45 0 0 0 1 0 "ABC10086"
    1 . 40 0 1 0 0 0 "ABC10087"
    end

  • #2
    select([depvar_s =] varlist_s [, noconstant])

    If depvar_s is specified, it should be coded as 0 or 1, with 0 indicating an observation not selected and 1 indicating a selected observation. If depvar_s is
    not specified, observations for which depvar is not missing are assumed selected, and those for which depvar is missing are assumed not selected.

    Notice that your outcome (pay_back) is always missing whenever the selection indicator (win_lose) is positive. It then makes sense that the augmented regression cannot be estimated due to no observations.
    Last edited by Andrew Musau; 21 May 2022, 17:32.

    Comment


    • #3
      Originally posted by Andrew Musau View Post


      Notice that your outcome (pay_back) is always missing whenever the selection indicator (win_lose) is positive. It then makes sense that the augmented regression cannot be estimated due to no observations.
      Hi Andrew, thanks a lot for your reply.
      "pay_back" is only applicable to the people who lost; that means "win_lose" will be equal to zero when someone loses. Can you suggest anything different I can do to get what I need here? Thanks in advance!

      Comment


      • #4
        What is your research question (i.e., what do you want to study)? What are your right hand side variables and how many observations do you have? I cannot offer any useful advice without knowing more.

        Comment

        Working...
        X