Description Usage Arguments Value Examples
View source: R/Rarefaction_funs.R
Rarefaction testing with rarefactions within permutations
1 2 3 4 |
comm |
community matrix (patches=rows, species=columns) |
ttt |
treatment vector (treatment id of each patch) |
n_raref |
number of rarefactions |
nperm |
number of permutations |
method |
beta diversity metric (passed to vegan::betadisper) |
binary |
reduce data to presence/absence? (passed to vegan::betadisper) |
ptype |
p-value calculations: "raref_perm_meanF", calculate mean F-statistics within permutations; "raref_perm_meanp", calculate mean p-value across permutations; "raref_perm_medianp" (default), calculate median p-value across permutations. |
return.all |
(logical) return all information rather than summarized test statistics? |
dummy_raref |
(logical) [TESTING ONLY] fake rarefaction? (i.e., don't actually do any rarefaction) |
seed |
random-number seed |
A list with class "htest"
containing the following components:
method |
a string giving the method and number of rarefactions used |
estimate |
the mean beta diversity (measured as median distance from centroid) across all sites and rarefactions |
conf.int |
the confidence interval of the mean beta diversities across rarefactions |
statistic |
the median F-statistic across permutations |
p.value |
the p-value corresponding to the statistic |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | set.seed(101)
sx <- simComm(n.site=20,p.mix=0.5,n.indiv.site=c(10,20),totsp=c(20,40))
plot(sx)
raref_test(sx[,-1],sx[,1])
tmpf <- function(...) {
sx <- simComm(...)
tt <- try(raref_test(sx[,-1],sx[,1])$p.value)
if (is(tt,"try-error")) return(NA) else return(tt)
}
## Not run:
## compute power for this case
set.seed(101)
system.time(pvec <- replicate(100,tmpf(n.site=20,p.mix=0.5,
n.indiv.site=c(10,20),totsp=c(20,40))))
## ~ 10 minutes
hist(pvec,breaks=20,xlim=c(0,1),col="gray")
mean(pvec<0.05) ## 0; conservative (but very small sample!)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.