Announcement

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

  • 2SLS and Two Way Fix Effect

    Hello,

    Hope you can help me with the following question related to 2SLS and Two Way Fix Effect:

    I have 8,000 observations from 1995-2015 and for 1,700 firms.
    I perform a regression with two way fix effect (years and firms) as follows:
    1. areg A B Control1 Control2 i.years, absorb(firms), if …
    (A - is the depended variable, B - is the independed variable).

    I suspect B and the error terms (u) are correlated – therefore I perform a 2SLS regression; as follows:
    1. ivregress 2sls A Control1 Control2 (B=C), first
    (C - is the in depended variable which is correlated with B but not correlated with the error).

    As I need to have the code with fix effects – I wrote it as follows:
    1. ivregress 2sls A Control1 Control2 i.years (B=C), first
    (i.years - fix effect for years).


    My question – Is there a way to write it with TWO WAY fix effect? (years & firms; currently it is with only one fix effect) and how?; or the way I wrote it here (in #3) is OK.


    Many thanks,

    Doron

  • #2
    I think you should look into reghdfe from Sergio Correira. It already allows for many fixed effects and instrumental variables.
    HTH
    Fernando

    Comment


    • #3
      Adding firm dummies will make it a two-way fixed effects model

      Code:
      ivregress 2sls A Control1 Control2 i.years i.firms (B=C), first
      or use xtivreg
      Code:
      xtivreg  A Control1 Control2 i.years (B=C), fe
      Last edited by Xiaojin Wang; 01 Jun 2017, 07:48.

      Comment


      • #4
        I agree with Xiaojin's second suggestion, with the slight amendments that you look at the first stage to ensure your instrument is sufficiently strong and you cluster at the firm level:

        Code:
         
         xtivreg  A Control1 Control2 i.years (B=C), fe vce(cluster firms) first

        Comment


        • #5
          Hi,

          Many thanks -

          Another question -

          Topic: Logit regression – Two way fix effect:
          I have 8,000 observations from 1995-2015 and for 1,700 firms.

          I am using regression logit with one way fix effect as follows:

          xtset firms years
          xtlogit Dummy_A Dummy_B control1 control2 i.years, fe, if…
          (A - is the depended variable, B - is the independed variable).

          My question - Do you know how can I make it two way fix effect (firms and years)

          Thanks,

          Doron

          Comment


          • #6
            Originally posted by Doron Hadass View Post
            Hi,

            Many thanks -

            Another question -

            Topic: Logit regression – Two way fix effect:
            I have 8,000 observations from 1995-2015 and for 1,700 firms.

            I am using regression logit with one way fix effect as follows:

            xtset firms years
            xtlogit Dummy_A Dummy_B control1 control2 i.years, fe, if…
            (A - is the depended variable, B - is the independed variable).

            My question - Do you know how can I make it two way fix effect (firms and years)

            Thanks,

            Doron

            You command does use two-way fixed effects. You might want to not the asymmetry in the nature of the fixed effects. You have lots of firms and relatively few time periods. So you can estimate the coefficients on the year dummies quite well. You cannot estimate the firm "fixed effects" very well, and Stata does not attempt to do so with the xtlogit, fe command. It uses a conditional MLE to eliminate the firm effects. But the command does account for firm and time effects.

            You might look at the correlated random effects probit approach, too. It doesn't require serial independence like xtlogit, and you can get average marginal effects.

            Comment


            • #7
              Great thanks,

              So yes – When I run the 'logit two way fix effect' regression (xtlogit Dummy_A Dummy_B .... i.years, fe, …) for my database (8,000 observations from 1995-2015 and for 1,700 firms). I had around 40% of the data removed as the explained variable was the same for many of the firms. (it was said in the reply above that "You cannot estimate the firm "fixed effects" very well")

              Therefore - as suggested I look at the correlated random effects probit approach:

              I perform it that way:

              xtset firms years
              xtprobit Dummy_A Dummy_B control1 control2 i.years, re, if…

              In addition - I also tried: xtlogit … re …:

              xtset firms years
              xtlogit Dummy_A Dummy_B control1 control2 i.years, re, if…

              What do you think? Are both can work?

              Thanks,

              Doron

              Comment


              • #8
                You didn't do correlated RE probit. You need to obtain the time averages of all of the time-varying explanatory variables (except the year dummies) and add those as controls.

                Code:
                egen Dummy_A_bar = mean(Dummy_A), by(firms)
                egen Dummy_B_bar = mean(Dummy_B), by(firms)
                and so on. Then I recommend pooled probit for robustness reasons:

                Code:
                probit i.Dummy_A i.Dummy_B control1 control2 Dummy_A_bar Dummy_B_bar control1_bar  control2_bar i.years, vce(cluster firms)
                margins, dydx(Dummy_A Dummy_B)

                Comment


                • #9
                  Thanks -

                  I did as described and got this message:

                  "depvar may not be a factor variable"

                  Any idea?

                  Thanks,

                  Doron

                  Comment


                  • #10
                    It means that you cannot have i.xyz as your left hand size. That's because it can be potentially expanded to multiple values (1.xyz 2.xyz ...). If you are sure that it only takes two values, you can just drop the i. part and it will work

                    Comment


                    • #11
                      My mistake. I didn't see that Dummy_A was the response variable. So you shouldn't include its time average. The correct command is below. And Sergio is, of course, correct, about specifying the dependent variable.

                      Code:
                       
                       probit Dummy_A i.Dummy_B control1 control2 Dummy_B_bar control1_bar control2_bar i.years, vce(cluster firms) margins, dydx(Dummy_B)

                      Comment


                      • #12
                        Thanks - getting closer - still an error message

                        invalid 'dydx'

                        (when I run only:
                        probit Dummy_A i.Dummy_B control1 control2 Dummy_B_bar control1_bar control2_bar i.years, vce(cluster firms) It works ) Any idea?

                        Comment


                        • #13
                          Doron: I mistakenly deleted the return. The margins command should be on the next line.

                          Here's some advice: you should know more about the econometrics and certainly more about Stata before undertaking these kinds of analyses. The syntax for the commands is easy to find.

                          Comment


                          • #14
                            Many thanks - I will.

                            Doron

                            Comment


                            • #15
                              Originally posted by Jeff Wooldridge View Post
                              I agree with Xiaojin's second suggestion, with the slight amendments that you look at the first stage to ensure your instrument is sufficiently strong and you cluster at the firm level:

                              Code:
                              xtivreg A Control1 Control2 i.years (B=C), fe vce(cluster firms) first
                              Dear Wooldridge,

                              If I want to include industry FE, year FE and cluster by industry. How should I do. Thank you

                              Comment

                              Working...
                              X