I am pretty new to statistical testing with confounding variables, so please excuse if there will be some gross misunderstandings or basic questions.
I want to test for systematic differences in species abundance ($y$) between several types of environments ($x$). The way I would usually approach is with a Kruskal-Wallis test. However, these different environments are not all in the same region. So I would like to use the region factor as block ($b$). The differences between samples in $y$ and $b$ are subtle, i.e. no obvious clustering can be seen corresponding to $x$ or $b$.
For this I was using now the package coin for R, that is
independence_test(y ~ x | b, ...)
From here I have now a few theoretical questions:
- How do I visualize this? I would prefer a boxplot, but how to include the blocking factor?
- I would also like to test correlations (spearman) using a block design, what package would you suggest? Again, how does one visualize this (e.g. scatter plot, but with block factor)?
- I would like to control for a continuous variable ($z$) at later stages. As I understand, this can not be done with "block"ing factor in
coin? How would I do this correctly?
- The last stage would be to control for both blocking factor b and continous variable z in a Kruskal-Wallis test. How can this be done?
I would be grateful for any help on this topic.