Announcement

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

  • Fixed/random effects on panel of countries

    Hi, I have a panel dataset of countries for the period 1950-2023 and want to run OLS regressions. However, I am confused as to whether and what type of fixed/random effects I should include. In my regressions I do not include any independent variable that is time-invariant, but rather only variables that change every year (investment, gdp, population, etc.). I know that the command for running panel data regressions is xtreg, but when I use that command without using the "fe" option I get no R2 when exporting regression tables, which makes me think is incorrect.


    Should I use fixed effects on my regression? Or is that something that is only required when one independent variable is time-invariant? I would highly appreciate a conceptual and practical explanation.

    Thank you!

  • #2
    Exequiel:
    as per FAQ, you're kindly requested to share what you typed and what Stata. Thanks.
    That said, if you're dealing with a T>N panel dataset, you should consider -xtregar- and -xtgls-, but no -xtreg-, that was conceived for N>T panel datasets.
    In addition, plugging in the righ-hand side of your regression equation time-varying predictors only to avoid no coefficients in return when going -fe-, is questionable due to the risk of providing a poor representation of the data generating process you're investigating.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Carlo,

      Thank you for your answer and sorry for not following the guidelines. I am using Stata 17 and here is an example of my data:

      * Example generated by -dataex-. For more info, type help dataex
      clear
      input str66 country double year float(hc rgdpepc csh_i)
      "Aruba" 1950 . . .
      "Aruba" 1951 . . .
      "Aruba" 1952 . . .
      "Aruba" 1953 . . .
      "Aruba" 1954 . . .
      "Aruba" 1955 . . .
      "Aruba" 1956 . . .
      "Aruba" 1957 . . .
      "Aruba" 1958 . . .
      "Aruba" 1959 . . .
      "Aruba" 1960 . . .
      "Aruba" 1961 . . .
      "Aruba" 1962 . . .
      "Aruba" 1963 . . .
      "Aruba" 1964 . . .
      "Aruba" 1965 . . .
      "Aruba" 1966 . . .
      "Aruba" 1967 . . .
      "Aruba" 1968 . . .
      "Aruba" 1969 . . .
      "Aruba" 1970 . 6773.813 44.57476
      "Aruba" 1971 . 7343.305 43.32763
      "Aruba" 1972 . 7957.234 43.43227
      "Aruba" 1973 . 8622.059 41.62429
      "Aruba" 1974 . 9366.668 40.51434
      "Aruba" 1975 . 10200.224 42.16168
      "Aruba" 1976 . 11137.554 41.4295
      "Aruba" 1977 . 12192.604 43.32456
      "Aruba" 1978 . 13357.497 41.01103
      "Aruba" 1979 . 14601.114 38.77074
      "Aruba" 1980 . 15901.76 38.44739
      "Aruba" 1981 . 17211.818 38.86619
      "Aruba" 1982 . 18541.375 39.30897
      "Aruba" 1983 . 19944.76 38.5909
      "Aruba" 1984 . 21528.627 38.52515
      "Aruba" 1985 . 23421.467 35.727413
      "Aruba" 1986 . 25702.51 36.43441
      "Aruba" 1987 . 30199.885 35.35776
      "Aruba" 1988 . 36328.613 35.1074
      "Aruba" 1989 . 40719.57 37.66013
      "Aruba" 1990 . 41436.8 34.381763
      "Aruba" 1991 . 43398.54 41.18659
      "Aruba" 1992 . 43152.58 30.68892
      "Aruba" 1993 . 43188.94 33.516182
      "Aruba" 1994 . 46127.16 31.57243
      "Aruba" 1995 . 42488.85 32.93522
      "Aruba" 1996 . 41209.15 32.017536
      "Aruba" 1997 . 43515.48 35.189934
      "Aruba" 1998 . 45743.74 34.493725
      "Aruba" 1999 . 45307.82 31.63827
      "Aruba" 2000 . 44369.85 29.97642
      "Aruba" 2001 . 44381.56 28.12678
      "Aruba" 2002 . 43179.46 40.97179
      "Aruba" 2003 . 43385.59 43.52082
      "Aruba" 2004 . 46071.8 41.23056
      "Aruba" 2005 . 47043.6 48.89387
      "Aruba" 2006 . 47095.81 49.34108
      "Aruba" 2007 . 48051.73 47.94675
      "Aruba" 2008 . 47224.46 48.05953
      "Aruba" 2009 . 42884.48 43.6243
      "Aruba" 2010 . 39468.39 41.87012
      "Aruba" 2011 . 40106.82 41.80003
      "Aruba" 2012 . 38358.21 37.15196
      "Aruba" 2013 . 38473.22 26.5967
      "Aruba" 2014 . 37638.305 27.9211
      "Aruba" 2015 . 37948.58 23.78615
      "Aruba" 2016 . 37698.55 26.268356
      "Aruba" 2017 . 37772.246 28.35035
      "Aruba" 2018 . 37106.777 24.868526
      "Aruba" 2019 . 36883.77 24.63662
      "Angola" 1950 . . .
      "Angola" 1951 . . .
      "Angola" 1952 . . .
      "Angola" 1953 . . .
      "Angola" 1954 . . .
      "Angola" 1955 . . .
      "Angola" 1956 . . .
      "Angola" 1957 . . .
      "Angola" 1958 . . .
      "Angola" 1959 . . .
      "Angola" 1960 . . .
      "Angola" 1961 . . .
      "Angola" 1962 . . .
      "Angola" 1963 . . .
      "Angola" 1964 . . .
      "Angola" 1965 . . .
      "Angola" 1966 . . .
      "Angola" 1967 . . .
      "Angola" 1968 . . .
      "Angola" 1969 . . .
      "Angola" 1970 1.0156858 4918.05 37.871956
      "Angola" 1971 1.0181956 5080.045 37.73761
      "Angola" 1972 1.0207115 4928.56 38.47158
      "Angola" 1973 1.0232338 5172.689 38.56805
      "Angola" 1974 1.0257622 5119.348 39.75827
      "Angola" 1975 1.0282968 4660.612 40.93203
      "Angola" 1976 1.0308378 4262.274 39.67771
      "Angola" 1977 1.033385 4201.6943 38.70238
      "Angola" 1978 1.0359385 3791.19 40.15754
      "Angola" 1979 1.0384983 3701.756 38.55839
      end


      My dataset includes about 170 countries for the period 1950-2023 (pretty much like Penn World Tables or World Bank Data). Still, on my regressions I want to try different samples of countries where the smallest sample includes 14 countries.
      By the way, I am not plugging time-varying predictors to avoid no coefficients in return when going fe. What I meant is that, using only time-varying regressors with the xtreg, I only obtained the R2 reported when adding the 'fe' option. Still, as I was saying, my more elementary question is whether or not it makes sense to think of adding fixed effects in a regression where no explanatory variable is time-invariant.

      Best regards,

      Comment


      • #4
        Exequiel:
        thanks for clarifying.
        Some comments about your last post:
        1) if N>T, you can go -xtreg,fe- if you're interested in within-panel variation;
        2) the R2 you should look at is within_R_sq (-fe-) or between_R_sq if -re-;
        3) if T>N, you should switch from -xtreg- to -xtregar- or -xtgls-.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X