Announcement

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

  • Diff-in-diff

    Hello ,

    I have a problem that I have been thinking about for a week now and I do not understand what's missing.
    Let me explain.

    I perform a DID analysis with two treatment times.
    12-week analysis. The first 4 weeks are the pre-treatment weeks. Then comes my first measure that lasts 4 weeks. Then a second measur coupled with the last one for another 4 weeks.

    Firstly, I did:

    reg Conso timeB treatedC did2B did2C i.companies, r

    With, timeB: > 4 weeks <8 weeks. timeC: > 8 weeks. treated2: the companies that are affected by the measure. did2B: timeB * treated2. did3C: timeC * treated2.

    So far it goes ... I test the effect of my first measure, as well as the effect of the complementarity of the two measures.

    The problem is when I try to go further in my analysis.

    The first step that I testing is information that transmits to the companies (very positive, positive, negative, very negative) and I would like to know which particular messages that impact my group

    I tried everything but I have collinearity into variables. What makes me think that either I forgot a variable, either I have a variable too ... I tried all the configurations it does not work.

    Can you help me and tell me what I'm missing?

    Look my result (always with i.companies) :

    gen did2BM1_CVC = did2B * MessCVC_VeryPositif
    gen did2BM2_CVC = did2B * MessCVC_Positif
    gen did2BM3_CVC = did2B * MessCVC_Negatif
    gen did2BM4_CVC = did2B * MessCVC_VeryNegatif
    gen did2CM1_CVC = did2C * MessCVC_TresPositif
    gen did2CM2_CVC = did2C * MessCVC_Positif
    gen did2CM3_CVC = did2C * MessCVC_Negatif
    gen did2CM4_CVC = did2C * MessCVC_VeryNegatif

    reg Conso_CVCkWhr timeB timeC treated2 MessCVC_VeryPositif MessCVC_Positif MessElec_Negatif MessCVC_VeryNegatif did2BM1_CVC did2BM2_CVC did2BM3_CVC did2BM4_CVC did2CM1_CVC did2CM2_CVC did2CM3_CVC did2CM4_CVC Area NbEmployees DaysWorked Temp_Ext Interet_Finant, r
    /*
    note: timeC omitted because of collinearity
    note: treated2 omitted because of collinearity
    note: MessCVC_VeryNegatif omitted because of collinearity
    note: did2BM1_CVC omitted because of collinearity
    note: did2CM4_CVC omitted because of collinearity
    note: Interet_Finant omitted because of collinearity

    Linear regression Number of obs = 448
    F( 14, 433) = 15.47
    Prob > F = 0.0000
    R-squared = 0.3206
    Root MSE = 29.278

    --------------------------------------------------------------------------------------
    | Robust
    Conso_CVC | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    ---------------------+----------------------------------------------------------------
    timeB | 52.078 6.20647 8.39 0.000 39.87945 64.27655
    timeC | 0 (omitted)
    treated2 | 0 (omitted)
    MessCVC_VeryPositif | .2319934 3.699472 0.06 0.950 -7.039162 7.503149
    MessCVC_Positif | -15.01919 3.738668 -4.02 0.000 -22.36738 -7.670997
    MessCVC_Negatif | 6.755781 4.797958 1.41 0.160 -2.674404 16.18596
    MessCVC_VeryNegatif | 0 (omitted)
    did2BM1_CVC | 0 (omitted)
    did2BM2_CVC | -36.77858 6.160245 -5.97 0.000 -48.88628 -24.67087
    did2BM3_CVC | -31.12346 7.285944 -4.27 0.000 -45.44368 -16.80324
    did2BM4_CVC | -30.23441 8.362945 -3.62 0.000 -46.67142 -13.79739
    did2CM1_CVC | -.3091941 5.215349 -0.06 0.953 -10.55974 9.941355
    did2CM2_CVC | -6.611578 4.299592 -1.54 0.125 -15.06225 1.839089
    did2CM3_CVC | 7.325056 4.502705 1.63 0.105 -1.52482 16.17493
    did2CM4_CVC | 0 (omitted)
    Area | .0160128 .0126783 1.26 0.207 -.0089059 .0409314
    NbEmployees | .657042 .3573753 1.84 0.067 -.0453641 1.359448
    DaysWorked | 9.771915 3.384955 2.89 0.004 3.118929 16.4249
    Temp_Ext | 1.46355 .3071469 4.76 0.000 .8598658 2.067234
    Interet_Finant | 0 (omitted)
    _cons | 2.426393 6.918078 0.35 0.726 -11.1708 16.02358
    */

    reg Conso_CVCkWhr timeB timeC treated2 did2B did2C MessCVC_VeryPositif MessCVC_Positif MessCVC_Negatif MessCVC_VeryNegatif did2BM1_CVC did2BM2_CVC did2BM3_CVC did2BM4_CVC did2CM1_CVC did2CM2_CVC did2CM3_CVC did2CM4_CVC Area NbEmployees DaysWorked Temp_Ext Interet_Finant, r
    /*
    note: timeC omitted because of collinearity
    note: treated2 omitted because of collinearity
    note: did2B omitted because of collinearity
    note: did2C omitted because of collinearity
    note: MessCVC_VeryNegatif omitted because of collinearity
    note: did2BM1_CVC omitted because of collinearity
    note: did2CM4_CVC omitted because of collinearity
    note: Interet_Finant omitted because of collinearity

    Linear regression Number of obs = 448
    F( 14, 433) = 15.47
    Prob > F = 0.0000
    R-squared = 0.3206
    Root MSE = 29.278

    --------------------------------------------------------------------------------------
    | Robust
    Conso_CVCkWhr | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    ---------------------+----------------------------------------------------------------
    timeB | 52.078 6.20647 8.39 0.000 39.87945 64.27655
    timeC | 0 (omitted)
    treated2 | 0 (omitted)
    did2B | 0 (omitted)
    did2C | 0 (omitted)
    MessCVC_VeryPositif | .2319934 3.699472 0.06 0.950 -7.039162 7.503149
    MessCVC_Positif | -15.01919 3.738668 -4.02 0.000 -22.36738 -7.670997
    MessCVC_Negatif | 6.755781 4.797958 1.41 0.160 -2.674404 16.18596
    MessCVC_VeryNegatif | 0 (omitted)
    did2BM1_CVC | 0 (omitted)
    did2BM2_CVC | -36.77858 6.160245 -5.97 0.000 -48.88628 -24.67087
    did2BM3_CVC | -31.12346 7.285944 -4.27 0.000 -45.44368 -16.80324
    did2BM4_CVC | -30.23441 8.362945 -3.62 0.000 -46.67142 -13.79739
    did2CM1_CVC | -.3091941 5.215349 -0.06 0.953 -10.55974 9.941355
    did2CM2_CVC | -6.611578 4.299592 -1.54 0.125 -15.06225 1.839089
    did2CM3_CVC | 7.325056 4.502705 1.63 0.105 -1.52482 16.17493
    did2CM4_CVC | 0 (omitted)
    Area | .0160128 .0126783 1.26 0.207 -.0089059 .0409314
    NbEmployees | .657042 .3573753 1.84 0.067 -.0453641 1.359448
    DaysWorked | 9.771915 3.384955 2.89 0.004 3.118929 16.4249
    Temp_Ext | 1.46355 .3071469 4.76 0.000 .8598658 2.067234
    Interet_Finant | 0 (omitted)
    _cons | 2.426393 6.918078 0.35 0.726 -11.1708 16.02358
    */

    reg Conso_CVCkWhr timeB timeC treated2 did2B did2C did2BM1_CVC did2BM2_CVC did2BM3_CVC did2BM4_CVC did2CM1_CVC did2CM2_CVC did2CM3_CVC did2CM4_CVC Area NbEmployees DaysWorked Temp_Ext Interet_Finant, r
    /*
    note: timeC omitted because of collinearity
    note: treated2 omitted because of collinearity
    note: did2B omitted because of collinearity
    note: did2C omitted because of collinearity
    note: did2BM1_CVC omitted because of collinearity
    note: did2CM1_CVC omitted because of collinearity
    note: Interet_Finant omitted because of collinearity

    Linear regression Number of obs = 448
    F( 11, 436) = 20.89
    Prob > F = 0.0000
    R-squared = 0.2783
    Root MSE = 30.071

    --------------------------------------------------------------------------------
    | Robust
    Conso_CVCkWhr | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
    timeB | 57.83895 5.898884 9.81 0.000 46.24517 69.43274
    timeC | 0 (omitted)
    treated2 | 0 (omitted)
    did2B | 0 (omitted)
    did2C | 0 (omitted)
    did2BM1_CVC | 0 (omitted)
    did2BM2_CVC | -38.73751 5.970948 -6.49 0.000 -50.47293 -27.00209
    did2BM3_CVC | -37.57747 7.253134 -5.18 0.000 -51.83292 -23.32201
    did2BM4_CVC | -35.76314 8.474267 -4.22 0.000 -52.41863 -19.10765
    did2CM1_CVC | 0 (omitted)
    did2CM2_CVC | -2.962981 3.936796 -0.75 0.452 -10.70044 4.774475
    did2CM3_CVC | 8.791522 4.485909 1.96 0.051 -.0251723 17.60822
    did2CM4_CVC | -2.948393 3.558306 -0.83 0.408 -9.941958 4.045172
    Area | .0215022 .0131952 1.63 0.104 -.004432 .0474363
    NbEmployees | .8065384 .3155003 2.56 0.011 .1864479 1.426629
    DaysWorked | 9.75966 3.459424 2.82 0.005 2.960439 16.55888
    Temp_Ext | 1.347507 .2983757 4.52 0.000 .7610738 1.933941
    Interet_Finant | 0 (omitted)
    _cons | -3.071327 6.958276 -0.44 0.659 -16.74726 10.60461
    --------------------------------------------------------------------------------
    */
    reg Conso_CVCkWhr timeB timeC did2B did2C did2BM1_CVC did2BM2_CVC did2BM3_CVC did2BM4_CVC did2CM1_CVC did2CM2_CVC did2CM3_CVC did2CM4_CVC Area NbEmployees DaysWorked Temp_Ext Interet_Finant, r
    /*note: timeC omitted because of collinearity
    note: did2B omitted because of collinearity
    note: did2C omitted because of collinearity
    note: did2BM1_CVC omitted because of collinearity
    note: did2CM1_CVC omitted because of collinearity
    note: Interet_Finant omitted because of collinearity

    Linear regression Number of obs = 448
    F( 11, 436) = 20.89
    Prob > F = 0.0000
    R-squared = 0.2783
    Root MSE = 30.071

    --------------------------------------------------------------------------------
    | Robust
    Conso_CVCkWhr | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
    timeB | 57.83895 5.898884 9.81 0.000 46.24517 69.43274
    timeC | 0 (omitted)
    did2B | 0 (omitted)
    did2C | 0 (omitted)
    did2BM1_CVC | 0 (omitted)
    did2BM2_CVC | -38.73751 5.970948 -6.49 0.000 -50.47293 -27.00209
    did2BM3_CVC | -37.57747 7.253134 -5.18 0.000 -51.83292 -23.32201
    did2BM4_CVC | -35.76314 8.474267 -4.22 0.000 -52.41863 -19.10765
    did2CM1_CVC | 0 (omitted)
    did2CM2_CVC | -2.962981 3.936796 -0.75 0.452 -10.70044 4.774475
    did2CM3_CVC | 8.791522 4.485909 1.96 0.051 -.0251723 17.60822
    did2CM4_CVC | -2.948393 3.558306 -0.83 0.408 -9.941958 4.045172
    Area | .0215022 .0131952 1.63 0.104 -.004432 .0474363
    NbEmployees | .8065384 .3155003 2.56 0.011 .1864479 1.426629
    DaysWorked | 9.75966 3.459424 2.82 0.005 2.960439 16.55888
    Temp_Ext | 1.347507 .2983757 4.52 0.000 .7610738 1.933941
    Interet_Finant | 0 (omitted)
    _cons | -3.071327 6.958276 -0.44 0.659 -16.74726 10.60461
    --------------------------------------------------------------------------------
    */
    reg Conso_CVCkWhr timeB timeC did2BM1_CVC did2BM2_CVC did2BM3_CVC did2BM4_CVC did2CM1_CVC did2CM2_CVC did2CM3_CVC did2CM4_CVC Area NbEmployees DaysWorked Temp_Ext Interet_Finant, r
    /*
    note: timeC omitted because of collinearity
    note: did2BM1_CVC omitted because of collinearity
    note: did2CM1_CVC omitted because of collinearity
    note: Interet_Finant omitted because of collinearity

    Linear regression Number of obs = 448
    F( 11, 436) = 20.89
    Prob > F = 0.0000
    R-squared = 0.2783
    Root MSE = 30.071

    --------------------------------------------------------------------------------
    | Robust
    Conso_CVCkWhr | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
    timeB | 57.83895 5.898884 9.81 0.000 46.24517 69.43274
    timeC | 0 (omitted)
    did2BM1_CVC | 0 (omitted)
    did2BM2_CVC | -38.73751 5.970948 -6.49 0.000 -50.47293 -27.00209
    did2BM3_CVC | -37.57747 7.253134 -5.18 0.000 -51.83292 -23.32201
    did2BM4_CVC | -35.76314 8.474267 -4.22 0.000 -52.41863 -19.10765
    did2CM1_CVC | 0 (omitted)
    did2CM2_CVC | -2.962981 3.936796 -0.75 0.452 -10.70044 4.774475
    did2CM3_CVC | 8.791522 4.485909 1.96 0.051 -.0251723 17.60822
    did2CM4_CVC | -2.948393 3.558306 -0.83 0.408 -9.941958 4.045172
    Area | .0215022 .0131952 1.63 0.104 -.004432 .0474363
    NbEmployees | .8065384 .3155003 2.56 0.011 .1864479 1.426629
    DaysWorked | 9.75966 3.459424 2.82 0.005 2.960439 16.55888
    Temp_Ext | 1.347507 .2983757 4.52 0.000 .7610738 1.933941
    Interet_Finant | 0 (omitted)
    _cons | -3.071327 6.958276 -0.44 0.659 -16.74726 10.60461
    --------------------------------------------------------------------------------

    */

  • #2
    I think, I need to use sequential treatment and not difference and difference for my second analysis step ... does anyone know how sequential treatment works in STATA?

    Comment


    • #3
      Without seeing an example of your data it is difficult to be sure what is going wrong. But I can give you some general advice.

      First, there is no reason you can't do DID analysis in this set up. You just need to get the variables right.

      Second, it appears that the way you are representing the messages is setting up colinearity. Based on nothing but the names of the variables, it sounds like messages come in 4 categories: very positive, positive, negative, and very negative. And it sounds like these categories are mutually exclusive and exhaustive. If so, the four variables that represent them are necessarily colinear. And their interactions with treatment variables will also be colinear with the treatment. It is a mathematical impossibility to estimate a regression model with colinearity among the predictor variables, so in order to identify the model, some of those colinear variables have to be removed. Stata does this for you automatically, but it makes its own choices about which one(s) to remove, and perhaps those are not the choices you would prefer it to make.

      Third. Because you are not taking advantage of factor variable notation, your coding is much more complicated than it needs to be, resulting in extra lines of superfluous code and a regression command that is very long and confusing to read.

      So try something like this. Replace your four message variables by a single messaging variable coded 1 for very positive, 2 for positive, 3 for negative, and 4 for very negative (you can do it in reverse order if you prefer, the particular assignment of numbers to the categories doesn't really matter). Similarly, get rid of timeB and timeC. Replace them with a single time variable that is coded 0 for <= 4 weeks, 1 for 5-7 weeks, and 2 for 9-12 weeks (these three levels of the time variable correspond to the periods you have denoted by timeB and timeC.) Unless you are specifically interested in the company level coefficients (which is unusual in contexts like these) I would eliminate i.companies from the model and instead use -xtreg, fe-.

      So:

      Code:
      xtset companies
      xtreg Conso i.time##i.treated, vce(robust) fe
      
      xtreg Conso i.time##i.treated##i.messaging Area ///
          NbEmployees DaysWorked Temp_Ext Interet_Finant, ///
          vce(robust) fe
      Stata will silently drop one category for each of the time, treated, and messaging variables, as is appropriate. It will choose the lowest numbered category in each case. It will also omit treated because that is colinear with the company fixed effects (and this will not be done silently--it will tell you it is doing that, and you should not be concerned.)

      The next challenge you will face is interpreting the results. Three-way interactions are complicated. The -margins- command will greatly simplify the task. To learn about the -margins- command, I recommend you start with the excellent Richard Williams' https://www3.nd.edu/~rwilliam/stats/Margins01.pdf. It presents the basics of the command and includes examples with interaction models (though not, if I recall, any with a three-way interaction). But that should get you started.

      Comment


      • #4
        I do not know why but when I use xtreg my coefficients are not significant whereas with i.Companies yes, that's why I opted for reg

        I knew your advice and here is the result but again collinearity:

        xtreg Conso_CVCkWhr i.time##i.treated2##i.messaging, vce(robust) fe
        note: 1.treated2 omitted because of collinearity
        note: 2.time#1.treated2 omitted because of collinearity
        note: 1.treated2#2.messaging omitted because of collinearity
        note: 1.treated2#3.messaging omitted because of collinearity
        note: 1.treated2#4.messaging omitted because of collinearity
        note: 2.time#1.treated2#2.messaging omitted because of collinearity
        note: 2.time#1.treated2#3.messaging omitted because of collinearity
        note: 2.time#1.treated2#4.messaging omitted because of collinearity

        Fixed-effects (within) regression Number of obs = 448
        Group variable: Companies Number of groups = 8

        R-sq: within = 0.2563 Obs per group: min = 56
        between = 0.1996 avg = 56.0
        overall = 0.1053 max = 56

        F(7,7) = 214805.09
        corr(u_i, Xb) = -0.0531 Prob > F = 0.0000

        (Std. Err. adjusted for 8 clusters in Companies)
        -----------------------------------------------------------------------------------------
        | Robust
        Conso_CVCkWhr | Coef. Std. Err. t P>|t| [95% Conf. Interval]
        ------------------------+----------------------------------------------------------------
        2.time | -40.12693 13.87666 -2.89 0.023 -72.94001 -7.313843
        1.treated2 | 0 (omitted)
        |
        time#treated2 |
        2 1 | 0 (omitted)
        |
        messaging |
        2 | -8.086144 7.008483 -1.15 0.286 -24.65857 8.486284
        3 | -8.334049 9.763938 -0.85 0.422 -31.42209 14.75399
        4 | -6.438364 9.048285 -0.71 0.500 -27.83416 14.95743
        |
        time#messaging |
        2 2 | 23.96066 16.0912 1.49 0.180 -14.08898 62.0103
        2 3 | 14.42258 14.06096 1.03 0.339 -18.82631 47.67147
        2 4 | 24.39366 10.21295 2.39 0.048 .2438768 48.54344
        |
        treated2#messaging |
        1 2 | 0 (omitted)
        1 3 | 0 (omitted)
        1 4 | 0 (omitted)
        |
        time#treated2#messaging |
        2 1 2 | 0 (omitted)
        2 1 3 | 0 (omitted)
        2 1 4 | 0 (omitted)
        |
        _cons | 70.75708 4.66393 15.17 0.000 59.72863 81.78552
        ------------------------+----------------------------------------------------------------
        sigma_u | 26.883592
        sigma_e | 21.826019
        rho | .60272366 (fraction of variance due to u_i)
        -----------------------------------------------------------------------------------------


        Comment


        • #5
          Looking at the pattern of things that are being omitted due to colinearity, I wonder if you have the time variable improperly coded. I would expect to see this pattern of omissions if your time variable does not distinguish time periods A, B, and C in the untreated group. Even tough "nothing happens" to the untreated group over time, you still have to code the time the same way you would if they are treated. Perhaps this is the source of the problem? What does -tab time treated if e(sample)- show? Similarly, the messaging variables need to vary in the control groups.
          Last edited by Clyde Schechter; 28 Jan 2018, 10:46.

          Comment


          • #6

            my time variable is coded like this :
            gen time =.
            replace time = 0 if Day<29
            replace time = 1 if Day>=29 & Day<=56
            replace time = 2 if Day>=57
            whether companies are treated or not the times are the same

            tab time treated2 if e(sample) give me this

            | treated2
            time | 1 | Total
            -----------+-----------+----------
            1 | 224 | 224
            2 | 224 | 224
            -----------+-----------+----------
            Total | 448 | 448

            tab messaging time vary in the treated group but not in the controled group

            | time
            messaging | 1 2 | Total
            -----------+----------------------+----------
            1 | 42 35 | 77
            2 | 63 84 | 147
            3 | 70 70 | 140
            4 | 49 35 | 84
            -----------+----------------------+----------
            Total | 224 224 | 448

            in the case of control group I have messaging = . (no observation)




            Comment


            • #7
              in the case of control group I have messaging = . (no observation)
              THAT is the problem. When you include the messaging variables (or their interactions) in the model, the entire control group is dropped from the estimation sample. Remember that the estimation sample includes only observations with non-missing values of every variable in the regression. If even a single variable has a missing value, the observation is excluded. This is not some peculiarity of Stata: that is a mathematical necessity.

              If there is no messaging at all in the control group, then you cannot estimate effects of messaging in a model that includes the control group. To estimate the effects of messaging you would need to do a separate analysis among the treated group only. That model, of course, would have to exclude all mention of the treated variable, as it would then be colinear with the fixed effects. So you have to do something like this:

              Code:
              xtreg Conso_CVCkWhr i.time##i.messaging if treated2 == 1, vce(robust) fe
              Note: The 1 in the above command is what I assume is the value of treated2 in the group that received treatment (and messaging). If I have that wrong, replace it by whatever the value that designates the treatment group is.

              Comment


              • #8
                Do you think it's right?

                xtreg Conso_CVCkWhr i.time##i.messaging if treated2 == 1, vce(robust) fe
                note: 3.messaging omitted because of collinearity
                note: 1.time#3.messaging omitted because of collinearity
                note: 1.time#4.messaging omitted because of collinearity
                note: 2.time#2.messaging omitted because of collinearity
                note: 2.time#4.messaging omitted because of collinearity

                Fixed-effects (within) regression Number of obs = 595
                Group variable: Companies Number of groups = 8

                R-sq: within = 0.3528 Obs per group: min = 63
                between = 0.1663 avg = 74.4
                overall = 0.1402 max = 84

                F(6,7) = 13.43
                corr(u_i, Xb) = -0.0318 Prob > F = 0.0016

                (Std. Err. adjusted for 8 clusters in Companies)
                --------------------------------------------------------------------------------
                | Robust
                Conso_CVCkWhr | Coef. Std. Err. t P>|t| [95% Conf. Interval]
                ---------------+----------------------------------------------------------------
                time |
                1 | -14.59299 4.345037 -3.36 0.012 -24.86737 -4.318615
                2 | -27.52744 9.043126 -3.04 0.019 -48.91103 -6.143841
                |
                messaging |
                2 | -5.888854 9.16574 -0.64 0.541 -27.56239 15.78468
                3 | 0 (omitted)
                4 | -1.128175 7.226914 -0.16 0.880 -18.21711 15.96076
                |
                time#messaging |
                0 2 | 0 (empty)
                0 3 | 0 (empty)
                0 4 | 0 (empty)
                1 0 | 0 (empty)
                1 2 | 2.50084 8.521885 0.29 0.778 -17.65022 22.65189
                1 3 | 0 (omitted)
                1 4 | 0 (omitted)
                2 0 | 0 (empty)
                2 2 | 0 (omitted)
                2 3 | -17.54487 15.24418 -1.15 0.288 -53.59164 18.50189
                2 4 | 0 (omitted)
                |
                _cons | 77.57827 2.658855 29.18 0.000 71.29108 83.86546
                ---------------+----------------------------------------------------------------
                sigma_u | 32.852452
                sigma_e | 21.534084
                rho | .69947072 (fraction of variance due to u_i)
                --------------------------------------------------------------------------------

                Comment


                • #9
                  No, it doesn't look right. At this point we involved in a situation where I'm in effect trying to reconstruct what your data look like from the patterns of odd results you are getting. I think at this point you need to show an example of the data itself. Use the -dataex- command to do that. (If you are not familiar with -dataex-, read FAQ #12 for information on how to get and use it.)


                  Comment


                  • #10
                    Hi Clyde,

                    In copy here is a part of the database as well as a dofiles which explains the variables

                    can you look please ?
                    Clyde.do Clyde.dta
                    Attached Files
                    Last edited by Alice Kira; 28 Jan 2018, 13:41.

                    Comment


                    • #11
                      So looking at the data, the messaging variable is also missing in time 0. So, again, you can't estimate its effects in a model that includes time 0. You can some normal looking results by restricting the analysis to the treated group in times 1 and 2:

                      Code:
                      . xtreg Conso_CVCkWhr i.time##i.messaging if treated2 == 1 & time != 0, fe
                      
                      Fixed-effects (within) regression               Number of obs     =        448
                      Group variable: Companies                       Number of groups  =          8
                      
                      R-sq:                                           Obs per group:
                           within  = 0.2563                                         min =         56
                           between = 0.1996                                         avg =       56.0
                           overall = 0.1053                                         max =         56
                      
                                                                      F(7,433)          =      21.31
                      corr(u_i, Xb)  = -0.0531                        Prob > F          =     0.0000
                      
                      --------------------------------------------------------------------------------
                       Conso_CVCkWhr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      ---------------+----------------------------------------------------------------
                              2.time |  -40.12693   5.131482    -7.82   0.000    -50.21264   -30.04122
                                     |
                           messaging |
                                  2  |  -8.086144   4.723315    -1.71   0.088    -17.36962    1.197332
                                  3  |  -8.334049   4.906007    -1.70   0.090     -17.9766    1.308501
                                  4  |  -6.438364   4.977229    -1.29   0.197     -16.2209     3.34417
                                     |
                      time#messaging |
                                2 2  |   23.96066   6.299347     3.80   0.000     11.57956    36.34176
                                2 3  |   14.42258   6.569615     2.20   0.029     1.510282    27.33488
                                2 4  |   24.39366   7.160717     3.41   0.001     10.31957    38.46775
                                     |
                               _cons |   70.75708   3.707709    19.08   0.000     63.46973    78.04442
                      ---------------+----------------------------------------------------------------
                             sigma_u |  26.883592
                             sigma_e |  21.826019
                                 rho |  .60272366   (fraction of variance due to u_i)
                      --------------------------------------------------------------------------------
                      F test that all u_i=0: F(7, 433) = 65.68                     Prob > F = 0.0000
                      Note, by the way, that I have omitted the vce(robust) specification here. With -xtreg, fe-, the robust VCE is taken to be the cluster robust variance estimator. That estimator is not valid when the number of groups is small. While there is no universally accepted minimum number of groups, I think everyone who has opined on the matter agrees that 8 is too few.

                      By the way, in the future, the best way to post example data is with the -dataex- command. If you are running Stata version 15.1, it is part of your official installation. If not, run -ssc install dataex- to get it. Then, in either case, read -help dataex- for instructions on using it. It is simpler to use, both for the person posting and the person receiving the data, than attaching a .dta file.

                      Added: You can add the other covariates to the model. I notice that those variables have no missing values at all. However, I notice that some of them are constant within company, and will therefore be omitted due to colinearity with the company fixed effect..
                      Last edited by Clyde Schechter; 28 Jan 2018, 13:40.

                      Comment


                      • #12
                        Thanks you Clyde ... I will see this ...

                        Comment

                        Working...
                        X