# How to measure the strength of a correlation between two sample sites

**URL:** <https://forum.qiime2.org/t/how-to-measure-the-strength-of-a-correlation-between-two-sample-sites/22497>\
**Category:** User Support\
**Tags:** correlation\
**Created:** [March 18, 2022, 11:15pm UTC](https://forum.qiime2.org/t/how-to-measure-the-strength-of-a-correlation-between-two-sample-sites/22497 "2022-03-18T23:15:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mweinroth](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/m/5fc32e/32.png) [@mweinroth](https://forum.qiime2.org/u/mweinroth)\
**Post date:** [March 18, 2022, 11:15pm UTC](https://forum.qiime2.org/t/how-to-measure-the-strength-of-a-correlation-between-two-sample-sites/22497/1 "2022-03-18T23:15:53Z")

</div>

I am looking for the best tool to provide a paired comparison of beta diversity between one sample site of interest and 9 'preditors'.

My experimental setup is as follows: 10 animals were each sampled in ten sites in the GI. I would like to know which site is most similar to the last site (swab). Ideally, I would like not only a p-value type statistic but also something like an r-squared value so I could say something like "site A can explain 37% of the variation in the swab while site B can explain 50%".

I have had a few ideas but am not sure which direction to go:

- Use `qiime diversity adonis` as suggested [here](https://forum.qiime2.org/t/question-about-qiime-longitudinal-pairwise-differences/8562) however this will not be quite right because if I leave one sampling type and the swab it will just tell me the variation explained the site not the similarity between the two.

- Use `q2-longitudinal` but from the [tutorial](https://docs.qiime2.org/2019.4/tutorials/longitudinal/) it seems like I only get a p-value with no R2.

- Treat my swab like a mock community and compare my other sample types individually to it like [here](https://docs.qiime2.org/2018.8/tutorials/quality-control/#evaluating-quality-of-samples-with-known-composition) but this seems not really used and outdated

- Use Procrustes and the m2 statistic as an R2

Are any of these more or less desirable than the other or am I missing a better option?

Thanks!

---

<div class="post-metadata">

**Author:** ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)\
**Post date:** [March 19, 2022, 6:19am UTC](https://forum.qiime2.org/t/how-to-measure-the-strength-of-a-correlation-between-two-sample-sites/22497/2 "2022-03-19T06:19:37Z")

</div>

Hi @mweinroth ,

It sounds like what you want is to inspect the distributions of beta diversity distances/dissimilarities between each group. What you want is not an R2 value, but the distances themselves (e.g., report median distance).

Pick your distance metric(s) of interest and use `qiime diversity beta-group-significance` to generate a boxplot showing the distribution of distances within and between each group.

That action can also report p-values for pairwise comparisons of each group.

> [@mweinroth](#):
>
> Treat my swab like a mock community and compare my other sample types individually to it like [here](https://docs.qiime2.org/2018.8/tutorials/quality-control/#evaluating-quality-of-samples-with-known-composition) but this seems not really used and outdated

interesting idea! But the information retrieved is rather specific (which is probably why it is used less often).

> [@mweinroth](#):
>
> Use `q2-longitudinal` but from the [tutorial](https://docs.qiime2.org/2019.4/tutorials/longitudinal/) it seems like I only get a p-value with no R2.

that would work! the R2 value would instead be inspecting the mean or median distance values themselves.

---

<div class="post-metadata">

**Author:** ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)\
**Post date:** [April 19, 2022, 12:20pm UTC](https://forum.qiime2.org/t/how-to-measure-the-strength-of-a-correlation-between-two-sample-sites/22497/3 "2022-04-19T12:20:11Z")

</div>

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
