Announcement

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

  • Difference-in-Difference - Collinearity Problem

    Hi all,

    I'm currently an undergraduate student and very new to STATA, I apologize for any "stupid" questions ahead of time.


    For my model, I want to look at the effect of carbon pricing systems on GHG emission intensity.

    I would like to construct a difference-in-difference model by comparing Canadian provinces who have different carbon pricing systems (carbon tax, cap-n-trade, nothing), and see the effect of these carbon pricing systems.
    Click image for larger version

Name:	Screen Shot 2018-12-05 at 9.16.14 PM.png
Views:	1
Size:	82.4 KB
ID:	1473618



    Where "time" is a dummy variable indicating the year that the carbon pricing system went into effect and "treated" represents a province that has a carbon pricing system. I saw a tutorial online to generate a "did" variable by time*treatment. Then regressing oilgas time treated did.

    However, evidently my "did" variable carries the same values as my "time" variable, so it was omitted due to collinearity.



    When I did the diff command, I got these results. How should I interpret this:
    Click image for larger version

Name:	Screen Shot 2018-12-05 at 9.22.25 PM.png
Views:	1
Size:	46.1 KB
ID:	1473619




    I'm just wondering if my approach is even correct and what I can do to make this model work.

    Again, I apologize if my question is too general and vague. I'd appreciate it so much if I could get as much detail as possible!

    Thank you, everyone!!







    Last edited by Karen Feng; 05 Dec 2018, 20:24. Reason: Added tags

  • #2
    Your data is set up incorrectly. You have no observations coded as after in the control group. Your intervention begins in 2007, it appears from your screenshot. So time should be 1 in any observation where year >= 2007, regardless of whether or not the observation belongs to the treated group or the control group. Fix that and then re-run and you will get interpretable results.

    Your question is a very appropriate one. But in addition to being new to Stata, you are new to the Forum and it appears you did not read the FAQ before posting, as you are reminded to do every time you start a new topic. In particular, you showed your data example in a screen shot. That is strongly deprecated. While yours came out readable, many do not. Even when they are readable, if somebody helping you needs to work with your data in Stata to figure out or check an answer to your question, it is impossible to import the data from a screenshots. Please read the entire FAQ, but focus in particular on #12 where you will learn about the helpful way to show example data: with the -dataex- command. Also in FAQ #12 you will learn that the preferred way to show Stata output is with code delimiters, not a screenshot.

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      Your data is set up incorrectly. You have no observations coded as after in the control group. Your intervention begins in 2007, it appears from your screenshot. So time should be 1 in any observation where year >= 2007, regardless of whether or not the observation belongs to the treated group or the control group. Fix that and then re-run and you will get interpretable results.

      Your question is a very appropriate one. But in addition to being new to Stata, you are new to the Forum and it appears you did not read the FAQ before posting, as you are reminded to do every time you start a new topic. In particular, you showed your data example in a screen shot. That is strongly deprecated. While yours came out readable, many do not. Even when they are readable, if somebody helping you needs to work with your data in Stata to figure out or check an answer to your question, it is impossible to import the data from a screenshots. Please read the entire FAQ, but focus in particular on #12 where you will learn about the helpful way to show example data: with the -dataex- command. Also in FAQ #12 you will learn that the preferred way to show Stata output is with code delimiters, not a screenshot.
      Thank you so much! This has worked. Do you know also how I could use these results to graph this onto STATA

      As for the screenshot, my apologies.

      Comment


      • #4
        Code:
        collapse (mean) oilgas, by(treated year)
        separate oilgas, by(treated)
        graph twoway line oilgas? year
        will do it. It won't be very pretty and you will need to add some options to clean up the legend and such. You can simplify it if you install Nick Cox' -sepscatter-, available from SSC. In that case it's just:

        [code]
        collapse (mean) oilgas, by(treated year)
        sepscatter oilgas year, separate(treated) recast(connect)
        [/code
        You still might want to pretty it up a bit with some more -graph twoway- options in the -sepscatter- command, but this will be closer to finished.

        Comment

        Working...
        X