Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

aPCoA

Covariate Adjusted PCoA Plot


Description

Adjusted confounding covariates to show the effect of the primary covariate in a PCoA plot. This method is designed for non-Euclidean distance. This function will plot the original PCoA plot along with the covariate adjusted PCoA plot.

Usage

aPCoA(formula,data,maincov,drawEllipse=TRUE,drawCenter=TRUE)

Arguments

formula

A typical formula such as Y~ A, but here Y is a dissimilarity distance. The formula has the same requirements as in adonis function of the vegan package.

data

A dataset with the rownames the same as the rownames in distance. This dataset should include both the confounding covariate and the primary covariate.

maincov

the covariate of interest in the dataset, must be a factor

drawEllipse

Do you want to draw the 95% confidence elipse for each cluster?

drawCenter

Do you want to show the connection between cluster center (medoid) and cluster members?

Value

Two PCoA plots. One is the original one, while the other is the PCoA plot after adjusting for the confounding covariate.

plotMatrix

The matrix for plotting the adjusted PCoA plot.

References

Yushu Shi, Liangliang Zhang, Kim-Anh Do, Christine Peterson and Robert Jenq. (2020) aPCoA: Covariate Adjusted Principal Coordinates Analysis <arXiv:2003.09544>

Examples

library(vegan)
library(aPCoA)
data("Tasmania")
data<-data.frame(treatment=Tasmania$treatment,block=Tasmania$block)
bray<-vegdist(Tasmania$abund, method="bray")
rownames(data)<-rownames(as.matrix(bray))
opar<-par(mfrow=c(1,2),
          mar=c(3.1, 3.1, 3.1, 5.1),
          mgp=c(2, 0.5, 0),
          oma=c(0, 0, 0, 4))
result<-aPCoA(bray~block,data,treatment)
par(opar)

aPCoA

Covariate Adjusted PCoA Plot

v1.2
GPL (>= 2)
Authors
Yushu Shi
Initial release
2020-08-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.