Heverkuhn Heverkuhn
2011-Sep-23 02:16 UTC
[R] Correlation of variables with repeated measures.
Hello I have a dataframe that looks like this: Date Min Subj VAR1 VAR2 VAR3 1 8/30/2011 5min 1 34.41042 126.08490 55.3548387 2 8/30/2011 10min 1 34.53030 133.81343 61.6000000 3 8/30/2011 15min 1 34.66297 118.38193 11.8000000 4 8/30/2011 20min 1 34.82770 110.77767 6.6000000 5 8/30/2011 5min 2 36.36994 116.24861 41.2258065 6 8/30/2011 10min 2 36.37420 101.16457 13.6000000 7 8/30/2011 15min 2 36.37453 92.26340 0.4000000 8 8/30/2011 20min 2 36.37697 87.73650 0.0000000 9 8/30/2011 5min 3 35.25667 146.90037 10.0645161 10 8/30/2011 10min 3 35.36654 139.49364 6.0000000 11 8/30/2011 15min 3 35.33833 135.75633 0.4000000 12 8/30/2011 20min 3 36.01337 127.83797 0.0000000 13 8/30/2011 5min 4 35.26742 84.78603 0.9677419 14 8/30/2011 10min 4 35.17913 91.27093 1.8000000 15 8/30/2011 15min 4 35.09825 92.03692 13.4000000 16 8/30/2011 20min 4 35.36823 88.73337 4.8000000 and so on for more days. I would like to check the correlation and p of variables VAR1 VAR2 VAR3. if I use cor.test(tel$VAR1, tel$VAR2) the observations are considered independent, and Indeed I got df=14 I have seen that I can obtain a correlation for each block using this script: http://stackoverflow.com/questions/2336056/how-to-do-correlation-with-blocks-or-repeated-measures I was wandering what I should do for obtain a correlation that account for all the blocks. [[alternative HTML version deleted]]
Heverkuhn Heverkuhn
2011-Sep-23 15:41 UTC
[R] Correlation of variables with repeated measures.
I guess that I have just to consider the means of each subject, as indicated here. http://www-users.york.ac.uk/~mb55/intro/corrsim.htm Thanks On Thu, Sep 22, 2011 at 9:16 PM, Heverkuhn Heverkuhn <heverkuhn@gmail.com>wrote:> Hello > I have a dataframe that looks like this: > > Date Min Subj VAR1 VAR2 VAR3 > 1 8/30/2011 5min 1 34.41042 126.08490 55.3548387 > 2 8/30/2011 10min 1 34.53030 133.81343 61.6000000 > 3 8/30/2011 15min 1 34.66297 118.38193 11.8000000 > 4 8/30/2011 20min 1 34.82770 110.77767 6.6000000 > 5 8/30/2011 5min 2 36.36994 116.24861 41.2258065 > 6 8/30/2011 10min 2 36.37420 101.16457 13.6000000 > 7 8/30/2011 15min 2 36.37453 92.26340 0.4000000 > 8 8/30/2011 20min 2 36.37697 87.73650 0.0000000 > 9 8/30/2011 5min 3 35.25667 146.90037 10.0645161 > 10 8/30/2011 10min 3 35.36654 139.49364 6.0000000 > 11 8/30/2011 15min 3 35.33833 135.75633 0.4000000 > 12 8/30/2011 20min 3 36.01337 127.83797 0.0000000 > 13 8/30/2011 5min 4 35.26742 84.78603 0.9677419 > 14 8/30/2011 10min 4 35.17913 91.27093 1.8000000 > 15 8/30/2011 15min 4 35.09825 92.03692 13.4000000 > 16 8/30/2011 20min 4 35.36823 88.73337 4.8000000 > > and so on for more days. > > I would like to check the correlation and p of variables VAR1 VAR2 VAR3. > > if I use cor.test(tel$VAR1, tel$VAR2) > the observations are considered independent, and Indeed I got df=14 > I have seen that I can obtain a correlation for each block using this > script: > > http://stackoverflow.com/questions/2336056/how-to-do-correlation-with-blocks-or-repeated-measures > > I was wandering what I should do for obtain a correlation that account for > all the blocks. > >[[alternative HTML version deleted]]