Announcement

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

  • Comparing fixed effects coefficients between two groups


    Dear all, I have estimated a fixed effect panel regression model for two groups in my data set. And I want to test if the coefficients are significantly different for both group.
    For example, I have:
    xtreg y x1 x2 x3 if n>1, fe robust
    xtreg y x1 x2 x3 if n==1, fe robust

    I am trying to test if x1 (coefficient) in regression 1 is different (greater) than x1 (coefficient) in regression 2. n is the number of division a firm has.

    The "suest" command does not work for xtreg and again I am using a FIXED effect regression.
    I have looked everywhere for a test on stata but I only got more confused by the various different answers.
    Can anyone help me and provide me with an easy fix for this problem?

    Thank you so much.

  • #2
    I don't know much about this, but could you use suest with reg instead?

    reg y x1 x2 x3 i.unit if n > 1, vce(robust)

    where unit is your panel variable.

    Does this solve your problem?

    Comment


    • #3
      As you noted, -suest- doesn't support -xtreg-. So you have to do it using interactions (which I think is a better approach in any case):

      Code:
      gen byte nn = (n > 1) if !missing(n)
      xtreg i.nn##(c.x1 c.x2 c.x3), fe robust
      test 1.nn#x1 1.nn#x2 1.nn#x3
      Note: Assumes x1, x2, x3 are continuous variables. If any of them are cateogrical, replace c. by i. in the -xtreg-, and modify the -test- command accordingly as well.

      Comment


      • #4
        Clyde Schechter Thank you for your answer!

        Indeed x1 is a dummy variable with x1=1 if female and x1=0 if male. I want to compare the effect of having a female (x1) between firms with n>1 and n=1.
        Meaning I want to compare if the contribution in value (in y) of a female (x1=1) is greater when n>1 versus n=1 by doing a test between my two FE regressions.

        I am not sure using interaction approach is better since I will be comparing female in n>1 with male in n=1.Which is not what I want. I want to compare female in n>1 to female in n=1.
        Is there another way to do it?

        Thanks again!

        Comment


        • #5
          I am not sure using interaction approach is better since I will be comparing female in n>1 with male in n=1.Which is not what I want.
          Why do you think that? That's not true at all. Read the manual section on factor variables (-help fvvarlist-, then link to the manual from there) to get a better understanding of how it works.

          The modification for the code, since x1 is dichotomous is:

          Code:
          xtreg y i.nn##(i.x1 c.x2 c.x3), fe robust
          test 1.nn#1.x1.nn#x2 1.nn#x3

          Comment


          • #6
            Thank you Clyde for your answer! Sorry for the late answer, I was trying to figure it out.
            I did read the manual on factor variables, tough I am still a bit confused. If you will allow me to get some clarifications from you about the interaction term between gender and y. Just to be sure..

            For the interaction variable i.nn#i.x1 between 2 dummy variables, nn=1 or nn=0 and female=1 or female=0, how can I interpret it? What does it capture?
            Can I say it is the difference between: ( Female in nn=1 (n>1) - Female in nn=0 (n=1)) - (Male in nn=1 (n>1) - Male in nn=0 (n=1)) ?
            So in other word with y being the performance of the firm, the interaction term captures the difference in performance in the difference between female and male in nn=1 and female and male in nn=0?

            My second question is probably obvious: I only want to test if the difference in value contribution between females in nn=1 and nn=0 is significant , So can I just leave the other interaction terms out of my regressions, i.nn#c.x2 and i.nn#c.x3 and test for 1.nn#1.x1 alone or is it better to also include them?

            Thank you so much.

            Comment


            • #7
              Can I say it is the difference between: ( Female in nn=1 (n>1) - Female in nn=0 (n=1)) - (Male in nn=1 (n>1) - Male in nn=0 (n=1)) ?
              So in other word with y being the performance of the firm, the interaction term captures the difference in performance in the difference between female and male in nn=1 and female and male in nn=0?
              Yes, that is exactly right.

              My second question is probably obvious: I only want to test if the difference in value contribution between females in nn=1 and nn=0 is significant , So can I just leave the other interaction terms out of my regressions, i.nn#c.x2 and i.nn#c.x3 and test for 1.nn#1.x1 alone or is it better to also include them?
              This one is not obvious; in fact it doesn't have a simple answer. If you exclude the i.nn#c.x2 and i.nn#c.x3 terms from the model, then you are estimating the difference in the effect of x1 in nn=1 firms from the effect of x1 in nn = 0 firms, subject to the assumption that the effects of x2 and x3 are the same regardless of the value of nn. If that is a reasonable assumption (either a priori or because your regression shows the coefficients of those interactions to be effectively zero), then you can leave them out.

              But if x2 or x3's effect also depends on nn to an appreciable extent, then omitting their interaction terms mis-specifies the model. And unless x1 is independent of x2 and x3, that mis-specification could lead to an incorrect estimate of the 1.nn#1.x1 coefficient. So you really do need to think about whether the i.nn#c.x2 and i.nn#c.x3 interactions are important in the model as a whole. If they are, then you also need them to correctly estimate 1.nn#1.x1.

              So it really depends on what x1, x2, and x3 are, and the relationships among them. My experience working in clinical epidemiology is that in most cases it is OK to omit the interaction terms involving x2 and x3. But, some variables, and sex is one of them, tend to be entangled with nearly everything else, so I would guess that in your particular situation, there is a good chance that you need to keep those other two interaction terms. But it really depends on what x2 and x3 are and how they do or don't, themselves, distribute differently by sex.

              Comment


              • #8
                I am wondering how is it possible to include dummy variables and get the coefficients for that in a FE model. Wouldn't those variables be invariant to time for each of the cross-section units and hence excluded in the FE models?

                I am working on a similar panel data fixed effect model and I want to compare if trends for control and treatment groups were the same before the treatment started. I have an indicator variable to indicate years before treatment and a dummy variable to indicate treatment or control group. When I ran the model with interaction term as suggested above, it dropped the treatment dummy variable from the model and I did not give any coefficients on the dummy variable as well as the interaction term. Am I missing something here? Your help would be much appreciated.

                Comment


                • #9
                  There is no general reason why an indicator ("dummy") variable cannot be included in a fixed-effects model. It will, as you note, be omitted if what it represents is a time-invariant attribute of the panel because it will then be colinear with the panel fixed effects. But there are plenty of indicator variables that vary over time within a panel, and those can be included.

                  I am working on a similar panel data fixed effect model and I want to compare if trends for control and treatment groups were the same before the treatment started. I have an indicator variable to indicate years before treatment and a dummy variable to indicate treatment or control group. When I ran the model with interaction term as suggested above, it dropped the treatment dummy variable from the model and I did not give any coefficients on the dummy variable as well as the interaction term.
                  In this kind of classic difference in differences analysis, the status of a group as treatment or control is a time-invariant attribute, and as such it is colinear with the fixed effect. So it is always omitted from the fixed effects regression analysis. But this is not a problem. It is of no importance in that analysis anyway. Only the interaction term is important.

                  The interaction term, by contrast, must not be omitted from the analysis. The fact that yours is being dropped tells me that you have something wrong with your data or you have coded the regression incorrectly. Without seeing an example of the data, the exact command you ran, and the exact Stata output you got, no more specific advice is possible.

                  In the future, when showing data examples, please use the -dataex- command to do so. If you are running version 15.1 or a fully updated version 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

                  For advice on the most helpful ways to show code and output (code delimiters), please read Forum FAQ #12.

                  Comment


                  • #10
                    Sorry my notification was off.

                    Here is my model, output and the first 100 observations of the data from dataex command

                    xtreg diff_nincpac fmsz prcrp prown mcrpyd dbassra insexp age i.year c.Entry##c.Treat,fe robust


                    In this model I am trying to figure out if net farm income trends were similar in the treatment and control groups before the adoption of at least one new farm technology. In the data, Entry=1, if the years are before the adoption of the technology and Entry=0 if the years are after the technology adoption. Treat=1 if the farm adopted the technology Treat =0 if no adoption of farm tech.

                    Alternatively, xtreg diff_nincpac fmsz prcrp prown mcrpyd dbassra insexp age i.year Entry Treat EntryTreat,fe robust also gave me similar results.

                    note: Treat omitted because of collinearity
                    note: c.Entry#c.Treat omitted because of collinearity

                    Fixed-effects (within) regression Number of obs = 3,200
                    Group variable: fmid Number of groups = 379

                    R-sq: Obs per group:
                    within = 0.0620 min = 1
                    between = 0.0029 avg = 8.4
                    overall = 0.0386 max = 13

                    F(20,378) = 12.98
                    corr(u_i, Xb) = -0.3828 Prob > F = 0.0000

                    (Std. Err. adjusted for 379 clusters in fmid)
                    ---------------------------------------------------------------------------------
                    | Robust
                    diff_nincpac | Coef. Std. Err. t P>|t| [95% Conf. Interval]
                    --------------- -+ ----------- ------------ ---------------- --- ------------ ----------
                    fmsz | -0.00614 0.007374 -0.83 0.406 -0.02064 0.008363
                    prcrp | -0.08057 0.196422 -0.41 0.682 -0.46679 0.305642
                    prown | -0.04397 0.200332 -0.22 0.826 -0.43788 0.349934
                    mcrpyd | 0.650227 0.099867 6.51 0.000 0.453864 0.846591
                    dbassra | 31.96468 23.92342 1.34 0.182 -15.075 79.00434
                    insexp | 0.000129 4.77E-05 2.71 0.007 3.54E-05 0.000223
                    age | 0.412197 0.494424 0.83 0.405 -0.55997 1.384363
                    |
                    year |
                    2003 | 47.1531 9.144061 5.16 0.000 29.1735 65.1327
                    2004 | -2.80879 10.95984 -0.26 0.798 -24.3587 18.7411
                    2005 | -11.5911 9.221655 -1.26 0.210 -29.7233 6.541041
                    2006 | -1.36005 8.564777 -0.16 0.874 -18.2006 15.48052
                    2007 | 48.15876 9.563847 5.04 0.000 29.35375 66.96377
                    2008 | 8.864654 11.44278 0.77 0.439 -13.6348 31.36413
                    2009 | -29.9079 10.94534 -2.73 0.007 -51.4293 -8.38656
                    2010 | 35.18212 11.742 3.00 0.003 12.0943 58.26994
                    2011 | 8.63281 12.59804 0.69 0.494 -16.1382 33.40382
                    2012 | 30.76521 13.93133 2.21 0.028 3.372607 58.15782
                    2013 | 1.899481 13.54333 0.14 0.889 -24.7302 28.52919
                    2014 | -21.0653 16.1294 -1.31 0.192 -52.7799 10.64929
                    |
                    Entry | -0.98444 6.012356 -0.16 0.870 -12.8063 10.83742
                    Treat | 0 (omitted)
                    |
                    c.Entry#c.Treat | 0 (omitted)
                    |
                    _cons | -83.2787 41.60683 -2.00 0.046 -165.089 -1.46882
                    --------------- -+ ----------- ------------ ---------------- --- ------------ ----------
                    sigma_u | 46.6481
                    sigma_e | 114.5074
                    rho | 0.142337 (fraction of variance due to u_i)
                    --------------- -- ----------- ------------ ---------------- --- ------------ ----------

                    input long fmid int(year ym_gps) float autogps int(sc_gps gss vrf vrs) float(sum onetech Entry Treat EntryTreat)
                    11402300 1982 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1983 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1984 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1985 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1986 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1987 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1988 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1989 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1990 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1991 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1995 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1996 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1997 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1998 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 1999 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 2000 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 2001 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 2002 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 2003 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 2004 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 2005 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 2006 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 2007 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 2008 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 2009 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 2010 2016 2011 2013 9999 9999 9999 3 0 1 1 1
                    11402300 2011 2016 2011 2013 9999 9999 9999 3 1 0 1 0
                    11402300 2012 2016 2011 2013 9999 9999 9999 3 1 0 1 0
                    11402300 2013 2016 2011 2013 9999 9999 9999 3 1 0 1 0
                    11402300 2014 2016 2011 2013 9999 9999 9999 3 1 0 1 0
                    11402700 1982 . . . . . . 0 0 1 0 0
                    11402700 1983 . . . . . . 0 0 1 0 0
                    11402700 1984 . . . . . . 0 0 1 0 0
                    11402700 1985 . . . . . . 0 0 1 0 0
                    11402700 1986 . . . . . . 0 0 1 0 0
                    11402700 1987 . . . . . . 0 0 1 0 0
                    11402700 1988 . . . . . . 0 0 1 0 0
                    11402700 1989 . . . . . . 0 0 1 0 0
                    11402700 1990 . . . . . . 0 0 1 0 0
                    11402700 1991 . . . . . . 0 0 1 0 0
                    11402700 1995 . . . . . . 0 0 1 0 0
                    11402700 1996 . . . . . . 0 0 1 0 0
                    11402700 1997 . . . . . . 0 0 1 0 0
                    11402700 1998 . . . . . . 0 0 1 0 0
                    11402700 1999 . . . . . . 0 0 1 0 0
                    11402700 2000 . . . . . . 0 0 1 0 0
                    11402700 2001 . . . . . . 0 0 1 0 0
                    11402700 2003 . . . . . . 0 0 1 0 0
                    11402700 2004 . . . . . . 0 0 1 0 0
                    11402700 2005 . . . . . . 0 0 1 0 0
                    11402700 2006 . . . . . . 0 0 1 0 0
                    11402700 2007 . . . . . . 0 0 1 0 0
                    11402700 2008 . . . . . . 0 0 1 0 0
                    11402700 2009 . . . . . . 0 0 1 0 0
                    11402700 2010 . . . . . . 0 0 1 0 0
                    11402700 2011 . . . . . . 0 0 1 0 0
                    11402700 2012 . . . . . . 0 0 1 0 0
                    11403402 1991 1998 2008 9999 2001 9999 9999 3 0 1 1 1
                    11403402 1992 1998 2008 9999 2001 9999 9999 3 0 1 1 1
                    11403402 1993 1998 2008 9999 2001 9999 9999 3 0 1 1 1
                    11403402 1994 1998 2008 9999 2001 9999 9999 3 0 1 1 1
                    11403402 1995 1998 2008 9999 2001 9999 9999 3 0 1 1 1
                    11403402 1996 1998 2008 9999 2001 9999 9999 3 0 1 1 1
                    11403402 1997 1998 2008 9999 2001 9999 9999 3 0 1 1 1
                    11403402 1998 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 1999 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2000 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2001 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2002 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2003 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2004 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2005 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2006 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2007 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2008 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2009 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2010 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2011 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2012 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2013 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11403402 2014 1998 2008 9999 2001 9999 9999 3 1 0 1 0
                    11407100 2007 2011 2007 2010 9999 2012 9999 4 1 0 1 0
                    11407100 2008 2011 2007 2010 9999 2012 9999 4 1 0 1 0
                    11407100 2009 2011 2007 2010 9999 2012 9999 4 1 0 1 0
                    11407100 2010 2011 2007 2010 9999 2012 9999 4 1 0 1 0
                    11407100 2011 2011 2007 2010 9999 2012 9999 4 1 0 1 0
                    11407100 2012 2011 2007 2010 9999 2012 9999 4 1 0 1 0
                    11407100 2013 2011 2007 2010 9999 2012 9999 4 1 0 1 0
                    11407100 2014 2011 2007 2010 9999 2012 9999 4 1 0 1 0
                    11413000 2013 9999 2015 9999 9999 9999 9999 1 0 1 1 1
                    11413000 2014 9999 2015 9999 9999 9999 9999 1 0 1 1 1
                    11482100 1983 . . . . . . 0 0 1 0 0
                    11482100 1984 . . . . . . 0 0 1 0 0
                    11482100 1986 . . . . . . 0 0 1 0 0
                    11482100 1987 . . . . . . 0 0 1 0 0
                    11482100 1990 . . . . . . 0 0 1 0 0
                    11482100 1991 . . . . . . 0 0 1 0 0
                    11482100 1992 . . . . . . 0 0 1 0 0
                    11482100 1993 . . . . . . 0 0 1 0 0
                    11482100 1994 . . . . . . 0 0 1 0 0
                    end
                    [/CODE]
                    ------------------ copy up to and including the previous line ------------------

                    Listed 100 out of 9499 observations
                    Last edited by Sunil Dhoubhadel; 22 Feb 2019, 11:05.

                    Comment


                    • #11
                      Sunil:
                      your data excerpt does not include the regressand -diff_nincpac-, making it impossible to reproduce your regression model.
                      Kind regards,
                      Carlo
                      (Stata 19.0)

                      Comment


                      • #12
                        Sunil:
                        at a more careful second look, your data also contain many -9999- that I interpret like missing value placeholders.
                        Unfortunately, Stata reads them as meningful numbers.
                        Kind regards,
                        Carlo
                        (Stata 19.0)

                        Comment


                        • #13
                          Carlos,

                          Given below are the 100 observations of all the variables used in the model. There are total of 9499 observations which I have not included. The 9999 are the indicator numbers that I included to generate some other variables. These generated variables are not included in the model and I have excluded them in the data set below. Clyde wanted to take a look at the data so I thought 100 observations may be fine. Please let me know if I need to include all observations.

                          Regards,
                          Sunil

                          input long fmid int year float(fmsz dbassra insexp) byte age float(prcrp prown mcrpyd diff_nincpac Entry Treat EntryTreat)
                          11402300 1982 2747 . . 62 62.24973 0 . . 1 1 1
                          11402300 1983 1784 . . 30 61.79372 0 . 18.381329 1 1 1
                          11402300 1984 1697 . . 28 100 15.085444 . 24.7158 1 1 1
                          11402300 1985 1379 . . 30 100.029 0 . -53.22943 1 1 1
                          11402300 1986 1243 . . 30 100.04827 0 . 20.541224 1 1 1
                          11402300 1987 1215 . . 35 100 0 . 24.13819 1 1 1
                          11402300 1988 3401 . . 30 52.66098 0 . -20.80299 1 1 1
                          11402300 1989 5156 . . 33 33.87898 0 . -23.66608 1 1 1
                          11402300 1990 3388 . . . 52.47934 0 . 36.44645 1 1 1
                          11402300 1991 2945 . . 38 52.46519 0 . -30.14984 1 1 1
                          11402300 1995 2888 . . 42 67.860115 0 . . 1 1 1
                          11402300 1996 3068 . . 43 69.7425 0 . 90.96358 1 1 1
                          11402300 1997 2963 . . 44 68.66014 0 . -42.65237 1 1 1
                          11402300 1998 2795 . . 45 66.855095 0 . -38.90766 1 1 1
                          11402300 1999 2809 . . 46 67.002495 0 . 14.352616 1 1 1
                          11402300 2000 2808 . . 47 66.99786 0 . -11.306655 1 1 1
                          11402300 2001 2634 . . 48 64.840546 0 . 7.479562 1 1 1
                          11402300 2002 4262 .84 8169 49 48.43735 0 . -23.691475 1 1 1
                          11402300 2003 2821 .98 3775 50 64.112015 0 . 54.61241 1 1 1
                          11402300 2004 2408 .83 0 51 81.6902 0 . -26.32172 1 1 1
                          11402300 2005 3188 .85 17762 52 61.74718 0 . 4.32806 1 1 1
                          11402300 2006 3194.1 .84 11763.28 53 61.80457 0 . -32.22518 1 1 1
                          11402300 2007 3207.3 .92 73028 54 58.37621 0 . 60.72328 1 1 1
                          11402300 2008 3209.4 .85 4045 54 58.40344 0 . -19.025824 1 1 1
                          11402300 2009 3185.5 .81 1843 56 58.09135 0 129.8 58.90582 1 1 1
                          11402300 2010 3221.5 .61 0 57 57.47323 0 96.64959 -59.1106 1 1 1
                          11402300 2011 3343.1 .61 14528 58 57.07576 0 48.34425 29.770525 0 1 0
                          11402300 2012 3878.8 .55 10718 59 56.22358 0 48.47396 -47.01818 0 1 0
                          11402300 2013 4549.5 .591 6754 60 62.61127 0 134.9 74.51344 0 1 0
                          11402300 2014 4690.2 .416 0 61 62.19777 0 100.13308 -42.27399 0 1 0
                          11402700 1982 2815 . . 55 84.36945 86.92718 106 . 1 0 0
                          11402700 1983 2780 . . 56 84.17266 78.84892 . 26.13455 1 0 0
                          11402700 1984 2633 . . 57 81.57995 0 52 -32.109295 1 0 0
                          11402700 1985 2657 . . 58 81.93451 0 90 17.953445 1 0 0
                          11402700 1986 2621 . . 59 81.68638 0 90 -36.675095 1 0 0
                          11402700 1987 1833 . . 58 73.86252 100 87 55.99545 1 0 0
                          11402700 1988 1796 . . 61 73.27394 0 . 25.52032 1 0 0
                          11402700 1989 2274 . . . 78.89182 0 76 -32.791016 1 0 0
                          11402700 1990 2209 . . 60 79.66048 0 . 30.68497 1 0 0
                          11402700 1991 2034 . . 60 75.90954 1.9665684 . -30.94422 1 0 0
                          11402700 1995 2029 . . 40 77.36816 0 55.3 . 1 0 0
                          11402700 1996 2048 . . 41 77.56348 0 130 79.4662 1 0 0
                          11402700 1997 1397 . . 42 100 0 108.9 46.65617 1 0 0
                          11402700 1998 2304 . . 43 80.90278 0 92 -161.3761 1 0 0
                          11402700 1999 1860 . . 44 89.24731 0 113 75.3 1 0 0
                          11402700 2000 2113 . . 45 78.26313 0 116.6 -112.49254 1 0 0
                          11402700 2001 1895 . . 46 87.36148 0 104.8 136.33286 1 0 0
                          11402700 2003 2608 .59 0 48 83.15951 0 88.4 . 1 0 0
                          11402700 2004 3263 .58 65362 49 86.53387 0 154.3 32.16532 1 0 0
                          11402700 2005 3390 .51 23770 50 86.51622 0 61 -64.11245 1 0 0
                          11402700 2006 3409 .67 31122.21 51 86.56497 0 47.4 72.685974 1 0 0
                          11402700 2007 3686.2 .57 238669.3 52 87.57528 4.99159 103.7 45.87577 1 0 0
                          11402700 2008 3710 .51 64217 52 87.65498 0 27.4 106.92426 1 0 0
                          11402700 2009 3839 .31 3200 55 88.53868 0 146.7 -19.259995 1 0 0
                          11402700 2010 3794 .38 0 56 88.40274 0 80 -122.8338 1 0 0
                          11402700 2011 4013 .38 473868 57 89.03564 0 . -39.10384 1 0 0
                          11402700 2012 3440 .31 367042 58 87.2093 0 . -3.098904 1 0 0
                          11403402 1991 937 . . 37 41.34472 95.30416 . . 1 1 1
                          11403402 1992 904 . . 38 97.63274 42.25664 . -60.50006 1 1 1
                          11403402 1993 1041 . . 39 100.0096 51.8732 . -8.447044 1 1 1
                          11403402 1994 1883 . . 40 56.22411 54.80616 . -17.200144 1 1 1
                          11403402 1995 958 . . 41 100.04176 56.88935 . -57.4517 1 1 1
                          11403402 1996 1505 . . 42 57.78738 79.00332 48.8 55.265 1 1 1
                          11403402 1997 1539 . . 43 58.2911 77.64782 . 63.72388 1 1 1
                          11403402 1998 845 . . 44 100.08284 74.08284 . -107.58773 0 1 0
                          11403402 1999 1328 . . 45 64.00603 91.56626 . 35.185898 0 1 0
                          11403402 2000 899 . . 46 98.46497 70.41157 . 34.28411 0 1 0
                          11403402 2001 958 . . 47 100.01044 88.30898 18.9 -52.73912 0 1 0
                          11403402 2002 1460 .6 26744 48 67.30822 93.0137 . 20.379944 0 1 0
                          11403402 2003 1438 .53 13248 49 66.79416 92.90681 . 78.4697 0 1 0
                          11403402 2004 946 .52 0 50 100.08456 84.88372 . -75.072174 0 1 0
                          11403402 2005 1026 .27 0 51 100.02924 68.22612 . -40.20681 0 1 0
                          11403402 2006 904.7 .23 5161 52 100 94.1417 . 92.10135 0 1 0
                          11403402 2007 1252 .28 88863 53 100.00799 80.03993 . -27.23736 0 1 0
                          11403402 2008 1217.9 .37 0 53 100 75.96683 . 61.33228 0 1 0
                          11403402 2009 1174.9 .38 32014 55 100 76.84058 125.3 3.102371 0 1 0
                          11403402 2010 1206.4 .22 0 56 100 77.12202 94.39999 -74.94391 0 1 0
                          11403402 2011 1495.3 .24 172673.25 57 100 53.63472 9.941385 96.91341 0 1 0
                          11403402 2012 1138.2 .23 150527.75 58 100 70.462135 1.95 78.58161 0 1 0
                          11403402 2013 1125.8 .157 0 59 92.54752 71.23823 122.11 -36.954926 0 1 0
                          11403402 2014 1089.5 .187 13721 60 100 79.02708 80.4 -137.19357 0 1 0
                          11407100 2007 1137.4 .22 7862 29 100 24.283455 . . 0 1 0
                          11407100 2008 1211.5 .18 0 30 100 22.798185 127.4 188.1835 0 1 0
                          11407100 2009 1217.9 .04 140 31 100 23.097134 . -128.89362 0 1 0
                          11407100 2010 1319.9 .09 0 32 97.13615 30.93416 89.3 -163.9875 0 1 0
                          11407100 2011 1318.9 .19 26155 33 97.05815 30.881794 50.95188 38.85012 0 1 0
                          11407100 2012 1321.4 .14 28899 34 97.06371 30.87634 0 155.57947 0 1 0
                          11407100 2013 1398.4 .108 0 35 97.13959 35.89817 . 54.56421 0 1 0
                          11407100 2014 1121.2 .211 3353 36 96.4324 44.77346 104.14751 -121.25427 0 1 0
                          11413000 2013 1860 .279 3052.35 59 64.22581 54.13979 . . 1 1 1
                          11413000 2014 1961.2 .27 32162 60 60.68733 48.74567 . -15.565296 1 1 1
                          11482100 1983 4600 . . 35 43.26087 10.869565 . . 1 0 0
                          11482100 1984 4770 . . 36 46.85535 10.48218 . -19.3558 1 0 0
                          11482100 1986 5630 . . 38 33.548847 9.236235 . . 1 0 0
                          11482100 1987 4503 . . 42 35.41639 11.103708 . 12.960278 1 0 0
                          11482100 1990 5587 . . 44 42.51297 20.70879 . . 1 0 0
                          11482100 1991 6034 . . 45 40.33809 8.170368 . -107.4188 1 0 0
                          11482100 1992 4877 . . 46 46.93459 11.790035 . 80.45451 1 0 0
                          11482100 1993 6384 . . 47 37.734962 9.022556 12.423077 -10.314356 1 0 0
                          11482100 1994 3047 . . 48 100 0 91.57233 -7.833067 1 0 0
                          end
                          [/CODE]
                          ------------------ copy up to and including the previous line ------------------

                          Listed 100 out of 9499 observations
                          Use the count() option to list more

                          Comment


                          • #14
                            Sunil:
                            - I assume you've already checked via -hausman- that -fe- is the way to go;
                            - as per your data excerpt:
                            Code:
                            . xtreg diff_nincpac fmsz prcrp prown mcrpyd dbassra insexp age i.year c.Entry##c.Treat,fe robust
                            note: Treat omitted because of collinearity
                            note: c.Entry#c.Treat omitted because of collinearity
                            
                            Fixed-effects (within) regression               Number of obs     =         24
                            Group variable: fmid                            Number of groups  =          4
                            
                            R-sq:                                           Obs per group:
                                 within  = 0.9600                                         min =          5
                                 between = 0.6413                                         avg =        6.0
                                 overall = 0.0039                                         max =          7
                            
                                                                            F(3,3)            =          .
                            corr(u_i, Xb)  = -0.9996                        Prob > F          =          .
                            
                                                                  (Std. Err. adjusted for 4 clusters in fmid)
                            ---------------------------------------------------------------------------------
                                            |               Robust
                               diff_nincpac |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                            ----------------+----------------------------------------------------------------
                                       fmsz |   .1803487   .0718401     2.51   0.087    -.0482785    .4089759
                                      prcrp |  -.7404936   8.668253    -0.09   0.937    -28.32674    26.84576
                                      prown |   13.22981   5.674026     2.33   0.102    -4.827477    31.28709
                                     mcrpyd |  -4.119262   2.335145    -1.76   0.176    -11.55073     3.31221
                                    dbassra |  -285.4652   285.8553    -1.00   0.392    -1195.184     624.254
                                     insexp |   .0002298   .0003751     0.61   0.583    -.0009638    .0014234
                                        age |   302.3013   179.9316     1.68   0.192    -270.3213    874.9239
                                            |
                                       year |
                                      2005  |  -816.2493   384.0205    -2.13   0.124    -2038.374    405.8752
                                      2006  |  -997.1796    603.639    -1.65   0.197    -2918.228    923.8692
                                      2007  |  -1285.895   733.5743    -1.75   0.178    -3620.456    1048.666
                                      2008  |  -1454.384   829.9913    -1.75   0.178    -4095.787    1187.018
                                      2009  |  -2078.652   1086.681    -1.91   0.152    -5536.955    1379.651
                                      2010  |  -2696.701   1377.741    -1.96   0.145    -7081.287    1687.885
                                      2011  |  -2926.137   1666.268    -1.76   0.177    -8228.945    2376.672
                                      2012  |  -3396.912   1876.872    -1.81   0.168    -9369.956    2576.132
                                      2013  |  -3336.931   1816.424    -1.84   0.164    -9117.602     2443.74
                                      2014  |  -3970.864   2063.366    -1.92   0.150    -10537.42    2595.688
                                            |
                                      Entry |      220.5    21.2293    10.39   0.002     152.9389    288.0611
                                      Treat |          0  (omitted)
                                            |
                            c.Entry#c.Treat |          0  (omitted)
                                            |
                                      _cons |  -13279.77   7253.356    -1.83   0.165    -36363.18    9803.648
                            ----------------+----------------------------------------------------------------
                                    sigma_u |  3784.9537
                                    sigma_e |  62.923374
                                        rho |   .9997237   (fraction of variance due to u_i)
                            ---------------------------------------------------------------------------------
                            
                            *Are years jointly significant?*
                            . testparm(i.year)
                            
                             ( 1)  2005.year = 0
                             ( 2)  2006.year = 0
                             ( 3)  2007.year = 0
                             ( 4)  2008.year = 0
                             ( 5)  2009.year = 0
                             ( 6)  2010.year = 0
                             ( 7)  2011.year = 0
                             ( 8)  2012.year = 0
                             ( 9)  2013.year = 0
                             (10)  2014.year = 0
                                   Constraint 1 dropped
                                   Constraint 2 dropped
                                   Constraint 3 dropped
                                   Constraint 4 dropped
                                   Constraint 5 dropped
                                   Constraint 7 dropped
                                   Constraint 8 dropped
                            
                                   F(  3,     3) =    6.36
                                        Prob > F =    0.0814
                            
                            *Years are jointly not significant*    
                               
                            
                            *Pregibon test for model misspecification*  
                            
                             predict fitted, xb
                            
                            g sq_fitted=fitted^2
                            
                            xtreg diff_nincpac fitted sq_fitted ,fe robust
                            
                            Fixed-effects (within) regression               Number of obs     =         24
                            Group variable: fmid                            Number of groups  =          4
                            
                            R-sq:                                           Obs per group:
                                 within  = 0.9601                                         min =          5
                                 between = 0.6409                                         avg =        6.0
                                 overall = 0.0039                                         max =          7
                            
                                                                            F(2,3)            =  244780.42
                            corr(u_i, Xb)  = -0.9996                        Prob > F          =     0.0000
                            
                                                               (Std. Err. adjusted for 4 clusters in fmid)
                            ------------------------------------------------------------------------------
                                         |               Robust
                            diff_nincpac |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                            -------------+----------------------------------------------------------------
                                  fitted |   .9941834   .0312544    31.81   0.000      .894718    1.093649
                               sq_fitted |  -1.31e-06   2.63e-06    -0.50   0.652    -9.67e-06    7.05e-06
                                   _cons |   12.34109   24.79405     0.50   0.653    -66.56464    91.24682
                            -------------+----------------------------------------------------------------
                                 sigma_u |  3784.6392
                                 sigma_e |   20.94953
                                     rho |  .99996936   (fraction of variance due to u_i)
                            ------------------------------------------------------------------------------
                            
                            . test sq_fitted
                            
                             ( 1)  sq_fitted = 0
                            
                                   F(  1,     3) =    0.25
                                        Prob > F =    0.6519
                            
                            *No evidence of model misspecification is reported*
                            Kind regards,
                            Carlo
                            (Stata 19.0)

                            Comment


                            • #15
                              Carlos,

                              I did conduct Hausman test and it suggested FE model over RE model.

                              I wanted to test if trends in treatment and control groups were similar before the farms adopted technologies. Therefore, I used the interaction terms of entry and treatment variables as suggested by Clyde above. But as you can see in the output, the interaction term (Entry*Treat ) is eliminated because of collinearity. I can understand elimination of Treat alone as it doesn't vary with years for all farms but the interaction term does vary for some farms over time. But still it is eliminated in the output and I do not have coefficients for the interaction to test if that is significant.Clyde was doubtful that I might have coded that data wrongly. Do you see any problem in the data?

                              Is there any other way to test in this case?

                              Thank you.
                              Sunil

                              Comment

                              Working...
                              X