Announcement

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

  • Splitting panel data

    Hi, new here so pardon any poor terminology or silly Qs.

    I'm using panel data as part of my undergraduate dissertation and have data on 101 countries (UK and its 100 top trading partners), spanning 15 years, with about 8 considered variables.

    My question is how I can split those variables (eg. GDP) into UK GDP (1 country) and Partner GDP (100 countries), so when it comes to analysing my results I can identify differing marginal effects.

    I have tried reading into this and I think it requires generating some kind of dummy variable but I don't know where to go from there.

    Would appreciate any kind of help,
    Thanks in advance.

  • #2
    Matt:
    welcome to this forum-
    The following toy-example (on a cross-sectional dataset) can hopefully be useful:
    Code:
    . set obs 3
    Number of observations (_N) was 0, now 3.
    
    . g country=_n-1
    
    . g gdp=_n*1000000
    
    . label define country 0 "UK" 1 "Alfa" 2 "Beta"
    
    . label val country country
    
    . egen wanted=group(country gdp)
    
    . replace wanted=0 if wanted>1
    (2 real changes made)
    
    . list
    
         +----------------------------+
         | country       gdp   wanted |
         |----------------------------|
      1. |      UK   1000000        1 |
      2. |    Alfa   2000000        0 |
      3. |    Beta   3000000        0 |
         +----------------------------+
    
    .
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Carlo Lazzaro Thanks for your response, from what I understand you have created a dummy variable to identify UK (1) and non-UK (0) countries. What would the next step be to incorporate this into running regressions.

      i.e. how could I run a regression where I have, for example, Yi->j = X1i + X1j + X2i + X2j ... etc.

      Comment


      • #4
        Matt:
        I was thinking about something like:
        Code:
        xtreg <regressand> <8otehrpredictors>i.wanted##c.gdp, re vce(cluster panelid)
        If you go -fe-, time-invariant variables will be wiped out.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment

        Working...
        X