Hi guys, I am currently working on a dataset in long format and I need the average corss-correlation of all variables. I have tried to convert the dataset from long to wide using the reshape code but Stata returns 'values of variable t not unique within firmid'. I also tried it with a loop with the command xcorr, but I cannot find the correct way to do it. Can someone please help me?
The dataset looks like this:
firmid t return
1 -20 0,02
1 -19 -0,1
1 -18 0,014
1 -17 etc.
2 -20
2 -19
2 -18
2 -17
etc...
So I need the average cross-correlation at time -20, the average cross-correlation at time -19 etc stored as a new variable.
Huub
Related Posts with cross-correlations in long format
Suspected bug in -confirm-The title is self-explanatory. Here is a reproducible example: Code: clear sysuse auto confirm var…
Time fixed effect and State fixed effectDear all, I am pretty much new for STATA. I'm currently working on my master's thesis. I want to inv…
Expxport codebook descriptives to latexHello, I have a very simple query that unfortunately I am unable to resolve. I am trying to export …
Control variables in interaction functionHello fellow stata users! I have a more theoretical question instead of how to use stata. I was won…
DID two way fixed effectsDear Statalist Members, PS: I have attached a small portion of my data. By using a repeated cross …
Subscribe to:
Post Comments (Atom)
0 Response to cross-correlations in long format
Post a Comment