2
$\begingroup$

I'm testing correlation between two variables v1 and v2, but they are clustered by a third variable group. Can I directly use the correlation test (i.e., Spearman test) without accounting the cluster? What is the possible issue? If not, what test should I conduct? Is intraclass correlation the correct test I should use? My data are not normally distributed.

I have 2 sets of data, they have 40, 80 group. My group is subject, and v1 and v2 are two continuous variables that are two different behavioural data drawn from each individual.

example data

group   v1   v2
 1      2    1
 1      2    0
 1      8    9
 2      7    1
 2      9    2
 2      3    1
 3      2    2
 3      1    1
 3      1    2

Thanks!

$\endgroup$
2
  • $\begingroup$ How many groups do you have ? What is the relation between v1 and v2 (if any), and what type of data are they ? $\endgroup$ Commented May 30, 2018 at 6:50
  • $\begingroup$ @RobertLong. I have updated my question, thanks for asking! $\endgroup$
    – Lumos
    Commented May 30, 2018 at 7:30

1 Answer 1

2
$\begingroup$

More information would be useful, but in general when data are clustered, you must account for the possible non-independence of observations within clusters. This means that you cannot use simple correlation (if there is a clustering effect)

One way to analyse your data is to run a mixed effects model, with group as a random effect. You have plenty of groups to do this. It would be a regression model, rather than a simple correlation, but it will account for non-independence between clusters. This will tell you the association between the two variables (similar to a correlation coefficient), adjusting for clustering effect. However, some caveats are:

  • you will need to choose an "outcome" variable. This many be obvious in your situation but there is insufficient information to determine this from the OP.
  • You will need to choose an appropriate model given the distribution of your outcome variable. You say it is not normally distributed, which is OK. Mixed effects models can handle a wide range of distributions.
$\endgroup$
5
  • $\begingroup$ Thanks! So I should do a univariate regression in mixed effect model then? Such that v1~v2|group? The coefficient can be interpreted as similar as the correlation coefficient? $\endgroup$
    – Lumos
    Commented May 30, 2018 at 7:34
  • $\begingroup$ Yes, though please check this post for the differences between correlation and regression. $\endgroup$ Commented May 30, 2018 at 8:11
  • $\begingroup$ Thanks for that post! As far as I know, a univariate regression = Pearson correlation, but what if my test requires spearman correlation? Is there any way to transform into Spearman in mixed effect model? $\endgroup$
    – Lumos
    Commented May 30, 2018 at 8:17
  • $\begingroup$ Please ask a new question regarding that. Feel free to ping me in a comment $\endgroup$ Commented May 30, 2018 at 8:23
  • $\begingroup$ @ Robert Long here is my question about the Spearman and regression, thanks! $\endgroup$
    – Lumos
    Commented May 30, 2018 at 17:10

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.