Announcement

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

  • Declaring panel on bilateral trade data

    Hi, I am relatively new to STATA and I have tried several hours to find this out on my own, unfortunately without success. I am working with a dataset on bilateral trade between countries in three different product sectors over the period 2016-2020. I have a heteroscedasticity problem after trying the BP-test, and I read that one way to solve this is to use fixed effects by declaring panel data. However, as I have several observations matching each other for example:
    Exporter Importer Product Year Value Weight
    Denmark Norway Aluminium 2016 xxx eur xxx kg
    Denmark Norway Iron and Steel 2016 xxx eur xxx kg
    Denmark Finland Iron and steel 2016 xxx eur xxx kg
    except that it covers all of the EU countries in imports and exports from each other. However, there is only one observation for each combination of Exporter, Importer, Product and Year.

    I get the error code

    "repeated time values within panel"

    when I try to use xtset. The only advice I've seen is to delete data, which would be counterproductive as it is data that I need..

    Someone who knows how I can solve this? I want to do some form of regression analysis determining the effects of carbon pricing on the trade weights between the countries, so I will gladly accept all the help I can get.
    Last edited by Maria Petersen; 06 Oct 2022, 03:43.

  • #2
    I have also tried to include all these in the panel by using

    xtset ExporterID ImporterID Year Resourcegroup

    but I only get the error message : too many variables specified

    Comment


    • #3
      Use the egen group() function. You can only declare two variables in xtset, so in your case Maria Petersen I would do this:

      Code:
      egen unit_level=group(exporterid importerid resourcegroup)
      
      xtset unit_level Year, yearly

      Comment

      Working...
      X