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
Loop inside another loopDear All, I have created a toy example for my question Code: set obs 5 gen x1 = 1 gen x2 = 1 gen…
confidence intervals for individual fixed effects u from xtreg, feI am running a fixed effects model with schools being my level of interest. I want to understand whi…
Determining which variables to use in logistic regressionI have a few similar variables and I'm not sure if I should consider one of each or all in my logist…
LoopPlease advise how I can create a loop for the following 3 similar syntax gen ethos_1rough90=0 repl…
System-missing vs. extended-missing values in merge with update specifiedHi, I am merging two datasets with 240 variables in common, specifying "update" so that missing val…
Subscribe to:
Post Comments (Atom)
0 Response to cross-correlations in long format
Post a Comment