Announcement

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

  • Panel data error due to several companies inside country

    I am currently writing my master thesis and need to check how percentages of females on the management board of firms in the US and Germany impact sustainability practices of those firms.
    Therefore I use 40 German firms and 95 US firms and I wish to analyse those with panel data regression in STATA. However, I seem to face some problems because the way I organize my data is the following: I put the country in the first column and add 1 as a country ID for Germany and 2 for US in the second column. Then I have the years and then ESG scores and then female percentages as my dependent and independent variables the last two.

    However when I wish to declare my data as panel data it does not work and
    . xtset compid Year
    repeated time values within panel
    r(451);

    . occurs.

    I think this is due to the fact that I have several companies for the countries and therefore several times data for one year. Do you know how to solve that issue so to show to STATA that I have only 2 countries but in those countries several companies? Or can I only control for the country meaning I have to add all the data for each firm of 2014 for example together and divide it by the number of companies I have for that country. Because it seems that I have two panel data, first the country and second the companies in that country.

  • #2
    I don't think your explanation is quite right. You would encounter this problem if you had run -xtset country YEAR- because there would certainly be many firms within each country and each of those firms would contribute an observation for all (or at least some) years. But you did -xtset compid Year-. So you actually have a situation where the same company as multiple observations in the same Year. You need to figure out why that is happening. To see the observations that are causing problems, you can run:
    Code:
    duplicates tag compid Year, gen(flag)
    browse if flag
    If the duplicate observations on compid and Year are errors, evidently you need to fix that. While doing it, you should review the entire chain of data management that led up to this data set, as where one error is found, others often lurk. Better to find and fix them now.

    If the duplicate observations are, however, correct data, then there are a few possibilities.

    One possibility is that there are some firms that are operating in both countries in the same year(s). If that is the case, and that is the actual situation and not a data error, and if for purposes of analysis you can treat the English and German branches of the countries as separate firms, you can do this:
    Code:
    egen panel = group(country compid)
    xtset panel Year
    If it would not be appropriate to treat the English and German branches as separate firms, then you may be able to move forward by just running -xtset compid-, with no mention of a time variable. -xtset- does not require a time variable. When run without one, you are still able to avail yourself of most -xt- commands. What you will lose is the ability to use time series operators such as lags, leads, seasonal differences, etc., and the ability to estimate models with autoregressive structure.

    A more problematic possibility is that you want to use time series operators or autoregressive models but you really don't have panel data. It is not some perversity of Stata that you cannot do those things when you have repeated time values within panel. Think about it. If there are two observations for Firm F in year Y, which one would be the correct lag for Firm F in year Y+1? There is no way to answer that question. Time series operators and autoregressive structure are not definable in this situation and no software can overcome this inherent problem in the data. In this case, you either need a new analysis plan that does not rely on those things, or a new data set that is truly panel data (i.e. at most one observation per company per year).

    Comment

    Working...
    X