# [R] How to do: Correlation with "blocks" (or - "repeated measures" ?!) ?

Juliet Hannah juliet.hannah at gmail.com
Sun Feb 28 16:28:39 CET 2010

```I didn't follow your question completely. But do a search for
intraclass correlation with nlme or lmer and see if those results
relate to the question you are asking. If so, I would
suggest following up on the mixed model list. I know you
wanted to avoid mixed models, but if I have understood
your question, that is the way to use all of your data
to estimate the parameters you seek.

On Thu, Feb 25, 2010 at 10:57 AM, Tal Galili <tal.galili at gmail.com> wrote:
> Hello dear R help group,
>
> I have the following setup to analyse:
> We have about 150 subjects, and for each subject we performed a pair of
> tests (under different conditions) 18 times.
> The 18 different conditions of the test are complementary, in such a way so
> that if we where to average over the tests (for each subject), we would get
> no correlation between the tests (between subjects).
> What we wish to know is the correlation (and P value) between the tests, in
> within subjects, but over all the subjects.
>
> The way I did this by now was to perform the correlation for each subject,
> and then look at the distribution of the correlations received so to see if
> it's mean is different then 0.
> But I suspect there might be a better way for answering the same question
> (someone said to me something about "geographical correlation", but a
> shallow search didn't help).
>
> p.s: I understand there might be a place here to do some sort of mixed
> model, but I would prefer to present a "correlation", and am not sure how to
> extract such an output from a mixed model.
>
> Also, here is a short dummy code to give an idea of what I am talking about:
>
> attach(longley)
> N <- length(Unemployed)
> block <- c(
> rep( "a", N),
> rep( "b", N),
>  rep( "c", N)
> )
>  Unemployed.3 <- c(Unemployed + rnorm(1),
> Unemployed + rnorm(1),
> Unemployed + rnorm(1))
>
> GNP.deflator.3 <- c(GNP.deflator + rnorm(1),
> GNP.deflator + rnorm(1),
> GNP.deflator + rnorm(1))
>
> cor(Unemployed, GNP.deflator)
> cor(Unemployed.3, GNP.deflator.3)
> cor(Unemployed.3[block == "a"], GNP.deflator.3[block == "a"])
> cor(Unemployed.3[block == "b"], GNP.deflator.3[block == "b"])
> cor(Unemployed.3[block == "c"], GNP.deflator.3[block == "c"])
>
> (I would like to somehow combine the last three correlations...)
>
>
>
> Any ideas will be welcomed.
>
> Best,
> Tal
>
>
>
>
>
>
> ----------------Contact
> Details:-------------------------------------------------------
> Contact me: Tal.Galili at gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
> ----------------------------------------------------------------------------------------------
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help