From what I've read, the Monte Carlo correction is often used in pairwise PERMANOVA comparisons to improve the accuracy of the p-value when given a low number of sample replicates and limited number of possible permutations. This is easily implemented in the PRIMER software, but I can't find an existing function to do this in R.
In the basic p.adjust()
function in R, the possible methods are c("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none")
So I'm wondering if, firstly, anyone knows of an existing package or function that allows for monte carlo p adjustments, or, failing that, if someone could please describe the method to me in fairly simple terms so that I may cobble together a function myself?
I'll include the pairwise permanova function I am working with (this function was obtained from https://www.researchgate.net/post/How_can_I_do_PerMANOVA_pairwise_contrasts_in_R)
data(iris)
library(vegan)
pairwise.adonis <- function(x,factors, sim.function = 'vegdist', sim.method = 'bray', p.adjust.m ='bonferroni')
{
library(vegan)
co = combn(unique(as.character(factors)),2)
pairs = c()
F.Model =c()
R2 = c()
p.value = c()
for(elem in 1:ncol(co)){
if(sim.function == 'daisy'){
library(cluster); x1 = daisy(x[factors %in% c(co[1,elem],co[2,elem]),],metric=sim.method)
} else{x1 = vegdist(x[factors %in% c(co[1,elem],co[2,elem]),],method=sim.method)}
ad = adonis(x1 ~ factors[factors %in% c(co[1,elem],co[2,elem])] );
pairs = c(pairs,paste(co[1,elem],'vs',co[2,elem]));
F.Model =c(F.Model,ad$aov.tab[1,4]);
R2 = c(R2,ad$aov.tab[1,5]);
p.value = c(p.value,ad$aov.tab[1,6])
}
p.adjusted = p.adjust(p.value,method=p.adjust.m)
sig = c(rep('',length(p.adjusted)))
sig[p.adjusted <= 0.05] <-'.'
sig[p.adjusted <= 0.01] <-'*'
sig[p.adjusted <= 0.001] <-'**'
sig[p.adjusted <= 0.0001] <-'***'
pairw.res = data.frame(pairs,F.Model,R2,p.value,p.adjusted,sig)
print("Signif. codes: 0 â***â 0.001 â**â 0.01 â*â 0.05 â.â 0.1 â â 1")
return(pairw.res)
}
pairwise.adonis(iris[,1:4],iris[,5])