# NOT RUN {
data(Aeut)
strata(Aeut) <- other(Aeut)$population_hierarchy[-1]
agc <- as.genclone(Aeut)
agc
amova.result <- poppr.amova(agc, ~Pop/Subpop)
amova.result
amova.test <- randtest(amova.result) # Test for significance
plot(amova.test)
amova.test
# }
# NOT RUN {
# You can get the same results with the pegas implementation
amova.pegas <- poppr.amova(agc, ~Pop/Subpop, method = "pegas")
amova.pegas
amova.pegas$varcomp/sum(amova.pegas$varcomp)
# Clone correction is possible
amova.cc.result <- poppr.amova(agc, ~Pop/Subpop, clonecorrect = TRUE)
amova.cc.result
amova.cc.test <- randtest(amova.cc.result)
plot(amova.cc.test)
amova.cc.test
# Example with filtering
data(monpop)
splitStrata(monpop) <- ~Tree/Year/Symptom
poppr.amova(monpop, ~Symptom/Year) # gets a warning of zero distances
poppr.amova(monpop, ~Symptom/Year, filter = TRUE, threshold = 0.1) # no warning
# Correcting incorrect alternate hypotheses with >2 heirarchical levels
#
mon.amova <- poppr.amova(monpop, ~Symptom/Year/Tree)
mon.test <- randtest(mon.amova)
mon.test # Note alter is less, greater, greater, less
alt <- c("less", "greater", "greater", "greater") # extend this to the number of levels
with(mon.test, as.krandtest(sim, obs, alter = alt, call = call, names = names))
# }
Run the code above in your browser using DataLab