Dataframe used to compute cross-time correlations.
Details
Dataframe used to calculate the association of a variable across multiple time points. It is especially useful when there are three or more time points.
See also
Other correlations:
addText()
,
cor.table()
,
crossTimeCorrelation()
,
partialcor.table()
,
vwReg()
Examples
# Prepare Data
df <- expand.grid(ID = 1:100, time = c(1, 2, 3))
df <- df[order(df$ID),]
row.names(df) <- NULL
df$score <- rnorm(nrow(df))
# Cross-Time Correlation
crossTimeCorrelationDF(id = "ID", time = "time", variable = "score", data = df)
#> ID time1 time2
#> 1 1 -0.02010818 -2.39020034
#> 2 1 -2.39020034 0.88986536
#> 3 2 -1.48281332 0.44575035
#> 4 2 0.44575035 1.36977586
#> 5 3 -0.02011003 -0.10921759
#> 6 3 -0.10921759 0.26466174
#> 7 4 0.30384826 -0.18338848
#> 8 4 -0.18338848 0.55964967
#> 9 5 -0.18655384 -0.81227537
#> 10 5 -0.81227537 -1.64058167
#> 11 6 0.50792248 1.75433696
#> 12 6 1.75433696 0.59240020
#> 13 7 1.01671329 0.12162059
#> 14 7 0.12162059 -1.07806726
#> 15 8 -1.14356572 -0.52964368
#> 16 8 -0.52964368 -0.68127316
#> 17 9 -0.20244756 1.68449572
#> 18 9 1.68449572 -1.03377324
#> 19 10 -0.15597667 -0.04640064
#> 20 10 -0.04640064 -0.95362873
#> 21 11 0.41626080 0.11402961
#> 22 11 0.11402961 0.06391875
#> 23 12 -0.91933224 0.90133529
#> 24 12 0.90133529 -0.79772830
#> 25 13 0.66822120 0.15521430
#> 26 13 0.15521430 0.12868809
#> 27 14 -1.53306545 0.20236067
#> 28 14 0.20236067 -0.71753865
#> 29 15 0.36169476 1.39900429
#> 30 15 1.39900429 0.37269896
#> 31 16 -1.56564429 -0.05169454
#> 32 16 -0.05169454 0.51408210
#> 33 17 0.54989952 0.86781691
#> 34 17 0.86781691 0.68436008
#> 35 18 -0.16267998 -1.78436472
#> 36 18 -1.78436472 -1.03714557
#> 37 19 0.83014772 0.60734694
#> 38 19 0.60734694 -0.12218636
#> 39 20 0.93312514 -0.96127668
#> 40 20 -0.96127668 0.25508171
#> 41 21 -0.54540157 0.93036074
#> 42 21 0.93036074 -0.53765056
#> 43 22 -0.45242607 -0.43929097
#> 44 22 -0.43929097 -0.61622311
#> 45 23 0.44163455 0.48259745
#> 46 23 0.48259745 0.54214438
#> 47 24 -2.29078465 0.31035185
#> 48 24 0.31035185 1.40407898
#> 49 25 1.37711764 1.06039565
#> 50 25 1.06039565 0.63217289
#> 51 26 1.08492804 1.35645944
#> 52 26 1.35645944 0.36242404
#> 53 27 2.16934446 0.13913051
#> 54 27 0.13913051 1.37632653
#> 55 28 -0.49144999 1.53491576
#> 56 28 1.53491576 -0.41619872
#> 57 29 -0.52054380 0.85058387
#> 58 29 0.85058387 0.33449657
#> 59 30 -0.82935177 -0.21869594
#> 60 30 -0.21869594 -1.54508372
#> 61 31 0.23322978 0.03106964
#> 62 31 0.03106964 0.35786565
#> 63 32 1.60862422 1.42985426
#> 64 32 1.42985426 -0.94833964
#> 65 33 1.01570554 0.03773461
#> 66 33 0.03773461 -1.74423940
#> 67 34 -0.97007381 -0.22902736
#> 68 34 -0.22902736 -0.97484568
#> 69 35 2.69237242 1.39239386
#> 70 35 1.39239386 1.36007615
#> 71 36 -0.36541588 -0.86893720
#> 72 36 -0.86893720 -0.50655673
#> 73 37 1.21470730 0.50695868
#> 74 37 0.50695868 -2.09497131
#> 75 38 0.03407924 0.85272870
#> 76 38 0.85272870 0.74322814
#> 77 39 0.55715361 -1.24858322
#> 78 39 -1.24858322 -0.20787431
#> 79 40 0.42396946 -0.50669744
#> 80 40 -0.50669744 -0.61152331
#> 81 41 2.41165945 -0.16495814
#> 82 41 -0.16495814 -0.44040605
#> 83 42 0.52197617 -1.91832225
#> 84 42 -1.91832225 -1.98264996
#> 85 43 0.52120016 0.77778320
#> 86 43 0.77778320 -0.81211887
#> 87 44 0.91074832 0.94875395
#> 88 44 0.94875395 -1.34804945
#> 89 45 0.35417586 0.53026393
#> 90 45 0.53026393 -0.31097493
#> 91 46 -0.24415553 -0.29187819
#> 92 46 -0.29187819 -1.12808616
#> 93 47 -1.12288159 2.05393864
#> 94 47 2.05393864 -0.90951843
#> 95 48 0.45837916 -0.04661845
#> 96 48 -0.04661845 -0.68095460
#> 97 49 -1.48882940 -0.39251301
#> 98 49 -0.39251301 -1.74968202
#> 99 50 -0.03866763 -0.79715324
#> 100 50 -0.79715324 -0.91592054
#> 101 51 0.07326746 1.23817132
#> 102 51 1.23817132 0.71837134
#> 103 52 0.53946650 -1.06123399
#> 104 52 -1.06123399 -0.54073787
#> 105 53 -0.71520471 -0.17892009
#> 106 53 -0.17892009 0.16497028
#> 107 54 -0.72740817 -0.53783713
#> 108 54 -0.53783713 -0.59966490
#> 109 55 1.18208775 0.18921288
#> 110 55 0.18921288 0.24894911
#> 111 56 1.04664341 -1.28930094
#> 112 56 -1.28930094 0.37511557
#> 113 57 -0.55691839 0.30242663
#> 114 57 0.30242663 0.22226647
#> 115 58 -0.96216696 0.05203237
#> 116 58 0.05203237 0.90004038
#> 117 59 -0.39490088 0.95414600
#> 118 59 0.95414600 -0.58821435
#> 119 60 -1.47658453 -1.37777577
#> 120 60 -1.37777577 -1.34567231
#> 121 61 -0.73663796 -0.47011150
#> 122 61 -0.47011150 1.38060934
#> 123 62 1.67501093 1.17690663
#> 124 62 1.17690663 -0.14889834
#> 125 63 -0.17782336 0.80312186
#> 126 63 0.80312186 -0.41579535
#> 127 64 1.21248959 1.24036003
#> 128 64 1.24036003 0.68567588
#> 129 65 -0.02679868 0.30958051
#> 130 65 0.30958051 0.24986433
#> 131 66 -1.35646087 0.59937977
#> 132 66 0.59937977 0.00864779
#> 133 67 0.09071661 -0.65705741
#> 134 67 -0.65705741 -0.48178225
#> 135 68 0.01775788 -0.85953576
#> 136 68 -0.85953576 1.35770498
#> 137 69 1.21506118 1.45391292
#> 138 69 1.45391292 -0.08591198
#> 139 70 -0.61756875 -0.21826025
#> 140 70 -0.21826025 -1.32600521
#> 141 71 -2.36220890 -1.40996955
#> 142 71 -1.40996955 0.25439714
#> 143 72 0.29587030 0.05678979
#> 144 72 0.05678979 -0.10265486
#> 145 73 1.95192303 0.87856596
#> 146 73 0.87856596 -1.30661693
#> 147 74 0.09034427 0.90235804
#> 148 74 0.90235804 0.54942132
#> 149 75 -0.86983920 -0.03921465
#> 150 75 -0.03921465 -0.51845168
#> 151 76 -0.91184962 0.15031364
#> 152 76 0.15031364 0.44035545
#> 153 77 1.31978206 0.24656113
#> 154 77 0.24656113 0.94182660
#> 155 78 -0.34215133 -0.27614681
#> 156 78 -0.27614681 0.38365678
#> 157 79 1.44691022 1.73390029
#> 158 79 1.73390029 0.45642938
#> 159 80 0.70750349 2.06378922
#> 160 80 2.06378922 0.02391059
#> 161 81 0.24594946 0.27205914
#> 162 81 0.27205914 -0.99245858
#> 163 82 -0.02757795 2.22284516
#> 164 82 2.22284516 0.15550390
#> 165 83 -0.86911632 -1.17448945
#> 166 83 -1.17448945 -1.75967731
#> 167 84 0.05836159 1.16451986
#> 168 84 1.16451986 0.33762789
#> 169 85 -1.05451872 0.66076911
#> 170 85 0.66076911 -0.82340900
#> 171 86 0.43703366 0.37238811
#> 172 86 0.37238811 -1.64674913
#> 173 87 -1.92355227 0.38083303
#> 174 87 0.38083303 1.37570535
#> 175 88 0.82584873 -0.41611500
#> 176 88 -0.41611500 0.98214959
#> 177 89 0.24218073 -0.93792685
#> 178 89 -0.93792685 1.50585850
#> 179 90 -1.06585117 0.16227053
#> 180 90 0.16227053 0.26047039
#> 181 91 -1.48820199 1.41518387
#> 182 91 1.41518387 0.56250751
#> 183 92 0.64205574 -0.89053264
#> 184 92 -0.89053264 -0.11653752
#> 185 93 -0.94197475 1.11582792
#> 186 93 1.11582792 0.47013513
#> 187 94 0.86061271 -0.07039665
#> 188 94 -0.07039665 -0.61318021
#> 189 95 -0.33671496 -0.21584018
#> 190 95 -0.21584018 0.62113229
#> 191 96 -1.28402652 -1.30009244
#> 192 96 -1.30009244 -0.37676946
#> 193 97 0.10374865 -0.70356227
#> 194 97 -0.70356227 1.49741394
#> 195 98 -0.30282688 -1.37683133
#> 196 98 -1.37683133 0.88317017
#> 197 99 0.67142028 1.23002238
#> 198 99 1.23002238 1.64546788
#> 199 100 -0.18292604 -1.37925781
#> 200 100 -1.37925781 1.25060060