I have to perform correlation test between repeated and not repeated measures, more accurately e.g.: I sampled 20 individuals in 10 populations and I measured some traits (e.g. height) on the individuals and I have climatic variables (e.g. temperature) for each population. Now I want to compute correlation e.g. between height (10*20 values) and temperature (10*1 value).

Here is my question : is it better to take the mean values of measured traits for each population or to "repeat" the climatic variable for each individual ? (and why ?)

Does anyone know a better way to deal with this issue ?

I hope this is understandable and thank in advance for your help.


2 Answers 2


If you assume Normal distribution and homogeneous variance across groups/populations your first method is valid.

The second method is not great. It discards the information about the group structure which will result in a more uncertain correlation estimate.

If you do not wish to assume homogeneous variance, you should use a hierarchical (sometimes called random effects) regression model with temperature as a group-level predictor. Assuming normal distribution, a simple proposal is:

$y_{ij} \sim \mathcal{N}(\mu_j,\sigma)\\ \mu_j \sim \mathcal{N}(\beta_0 + \beta_1 x_j,\rho)$

where $y_{ij}$ is the height of individual $i$ from population $j$ and $x_j$ is the temperature corresponding to population $j$. $\beta_1$ is the quantity of interest. It tells by how much the height of a group increases for an temperature increase of one unit (e.g. cm per one degree Celsius). You can obtain correlation coefficient by standardizing $\beta_1$.

Gelman & Hill (2006) discuss Hierarchical regression models with group level predictors in chapter 12.6. They discuss several extensions and alternatives to the simple model that I listed above.

Literature: Gelman, A., & Hill, J. (2006). Data analysis using regression and multilevel/hierarchical models. Cambridge University Press.

  • $\begingroup$ Thank you, the above-cited book is very interesting and makes mixed effects models more understandable ! $\endgroup$
    – Erica Fary
    Commented Jul 30, 2015 at 22:04

I would like to confirm that what you mean by saying "I sampled 20 individuals in 10 populations" is that you have 10 samples of size 20 from 10 different populations, so 200 cases in total.

By taking and then comparing the means, you're losing information about the data. For example, say in sample one, the heights are 6,7,8,9,10 and in sample two, the heights are 1,6,8,10,15, the mean of both is eight, and so they would look the same if you just compared the means.

Therefore, your data should instead look something like:

Index  Height Temperature
1      6.5    100
2      6.6    100
3      5.9    100
40     6.4    85
41     6.6    85
199    6.7    120
200    4.7    120

You will notice if using a statistics package that if you use the repeating method, you will have more degrees of freedom than if you use the mean method.

Of the two options you've mentioned, it would be better to compare the raw data and assign temperature as a factor of some description. This is good if you want to see the relationship between temperature and height. You can do some kind of regression if you want to model temperature as a continuous factor.

Alternatively, if you want to see if there's a difference in groups, you can use some procedure like the ANOVA (this will work best if you want to model temperature categorically).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.