Announcement

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

  • xtreg

    Hello everbody
    Can I use the xtreg when the dependent variable is binary?
    Thanks.

  • #2
    Originally posted by klo alikaj View Post
    Hello everbody
    Can I use the xtreg when the dependent variable is binary?
    Thanks.
    Try xtprobit/xtlogit!
    Ho-Chuan (River) Huang
    Stata 19.0, MP(4)

    Comment


    • #3
      I have tried the xtlogit but it eliminates most of my records( from almos 270,000 record it takes in consideration only 70,000 records) is that normal?

      Comment


      • #4
        Klo:
        welcome to te list.
        Please be aware that Stata use listwise deletion by default: hence, any observations with missing value(s) in any of the variables is automatically ruled out from the regression model and the sample is reduced accordingly (see -help misstable- to investigate what's the matter with your data).
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thank you Carlo
          Actually I dont have any missing values so I dont know what tje problem may be.

          Comment


          • #6
            Klo:
            are all your -depvar- and -indepvars- in numeric format?
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              yes they are, only the timevar is stored as a date

              Comment


              • #8
                Klo:
                is there any independent variable omitted due to collinearity?
                That said, please piost what you typed and what Stata gave you back via CODE delimiters or an example/excerpt of your dataset via -dataex-; read the FAQ to learn about these topics. Thanks.
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  I assume you're doing fixed effects logit, correct? If so, then you lose any observations that have no variation in y(i,t) across time. So if you have unit with all zeros or all ones, those do not contribute to the estimation. This is as it should be, and it is not uncommon to have lots of units without variation. (For example, over a five year period, there are lots of people who are never on government assistance.)

                  You can always estimate a linear probability model by fixed effects. The problem is, you need a way to obtain average marginal effects for the xtlogit. That's a bit involved for me to go into here. A useful alternative is the probit correlated random effects approach, which delivers average marginal effects that can be compared with the linear estimates. You need to use egen to generated the time averages for each i of all time-varying explanatory variables, and then include those as extra controls. You can find a description at this link:

                  http://conference.iza.org/conference...nonlin_iza.pdf

                  Comment


                  • #10
                    Hi Jeff Wooldridge

                    Regarding your suggestion of the probit correlated random effects approach, which Stata coding would you recommend for computing the average marginal effects?
                    After running - xtprobit y x1 x1bar ...xK xKbar i.year, re - would the following suffice for continuous/discrete explanatory variables, or is further coding required?
                    (assuming x1 to xK are time-varying)

                    Code:
                    margins, dydx(*)
                    Thanks

                    Comment


                    • #11
                      Actually, the best built-in command is

                      Code:
                      margins, dydx(*) predict(pu0)
                      This evaluates the unobserved heterogeneity at its mean, which is zero, and averages out everything else. That's not the same as joint averaging out both, but it's fine for almost all purposes.

                      Comment


                      • #12
                        Thank you very much for the explanation and the suggested command
                        I will use this to compute the AMEs for my discrete and continuous explanatory variables.



                        I have a panel dataset (N=237, T=13). My dependent variable is ability to save (saving=1 if able to save, 0 otherwise).
                        In a simplified version of my regression, I have explanatory variables that are time-varying (discrete/binary e.g. married=1 if married; continuous e.g. income; ordinal e.g. risk tolerance ranked 1-7) and time-invarying (discrete/binary e.g. female=1 if female; continuous e.g. age).

                        For the CRE Probit model, should the "bar" variables be created for any type of time-varying variable (i.e. regardless of whether it is discrete or continuous)?

                        An example of generating "bar" variable:
                        Code:
                        egen marriedbar = mean(married), by(id)
                        Is my use of "bar" variables in the regression correct (have I created "bar" variables for the correct variables)?
                        Code:
                        xtprobit saving married marriedbar income incomebar risk riskbar female age i.year, re vce(cluster id)
                        Many thanks

                        Comment


                        • #13
                          Sorry, I didn't see this response. Yes, this is correct. Or, use the full-blown Chamberlain device. But it requires some special programming to get the variables from each time period on each line. I've found that for marginal effects, Mundlak often gives similar results.

                          Comment


                          • #14
                            Thanks for your reply Jeff Wooldridge
                            Q1: Is what I presented in #12 the "Chamberlain-Mundlak" model? Is this different to the "full-blown Chamberlain device"?

                            Q2: I also wondered, as the CRE Probit model uses mean/average values, is a balanced panel dataset recommended - a consistent sample of the same individuals each year?
                            For example, using survey data over 13 waves, I have an unbalanced panel of 17,286 observations.
                            If I were to drop the individuals who didn't respond in all 13 waves, I would be left with a more balanced dataset with 3,094 observations.
                            This would be a consistent sample of the same 238 individuals each year.
                            However, I realise there are issues surrounding bias as a result of artificially balancing a panel.

                            Comment


                            • #15
                              Originally posted by Jeff Wooldridge View Post
                              Actually, the best built-in command is

                              Code:
                              margins, dydx(*) predict(pu0)
                              This evaluates the unobserved heterogeneity at its mean, which is zero, and averages out everything else. That's not the same as joint averaging out both, but it's fine for almost all purposes.
                              Steve Samuels cautioned against this approach a while back, and suggested a (much more complicated) alternative. I'm not strong enough in this area to assess how important Steve's concerns were or how much better his proposed solution is. Maybe Jeff can comment.

                              http://www.statalist.org/forums/foru...-after-xtlogit
                              -------------------------------------------
                              Richard Williams
                              Professor Emeritus of Sociology
                              University of Notre Dame
                              StataNow Version: 19.5 MP (2 processor)

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

                              Comment

                              Working...
                              X