Hi,
Suppose I have the following dataset
id year measure1 measure2
1 2000 0.41 -
1 2001 0.19 0.50
1 2002 0.51 0.75
1 2003 0.91 0.29
2 2000 0.69 -
2 2001 0.40 0.69
2 2002 0.69 0.29 2
2003 0.79 0.39
How would I do a correlation between consecutive years (grouped by id)? e.g. Correlation between measure1 in 2001 with measure1 in 2000, measure1 in 2002 with measure1 in 2001, etc.
Thank you,
Related Posts with Correlations between consecutive observations
generating dummy variables for consecutive yearsHi everyone! I am quite new to Stata and I probably have a simple question, but I am not able to fi…
set seedHi All, As I understand set seed the numbers to produce the same result for randomization when runni…
Drawing random sample from a large data set for each observationHi, I have a large dataset on course enrollment. Individual students take courses in different semes…
encode a string variable according to subsrtHi, I have a string variable, vq9_breakupdivorce, which has only 2 string values. Code: * Example …
Merged file size is ~5X the source: Mechanism behind MergeHello, This is my first post on Statalist and I have tried my best to follow posting advice in the …
Subscribe to:
Post Comments (Atom)
0 Response to Correlations between consecutive observations
Post a Comment