Hi all,
I have a panel data set in long-form, where the dependent variable (Y) contains data of 10 emerging countries and for each country 30 years. The independent variable (X) contains data of the U.S. over 30 years.
I have used the 'xtset country year, yearly' command and now I would like to use the xtreg-command to do an regression of X on Y, however Stata tells me there are 'insufficient observations'. This is because the Y-var contains 300 observations and the X-var 30.
To solve this I copied the data of the U.S. to all observations. So now I have the following:
etc...
However, when I now use the correlation command I get an unrealistic low correlation. When I test the correlation between X and Y for each country separately, the correlations are much a higher.
My question is whether my solution is valid and if not whether there is a solutions to let Stata know that one variable contains a panel and the other variable not?
Many thanks in advance.
Chris
I have a panel data set in long-form, where the dependent variable (Y) contains data of 10 emerging countries and for each country 30 years. The independent variable (X) contains data of the U.S. over 30 years.
I have used the 'xtset country year, yearly' command and now I would like to use the xtreg-command to do an regression of X on Y, however Stata tells me there are 'insufficient observations'. This is because the Y-var contains 300 observations and the X-var 30.
To solve this I copied the data of the U.S. to all observations. So now I have the following:
Year | Country_i | US | Y_value | X_value |
1990 | China | US | 1.3 | 5.0 |
... | China | US | 1.2 | 6.0 |
2020 | China | US | 1.9 | 7.0 |
1990 | India | US | 0.8 | 5.0 |
.... | India | US | 1.3 | 6.0 |
2020 | India | US | 1.4 | 7.0 |
However, when I now use the correlation command I get an unrealistic low correlation. When I test the correlation between X and Y for each country separately, the correlations are much a higher.
My question is whether my solution is valid and if not whether there is a solutions to let Stata know that one variable contains a panel and the other variable not?
Many thanks in advance.
Chris