Hi, I have balanced panel data with ID and Time (and some other variables), and I want the unique ID-pairs, while preserving the time order. The suggestions I've found seem to offer much more complicated combinations. The simplest example I can think of (while still being clear) has 3 individuals and 3 time periods. In general, if the original data set is n*T obs, the transformed data set should be (n*n-1)/2*T) obs. I can do this with loops, but I'm guessing there is a clever way to do it w/out loops. Thanks for your help.
ID1 t1
ID1 t2
ID1 t3
ID2 t1
ID2 t2
ID2 t3
ID3 t1
ID3 t2
ID3 t3
I would like the resulting data to look like:
ID1-ID2 t1
ID1-ID2 t2
ID1-ID2 t3
ID1-ID3 t1
ID1-ID3 t2
ID1-ID3 t3
ID2-ID3 t1
ID2-ID3 t2
ID2-ID3 t3
If it helps, my transformed data could be as simple as the difference in the values of a variable for the different IDs for each time period.
Related Posts with unique pairs from panel data
Linearity/ non-linearity using residual plotArray How can I predict linearity or non-linearity of my regression model using this residuals Vs fi…
Categorical Variables Treatment at Regression AnalysisHello everyone, Hope you all feeling well. I need help in the following specific case in STATA: Fir…
Likelihood ratio test (LR) for identify the individual firm effectHello, I want to test the joint significance of the individual effects in my fixed effect model and…
Seperating a string into substrings (by upper case letters)Dear all, I have to "cut a string into pieces". The "seperator" being a upper case letter. e.g. va…
Applying Brent's method in STATAHello, I wanted to apply Brent's theorem to a function generated in STATA, in order to invert it an…
Subscribe to:
Post Comments (Atom)
0 Response to unique pairs from panel data
Post a Comment