diff --git a/tests/Examples/vegan-Ex.Rout.save b/tests/Examples/vegan-Ex.Rout.save deleted file mode 100644 index 99f270b10..000000000 --- a/tests/Examples/vegan-Ex.Rout.save +++ /dev/null @@ -1,9207 +0,0 @@ - -R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid" -Copyright (C) 2022 The R Foundation for Statistical Computing -Platform: aarch64-apple-darwin20 (64-bit) - -R is free software and comes with ABSOLUTELY NO WARRANTY. -You are welcome to redistribute it under certain conditions. -Type 'license()' or 'licence()' for distribution details. - - Natural language support but running in an English locale - -R is a collaborative project with many contributors. -Type 'contributors()' for more information and -'citation()' on how to cite R or R packages in publications. - -Type 'demo()' for some demos, 'help()' for on-line help, or -'help.start()' for an HTML browser interface to help. -Type 'q()' to quit R. - -> pkgname <- "vegan" -> source(file.path(R.home("share"), "R", "examples-header.R")) -> options(warn = 1) -> library('vegan') -Loading required package: permute -Loading required package: lattice -This is vegan 2.6-3 -> -> base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') -> base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') -> cleanEx() -> nameEx("BCI") -> ### * BCI -> -> flush(stderr()); flush(stdout()) -> -> ### Name: BCI -> ### Title: Barro Colorado Island Tree Counts -> ### Aliases: BCI BCI.env -> ### Keywords: datasets -> -> ### ** Examples -> -> data(BCI, BCI.env) -> head(BCI.env) - UTM.EW UTM.NS Precipitation Elevation Age.cat Geology Habitat Stream EnvHet -1 625754 1011569 2530 120 c3 Tb OldSlope Yes 0.6272 -2 625754 1011669 2530 120 c3 Tb OldLow Yes 0.3936 -3 625754 1011769 2530 120 c3 Tb OldLow No 0.0000 -4 625754 1011869 2530 120 c3 Tb OldLow No 0.0000 -5 625754 1011969 2530 120 c3 Tb OldSlope No 0.4608 -6 625854 1011569 2530 120 c3 Tb OldLow No 0.0768 -> ## see changed species names -> oldnames <- attr(BCI, "original.names") -> taxa <- cbind("Old Names" = oldnames, "Current Names" = names(BCI)) -> noquote(taxa[taxa[,1] != taxa[,2], ]) - Old Names Current Names - [1,] Abarema.macradenium Abarema.macradenia - [2,] Acacia.melanoceras Vachellia.melanoceras - [3,] Apeiba.aspera Apeiba.glabra - [4,] Aspidosperma.cruenta Aspidosperma.desmanthum - [5,] Cassipourea.elliptica Cassipourea.guianensis - [6,] Cespedezia.macrophylla Cespedesia.spathulata - [7,] Chlorophora.tinctoria Maclura.tinctoria - [8,] Coccoloba.manzanillensis Coccoloba.manzinellensis - [9,] Coussarea.curvigemmia Coussarea.curvigemma -[10,] Cupania.sylvatica Cupania.seemannii -[11,] Dipteryx.panamensis Dipteryx.oleifera -[12,] Eugenia.coloradensis Eugenia.florida -[13,] Eugenia.oerstedeana Eugenia.oerstediana -[14,] Guapira.standleyana Guapira.myrtiflora -[15,] Hyeronima.alchorneoides Hieronyma.alchorneoides -[16,] Inga.marginata Inga.semialata -[17,] Lonchocarpus.latifolius Lonchocarpus.heptaphyllus -[18,] Maquira.costaricana Maquira.guianensis.costaricana -[19,] Phoebe.cinnamomifolia Cinnamomum.triplinerve -[20,] Swartzia.simplex.var.ochnacea Swartzia.simplex.continentalis -[21,] Tabebuia.guayacan Handroanthus.guayacan -> -> -> -> cleanEx() -> nameEx("CCorA") -> ### * CCorA -> -> flush(stderr()); flush(stdout()) -> -> ### Name: CCorA -> ### Title: Canonical Correlation Analysis -> ### Aliases: CCorA biplot.CCorA -> ### Keywords: multivariate -> -> ### ** Examples -> -> # Example using two mite groups. The mite data are available in vegan -> data(mite) -> # Two mite species associations (Legendre 2005, Fig. 4) -> group.1 <- c(1,2,4:8,10:15,17,19:22,24,26:30) -> group.2 <- c(3,9,16,18,23,25,31:35) -> # Separate Hellinger transformations of the two groups of species -> mite.hel.1 <- decostand(mite[,group.1], "hel") -> mite.hel.2 <- decostand(mite[,group.2], "hel") -> rownames(mite.hel.1) = paste("S",1:nrow(mite),sep="") -> rownames(mite.hel.2) = paste("S",1:nrow(mite),sep="") -> out <- CCorA(mite.hel.1, mite.hel.2) -> out - -Canonical Correlation Analysis - -Call: -CCorA(Y = mite.hel.1, X = mite.hel.2) - - Y X -Matrix Ranks 24 11 - -Pillai's trace: 4.573009 - -Significance of Pillai's trace: -from F-distribution: 0.0032737 - CanAxis1 CanAxis2 CanAxis3 CanAxis4 CanAxis5 CanAxis6 -Canonical Correlations 0.92810 0.82431 0.81209 0.74981 0.70795 0.65950 - CanAxis7 CanAxis8 CanAxis9 CanAxis10 CanAxis11 -Canonical Correlations 0.50189 0.48179 0.41089 0.37823 0.28 - - Y | X X | Y -RDA R squares 0.33224 0.5376 -adj. RDA R squares 0.20560 0.2910 - -> biplot(out, "ob") # Two plots of objects -> biplot(out, "v", cex=c(0.7,0.6)) # Two plots of variables -> biplot(out, "ov", cex=c(0.7,0.6)) # Four plots (2 for objects, 2 for variables) -> biplot(out, "b", cex=c(0.7,0.6)) # Two biplots -> biplot(out, xlabs = NA, plot.axes = c(3,5)) # Plot axes 3, 5. No object names -> biplot(out, plot.type="biplots", xlabs = NULL) # Replace object names by numbers -> -> # Example using random numbers. No significant relationship is expected -> mat1 <- matrix(rnorm(60),20,3) -> mat2 <- matrix(rnorm(100),20,5) -> out2 = CCorA(mat1, mat2, permutations=99) -> out2 - -Canonical Correlation Analysis - -Call: -CCorA(Y = mat1, X = mat2, permutations = 99) - - Y X -Matrix Ranks 3 5 - -Pillai's trace: 0.6455578 - -Significance of Pillai's trace: -from F-distribution: 0.70352 -based on permutations: 0.71 -Permutation: free -Number of permutations: 99 - - CanAxis1 CanAxis2 CanAxis3 -Canonical Correlations 0.69691 0.38140 0.12 - - Y | X X | Y -RDA R squares 0.17066 0.1368 -adj. RDA R squares -0.12553 -0.0250 - -> biplot(out2, "b") -> -> -> -> cleanEx() -> nameEx("MDSrotate") -> ### * MDSrotate -> -> flush(stderr()); flush(stdout()) -> -> ### Name: MDSrotate -> ### Title: Rotate First MDS Dimension Parallel to an External Variable -> ### Aliases: MDSrotate -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(varespec) -> data(varechem) -> mod <- monoMDS(vegdist(varespec)) -> mod <- with(varechem, MDSrotate(mod, pH)) -> plot(mod) -> ef <- envfit(mod ~ pH, varechem, permutations = 0) -> plot(ef) -> ordisurf(mod ~ pH, varechem, knots = 1, add = TRUE) - -Family: gaussian -Link function: identity - -Formula: -y ~ poly(x1, 1) + poly(x2, 1) -Total model degrees of freedom 3 - -REML score: -3.187414 -> -> -> -> cleanEx() -> nameEx("MOStest") -> ### * MOStest -> -> flush(stderr()); flush(stdout()) -> -> ### Name: MOStest -> ### Title: Mitchell-Olds and Shaw Test for the Location of Quadratic -> ### Extreme -> ### Aliases: MOStest plot.MOStest fieller.MOStest profile.MOStest -> ### confint.MOStest -> ### Keywords: models regression -> -> ### ** Examples -> -> ## The Al-Mufti data analysed in humpfit(): -> mass <- c(140,230,310,310,400,510,610,670,860,900,1050,1160,1900,2480) -> spno <- c(1, 4, 3, 9, 18, 30, 20, 14, 3, 2, 3, 2, 5, 2) -> mod <- MOStest(mass, spno) -> ## Insignificant -> mod - -Mitchell-Olds and Shaw test -Null: hump of a quadratic linear predictor is at min or max - -Family: gaussian -Link function: identity - - hump min max - 46.89749 140.00000 2480.00000 -***** Caution: hump/pit not bracketed by the data ****** - - min/max F Pr(>F) -hump at min 140 0.0006 0.9816 -hump at max 2480 0.3161 0.5852 -Combined 0.9924 -> ## ... but inadequate shape of the curve -> op <- par(mfrow=c(2,2), mar=c(4,4,1,1)+.1) -> plot(mod) -> ## Looks rather like log-link with Poisson error and logarithmic biomass -> mod <- MOStest(log(mass), spno, family=quasipoisson) -> mod - -Mitchell-Olds and Shaw test -Null: hump of a quadratic linear predictor is at min or max - -Family: quasipoisson -Link function: log - - min hump max -4.941642 6.243371 7.816014 - - min/max F Pr(>F) -hump at min 4.9416 7.1367 0.02174 * -hump at max 7.8160 9.0487 0.01191 * -Combined 0.03338 * ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> plot(mod) -> par(op) -> ## Confidence Limits -> fieller.MOStest(mod) - 2.5 % 97.5 % -5.255827 6.782979 -> confint(mod) - 2.5 % 97.5 % -5.816021 6.574378 -> plot(profile(mod)) -> -> -> -> graphics::par(get("par.postscript", pos = 'CheckExEnv')) -> cleanEx() -> nameEx("RsquareAdj") -> ### * RsquareAdj -> -> flush(stderr()); flush(stdout()) -> -> ### Name: RsquareAdj -> ### Title: Adjusted R-square -> ### Aliases: RsquareAdj RsquareAdj.default RsquareAdj.rda RsquareAdj.cca -> ### RsquareAdj.lm RsquareAdj.glm -> ### Keywords: univar multivariate -> -> ### ** Examples -> -> data(mite) -> data(mite.env) -> ## rda -> m <- rda(decostand(mite, "hell") ~ ., mite.env) -> RsquareAdj(m) -$r.squared -[1] 0.5265047 - -$adj.r.squared -[1] 0.4367038 - -> ## cca -> m <- cca(decostand(mite, "hell") ~ ., mite.env) -> RsquareAdj(m) -$r.squared -[1] 0.4471676 - -$adj.r.squared -[1] 0.3429248 - -> ## default method -> RsquareAdj(0.8, 20, 5) -[1] 0.7285714 -> -> -> -> cleanEx() -> nameEx("SSarrhenius") -> ### * SSarrhenius -> -> flush(stderr()); flush(stdout()) -> -> ### Name: SSarrhenius -> ### Title: Self-Starting nls Species-Area Models -> ### Aliases: SSarrhenius SSlomolino SSgitay SSgleason -> ### Keywords: models -> -> ### ** Examples -> -> ## Get species area data: sipoo.map gives the areas of islands -> data(sipoo, sipoo.map) -> S <- specnumber(sipoo) -> plot(S ~ area, sipoo.map, xlab = "Island Area (ha)", -+ ylab = "Number of Species", ylim = c(1, max(S))) -> ## The Arrhenius model -> marr <- nls(S ~ SSarrhenius(area, k, z), data=sipoo.map) -> marr -Nonlinear regression model - model: S ~ SSarrhenius(area, k, z) - data: sipoo.map - k z -3.4062 0.4364 - residual sum-of-squares: 78.1 - -Number of iterations to convergence: 5 -Achieved convergence tolerance: 1.056e-06 -> ## confidence limits from profile likelihood -> confint(marr) -Waiting for profiling to be done... - 2.5% 97.5% -k 2.6220312 4.3033906 -z 0.3813576 0.4944693 -> ## draw a line -> xtmp <- with(sipoo.map, seq(min(area), max(area), len=51)) -> lines(xtmp, predict(marr, newdata=data.frame(area = xtmp)), lwd=2) -> ## The normal way is to use linear regression on log-log data, -> ## but this will be different from the previous: -> mloglog <- lm(log(S) ~ log(area), data=sipoo.map) -> mloglog - -Call: -lm(formula = log(S) ~ log(area), data = sipoo.map) - -Coefficients: -(Intercept) log(area) - 1.0111 0.4925 - -> lines(xtmp, exp(predict(mloglog, newdata=data.frame(area=xtmp))), -+ lty=2) -> ## Gleason: log-linear -> mgle <- nls(S ~ SSgleason(area, k, slope), sipoo.map) -> lines(xtmp, predict(mgle, newdata=data.frame(area=xtmp)), -+ lwd=2, col=2) -> ## Gitay: quadratic of log-linear -> mgit <- nls(S ~ SSgitay(area, k, slope), sipoo.map) -> lines(xtmp, predict(mgit, newdata=data.frame(area=xtmp)), -+ lwd=2, col = 3) -> ## Lomolino: using original names of the parameters (Lomolino 2000): -> mlom <- nls(S ~ SSlomolino(area, Smax, A50, Hill), sipoo.map) -> mlom -Nonlinear regression model - model: S ~ SSlomolino(area, Smax, A50, Hill) - data: sipoo.map - Smax A50 Hill -53.493 94.697 2.018 - residual sum-of-squares: 55.37 - -Number of iterations to convergence: 6 -Achieved convergence tolerance: 9.715e-07 -> lines(xtmp, predict(mlom, newdata=data.frame(area=xtmp)), -+ lwd=2, col = 4) -> ## One canned model of standard R: -> mmic <- nls(S ~ SSmicmen(area, slope, Asym), sipoo.map) -> lines(xtmp, predict(mmic, newdata = data.frame(area=xtmp)), -+ lwd =2, col = 5) -> legend("bottomright", c("Arrhenius", "log-log linear", "Gleason", "Gitay", -+ "Lomolino", "Michaelis-Menten"), col=c(1,1,2,3,4,5), lwd=c(2,1,2,2,2,2), -+ lty=c(1,2,1,1,1,1)) -> ## compare models (AIC) -> allmods <- list(Arrhenius = marr, Gleason = mgle, Gitay = mgit, -+ Lomolino = mlom, MicMen= mmic) -> sapply(allmods, AIC) -Arrhenius Gleason Gitay Lomolino MicMen - 83.49847 96.94018 80.54984 79.30718 83.02003 -> -> -> -> cleanEx() -> nameEx("add1.cca") -> ### * add1.cca -> -> flush(stderr()); flush(stdout()) -> -> ### Name: add1.cca -> ### Title: Add or Drop Single Terms to a Constrained Ordination Model -> ### Aliases: add1.cca drop1.cca -> ### Keywords: multivariate models -> -> ### ** Examples -> -> data(dune) -> data(dune.env) -> ## Automatic model building based on AIC but with permutation tests -> step(cca(dune ~ 1, dune.env), reformulate(names(dune.env)), test="perm") -Start: AIC=87.66 -dune ~ 1 - - Df AIC F Pr(>F) -+ Moisture 3 86.608 2.2536 0.005 ** -+ Management 3 86.935 2.1307 0.010 ** -+ A1 1 87.411 2.1400 0.020 * - 87.657 -+ Manure 4 88.832 1.5251 0.035 * -+ Use 2 89.134 1.1431 0.215 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Step: AIC=86.61 -dune ~ Moisture - - Df AIC F Pr(>F) - 86.608 -+ Management 3 86.813 1.4565 0.055 . -+ A1 1 86.992 1.2624 0.205 -+ Use 2 87.259 1.2760 0.205 -+ Manure 4 87.342 1.3143 0.130 -- Moisture 3 87.657 2.2536 0.005 ** ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -Call: cca(formula = dune ~ Moisture, data = dune.env) - - Inertia Proportion Rank -Total 2.1153 1.0000 -Constrained 0.6283 0.2970 3 -Unconstrained 1.4870 0.7030 16 -Inertia is scaled Chi-square - -Eigenvalues for constrained axes: - CCA1 CCA2 CCA3 -0.4187 0.1330 0.0766 - -Eigenvalues for unconstrained axes: - CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8 CA9 CA10 CA11 -0.4098 0.2259 0.1761 0.1234 0.1082 0.0908 0.0859 0.0609 0.0566 0.0467 0.0419 - CA12 CA13 CA14 CA15 CA16 -0.0201 0.0143 0.0099 0.0085 0.0080 - -> ## see ?ordistep to do the same, but based on permutation P-values -> ## Not run: -> ##D ordistep(cca(dune ~ 1, dune.env), reformulate(names(dune.env))) -> ## End(Not run) -> ## Manual model building -> ## -- define the maximal model for scope -> mbig <- rda(dune ~ ., dune.env) -> ## -- define an empty model to start with -> m0 <- rda(dune ~ 1, dune.env) -> ## -- manual selection and updating -> add1(m0, scope=formula(mbig), test="perm") - Df AIC F Pr(>F) - 89.620 -A1 1 89.591 1.9217 0.010 ** -Moisture 3 87.707 2.5883 0.005 ** -Management 3 87.082 2.8400 0.005 ** -Use 2 91.032 1.1741 0.245 -Manure 4 89.232 1.9539 0.025 * ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> m0 <- update(m0, . ~ . + Management) -> add1(m0, scope=formula(mbig), test="perm") - Df AIC F Pr(>F) - 87.082 -A1 1 87.424 1.2965 0.195 -Moisture 3 85.567 1.9764 0.005 ** -Use 2 88.284 1.0510 0.385 -Manure 3 87.517 1.3902 0.080 . ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> m0 <- update(m0, . ~ . + Moisture) -> ## -- included variables still significant? -> drop1(m0, test="perm") - Df AIC F Pr(>F) - 85.567 -Management 3 87.707 2.1769 0.015 * -Moisture 3 87.082 1.9764 0.025 * ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> add1(m0, scope=formula(mbig), test="perm") - Df AIC F Pr(>F) - 85.567 -A1 1 86.220 0.8359 0.610 -Use 2 86.842 0.8027 0.730 -Manure 3 85.762 1.1225 0.285 -> -> -> -> cleanEx() -> nameEx("adipart") -> ### * adipart -> -> flush(stderr()); flush(stdout()) -> -> ### Name: adipart -> ### Title: Additive Diversity Partitioning and Hierarchical Null Model -> ### Testing -> ### Aliases: adipart adipart.default adipart.formula hiersimu -> ### hiersimu.default hiersimu.formula -> ### Keywords: multivariate -> -> ### ** Examples -> -> ## NOTE: 'nsimul' argument usually needs to be >= 99 -> ## here much lower value is used for demonstration -> -> data(mite) -> data(mite.xy) -> data(mite.env) -> ## Function to get equal area partitions of the mite data -> cutter <- function (x, cut = seq(0, 10, by = 2.5)) { -+ out <- rep(1, length(x)) -+ for (i in 2:(length(cut) - 1)) -+ out[which(x > cut[i] & x <= cut[(i + 1)])] <- i -+ return(out)} -> ## The hierarchy of sample aggregation -> levsm <- with(mite.xy, data.frame( -+ l1=1:nrow(mite), -+ l2=cutter(y, cut = seq(0, 10, by = 2.5)), -+ l3=cutter(y, cut = seq(0, 10, by = 5)), -+ l4=rep(1, nrow(mite)))) -> ## Let's see in a map -> par(mfrow=c(1,3)) -> plot(mite.xy, main="l1", col=as.numeric(levsm$l1)+1, asp = 1) -> plot(mite.xy, main="l2", col=as.numeric(levsm$l2)+1, asp = 1) -> plot(mite.xy, main="l3", col=as.numeric(levsm$l3)+1, asp = 1) -> par(mfrow=c(1,1)) -> ## Additive diversity partitioning -> adipart(mite, index="richness", nsimul=19) -adipart object - -Call: adipart(y = mite, index = "richness", nsimul = 19) - -nullmodel method ‘r2dtable’ with 19 simulations -options: index richness, weights unif -alternative hypothesis: statistic is less or greater than simulated values - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -alpha.1 15.114 -38.43 22.344 22.032 22.300 22.608 0.05 * -gamma 35.000 0.00 35.000 35.000 35.000 35.000 1.00 -beta.1 19.886 38.43 12.656 12.392 12.700 12.968 0.05 * ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## the next two define identical models -> adipart(mite, levsm, index="richness", nsimul=19) -adipart object - -Call: adipart(y = mite, x = levsm, index = "richness", nsimul = 19) - -nullmodel method ‘r2dtable’ with 19 simulations -options: index richness, weights unif -alternative hypothesis: statistic is less or greater than simulated values - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -alpha.1 15.114 -46.2370 22.39624 22.12571 22.44286 22.6236 0.05 * -alpha.2 29.750 -21.7076 34.81579 34.36250 35.00000 35.0000 0.05 * -alpha.3 33.000 0.0000 35.00000 35.00000 35.00000 35.0000 0.05 * -gamma 35.000 0.0000 35.00000 35.00000 35.00000 35.0000 1.00 -beta.1 14.636 9.0407 12.41955 12.00750 12.42857 12.8743 0.05 * -beta.2 3.250 13.1373 0.18421 0.00000 0.00000 0.6375 0.05 * -beta.3 2.000 0.0000 0.00000 0.00000 0.00000 0.0000 0.05 * ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> adipart(mite ~ l2 + l3, levsm, index="richness", nsimul=19) -adipart object - -Call: adipart(formula = mite ~ l2 + l3, data = levsm, index = -"richness", nsimul = 19) - -nullmodel method ‘r2dtable’ with 19 simulations -options: index richness, weights unif -alternative hypothesis: statistic is less or greater than simulated values - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -alpha.1 15.114 -42.859 22.37669 22.04071 22.40000 22.573 0.05 * -alpha.2 29.750 -26.571 34.85526 34.50000 35.00000 35.000 0.05 * -alpha.3 33.000 0.000 35.00000 35.00000 35.00000 35.000 0.05 * -gamma 35.000 0.000 35.00000 35.00000 35.00000 35.000 1.00 -beta.1 14.636 7.976 12.47857 12.07500 12.47143 12.959 0.05 * -beta.2 3.250 16.162 0.14474 0.00000 0.00000 0.500 0.05 * -beta.3 2.000 0.000 0.00000 0.00000 0.00000 0.000 0.05 * ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## Hierarchical null model testing -> ## diversity analysis (similar to adipart) -> hiersimu(mite, FUN=diversity, relative=TRUE, nsimul=19) -hiersimu object - -Call: hiersimu(y = mite, FUN = diversity, relative = TRUE, nsimul = 19) - -nullmodel method ‘r2dtable’ with 19 simulations - -alternative hypothesis: statistic is less or greater than simulated values - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -level_1 0.76064 -75.139 0.93833 0.93389 0.93819 0.9427 0.05 * -leve_2 1.00000 0.000 1.00000 1.00000 1.00000 1.0000 1.00 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> hiersimu(mite ~ l2 + l3, levsm, FUN=diversity, relative=TRUE, nsimul=19) -hiersimu object - -Call: hiersimu(formula = mite ~ l2 + l3, data = levsm, FUN = diversity, -relative = TRUE, nsimul = 19) - -nullmodel method ‘r2dtable’ with 19 simulations - -alternative hypothesis: statistic is less or greater than simulated values - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -unit 0.76064 -83.007 0.93793 0.93363 0.93817 0.9408 0.05 * -l2 0.89736 -129.886 0.99789 0.99660 0.99788 0.9991 0.05 * -l3 0.92791 -463.547 0.99935 0.99902 0.99940 0.9996 0.05 * -all 1.00000 0.000 1.00000 1.00000 1.00000 1.0000 1.00 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## Hierarchical testing with the Morisita index -> morfun <- function(x) dispindmorisita(x)$imst -> hiersimu(mite ~., levsm, morfun, drop.highest=TRUE, nsimul=19) -hiersimu object - -Call: hiersimu(formula = mite ~ ., data = levsm, FUN = morfun, -drop.highest = TRUE, nsimul = 19) - -nullmodel method ‘r2dtable’ with 19 simulations - -alternative hypothesis: statistic is less or greater than simulated values - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -l1 0.52070 6.2507 0.359444 0.317812 0.364394 0.3973 0.05 * -l2 0.60234 15.2219 0.146268 0.090822 0.148198 0.1948 0.05 * -l3 0.67509 21.5181 -0.216038 -0.287581 -0.228599 -0.1523 0.05 * ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> -> -> graphics::par(get("par.postscript", pos = 'CheckExEnv')) -> cleanEx() -> nameEx("adonis") -> ### * adonis -> -> flush(stderr()); flush(stdout()) -> -> ### Name: adonis -> ### Title: Permutational Multivariate Analysis of Variance Using Distance -> ### Matrices -> ### Aliases: adonis2 -> ### Keywords: multivariate nonparametric -> -> ### ** Examples -> -> data(dune) -> data(dune.env) -> ## default test by terms -> adonis2(dune ~ Management*A1, data = dune.env) -Permutation test for adonis under reduced model -Terms added sequentially (first to last) -Permutation: free -Number of permutations: 999 - -adonis2(formula = dune ~ Management * A1, data = dune.env) - Df SumOfSqs R2 F Pr(>F) -Management 3 1.4686 0.34161 3.2629 0.002 ** -A1 1 0.4409 0.10256 2.9387 0.013 * -Management:A1 3 0.5892 0.13705 1.3090 0.192 -Residual 12 1.8004 0.41878 -Total 19 4.2990 1.00000 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## overall tests -> adonis2(dune ~ Management*A1, data = dune.env, by = NULL) -Permutation test for adonis under reduced model -Permutation: free -Number of permutations: 999 - -adonis2(formula = dune ~ Management * A1, data = dune.env, by = NULL) - Df SumOfSqs R2 F Pr(>F) -Model 7 2.4987 0.58122 2.3792 0.001 *** -Residual 12 1.8004 0.41878 -Total 19 4.2990 1.00000 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> ### Example of use with strata, for nested (e.g., block) designs. -> dat <- expand.grid(rep=gl(2,1), NO3=factor(c(0,10)),field=gl(3,1) ) -> dat - rep NO3 field -1 1 0 1 -2 2 0 1 -3 1 10 1 -4 2 10 1 -5 1 0 2 -6 2 0 2 -7 1 10 2 -8 2 10 2 -9 1 0 3 -10 2 0 3 -11 1 10 3 -12 2 10 3 -> Agropyron <- with(dat, as.numeric(field) + as.numeric(NO3)+2) +rnorm(12)/2 -> Schizachyrium <- with(dat, as.numeric(field) - as.numeric(NO3)+2) +rnorm(12)/2 -> total <- Agropyron + Schizachyrium -> dotplot(total ~ NO3, dat, jitter.x=TRUE, groups=field, -+ type=c('p','a'), xlab="NO3", auto.key=list(columns=3, lines=TRUE) ) -> -> Y <- data.frame(Agropyron, Schizachyrium) -> mod <- metaMDS(Y, trace = FALSE) -> plot(mod) -> ### Ellipsoid hulls show treatment -> with(dat, ordiellipse(mod, field, kind = "ehull", label = TRUE)) -> ### Spider shows fields -> with(dat, ordispider(mod, field, lty=3, col="red")) -> -> ### Incorrect (no strata) -> adonis2(Y ~ NO3, data = dat, permutations = 199) -Permutation test for adonis under reduced model -Terms added sequentially (first to last) -Permutation: free -Number of permutations: 199 - -adonis2(formula = Y ~ NO3, data = dat, permutations = 199) - Df SumOfSqs R2 F Pr(>F) -NO3 1 0.020795 0.17606 2.1368 0.12 -Residual 10 0.097321 0.82394 -Total 11 0.118116 1.00000 -> ## Correct with strata -> with(dat, adonis2(Y ~ NO3, data = dat, permutations = 199, strata = field)) -Permutation test for adonis under reduced model -Terms added sequentially (first to last) -Blocks: strata -Permutation: free -Number of permutations: 199 - -adonis2(formula = Y ~ NO3, data = dat, permutations = 199, strata = field) - Df SumOfSqs R2 F Pr(>F) -NO3 1 0.020795 0.17606 2.1368 0.01 ** -Residual 10 0.097321 0.82394 -Total 11 0.118116 1.00000 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> -> -> cleanEx() -> nameEx("anosim") -> ### * anosim -> -> flush(stderr()); flush(stdout()) -> -> ### Name: anosim -> ### Title: Analysis of Similarities -> ### Aliases: anosim summary.anosim plot.anosim -> ### Keywords: multivariate nonparametric htest -> -> ### ** Examples -> -> data(dune) -> data(dune.env) -> dune.dist <- vegdist(dune) -> dune.ano <- with(dune.env, anosim(dune.dist, Management)) -> summary(dune.ano) - -Call: -anosim(x = dune.dist, grouping = Management) -Dissimilarity: bray - -ANOSIM statistic R: 0.2579 - Significance: 0.011 - -Permutation: free -Number of permutations: 999 - -Upper quantiles of permutations (null model): - 90% 95% 97.5% 99% -0.109 0.152 0.195 0.243 - -Dissimilarity ranks between and within classes: - 0% 25% 50% 75% 100% N -Between 4 58.50 104.00 145.500 188.0 147 -BF 5 15.25 25.50 41.250 57.0 3 -HF 1 7.25 46.25 68.125 89.5 10 -NM 6 64.75 124.50 156.250 181.0 15 -SF 3 32.75 53.50 99.250 184.0 15 - -> plot(dune.ano) -Warning in (function (z, notch = FALSE, width = NULL, varwidth = FALSE, : - some notches went outside hinges ('box'): maybe set notch=FALSE -> -> -> -> cleanEx() -> nameEx("anova.cca") -> ### * anova.cca -> -> flush(stderr()); flush(stdout()) -> -> ### Name: anova.cca -> ### Title: Permutation Test for Constrained Correspondence Analysis, -> ### Redundancy Analysis and Constrained Analysis of Principal Coordinates -> ### Aliases: anova.cca permutest permutest.cca -> ### Keywords: multivariate htest -> -> ### ** Examples -> -> data(dune, dune.env) -> mod <- cca(dune ~ Moisture + Management, dune.env) -> ## overall test -> anova(mod) -Permutation test for cca under reduced model -Permutation: free -Number of permutations: 999 - -Model: cca(formula = dune ~ Moisture + Management, data = dune.env) - Df ChiSquare F Pr(>F) -Model 6 1.0024 1.9515 0.001 *** -Residual 13 1.1129 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## tests for individual terms -> anova(mod, by="term") -Permutation test for cca under reduced model -Terms added sequentially (first to last) -Permutation: free -Number of permutations: 999 - -Model: cca(formula = dune ~ Moisture + Management, data = dune.env) - Df ChiSquare F Pr(>F) -Moisture 3 0.62831 2.4465 0.001 *** -Management 3 0.37407 1.4565 0.066 . -Residual 13 1.11289 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> anova(mod, by="margin") -Permutation test for cca under reduced model -Marginal effects of terms -Permutation: free -Number of permutations: 999 - -Model: cca(formula = dune ~ Moisture + Management, data = dune.env) - Df ChiSquare F Pr(>F) -Moisture 3 0.39854 1.5518 0.034 * -Management 3 0.37407 1.4565 0.063 . -Residual 13 1.11289 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## sequential test for contrasts -> anova(mod, by = "onedf") -Permutation test for cca under reduced model -Sequential test for contrasts -Permutation: free -Number of permutations: 999 - -Model: cca(formula = dune ~ Moisture + Management, data = dune.env) - Df ChiSquare F Pr(>F) -Moisture.L 1 0.41081 4.7988 0.001 *** -Moisture.Q 1 0.11261 1.3154 0.198 -Moisture.C 1 0.10489 1.2253 0.240 -ManagementHF 1 0.08849 1.0337 0.415 -ManagementNM 1 0.20326 2.3744 0.014 * -ManagementSF 1 0.08231 0.9615 0.440 -Residual 13 1.11289 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## test for adding all environmental variables -> anova(mod, cca(dune ~ ., dune.env)) -Permutation tests for cca under reduced model -Permutation: free -Number of permutations: 999 - -Model 1: dune ~ Moisture + Management -Model 2: dune ~ A1 + Moisture + Management + Use + Manure - ResDf ResChiSquare Df ChiSquare F Pr(>F) -1 13 1.1129 -2 7 0.6121 6 0.50079 0.9545 0.565 -> -> -> -> cleanEx() -> nameEx("avgdist") -> ### * avgdist -> -> flush(stderr()); flush(stdout()) -> -> ### Name: avgdist -> ### Title: Averaged Subsampled Dissimilarity Matrices -> ### Aliases: avgdist -> ### Keywords: multivariate -> -> ### ** Examples -> -> # Import an example count dataset -> data(BCI) -> # Test the base functionality -> mean.avg.dist <- avgdist(BCI, sample = 50, iterations = 10) -> # Test the transformation function -> mean.avg.dist.t <- avgdist(BCI, sample = 50, iterations = 10, transf = sqrt) -> # Test the median functionality -> median.avg.dist <- avgdist(BCI, sample = 50, iterations = 10, meanfun = median) -> # Print the resulting tables -> head(as.matrix(mean.avg.dist)) - 1 2 3 4 5 6 7 8 9 10 11 12 13 -1 0.000 0.536 0.606 0.604 0.630 0.606 0.636 0.584 0.636 0.610 0.620 0.628 0.730 -2 0.536 0.000 0.526 0.584 0.606 0.568 0.554 0.532 0.596 0.576 0.612 0.574 0.714 -3 0.606 0.526 0.000 0.568 0.590 0.570 0.570 0.600 0.636 0.598 0.594 0.616 0.742 -4 0.604 0.584 0.568 0.000 0.600 0.636 0.600 0.586 0.588 0.598 0.600 0.588 0.690 -5 0.630 0.606 0.590 0.600 0.000 0.588 0.622 0.612 0.680 0.648 0.664 0.674 0.768 -6 0.606 0.568 0.570 0.636 0.588 0.000 0.572 0.592 0.622 0.624 0.608 0.564 0.706 - 14 15 16 17 18 19 20 21 22 23 24 25 26 -1 0.612 0.616 0.612 0.670 0.690 0.620 0.602 0.640 0.642 0.694 0.638 0.604 0.640 -2 0.558 0.590 0.590 0.606 0.642 0.584 0.580 0.622 0.590 0.660 0.578 0.590 0.644 -3 0.610 0.606 0.606 0.650 0.732 0.668 0.610 0.638 0.630 0.722 0.644 0.610 0.672 -4 0.554 0.620 0.616 0.630 0.648 0.632 0.592 0.616 0.566 0.660 0.612 0.602 0.630 -5 0.662 0.608 0.664 0.740 0.754 0.674 0.604 0.672 0.678 0.722 0.670 0.656 0.674 -6 0.652 0.680 0.610 0.628 0.664 0.636 0.648 0.642 0.600 0.702 0.614 0.648 0.690 - 27 28 29 30 31 32 33 34 35 36 37 38 39 -1 0.648 0.654 0.660 0.648 0.626 0.704 0.712 0.706 0.782 0.646 0.648 0.660 0.708 -2 0.634 0.622 0.598 0.600 0.596 0.620 0.610 0.654 0.752 0.622 0.606 0.618 0.636 -3 0.652 0.664 0.640 0.646 0.638 0.662 0.660 0.708 0.806 0.670 0.644 0.672 0.692 -4 0.636 0.630 0.640 0.610 0.616 0.608 0.620 0.646 0.754 0.654 0.610 0.636 0.642 -5 0.694 0.710 0.730 0.688 0.660 0.710 0.716 0.774 0.806 0.722 0.694 0.752 0.740 -6 0.636 0.662 0.656 0.694 0.638 0.678 0.682 0.716 0.802 0.732 0.682 0.680 0.726 - 40 41 42 43 44 45 46 47 48 49 50 -1 0.720 0.656 0.604 0.626 0.644 0.660 0.680 0.638 0.636 0.648 0.618 -2 0.656 0.662 0.596 0.644 0.626 0.686 0.630 0.618 0.636 0.666 0.658 -3 0.740 0.706 0.628 0.674 0.672 0.682 0.732 0.728 0.716 0.712 0.682 -4 0.668 0.630 0.612 0.660 0.642 0.692 0.644 0.630 0.618 0.674 0.670 -5 0.754 0.702 0.658 0.696 0.702 0.712 0.760 0.734 0.720 0.714 0.704 -6 0.720 0.712 0.672 0.670 0.676 0.706 0.712 0.708 0.682 0.716 0.696 -> head(as.matrix(mean.avg.dist.t)) - 1 2 3 4 5 6 7 -1 0.0000000 0.4971222 0.5504455 0.5650373 0.6037127 0.5732154 0.5655674 -2 0.4971222 0.0000000 0.5279194 0.5366537 0.5896262 0.5501730 0.5294849 -3 0.5504455 0.5279194 0.0000000 0.5659388 0.5690387 0.5485934 0.5716158 -4 0.5650373 0.5366537 0.5659388 0.0000000 0.6137449 0.5929411 0.5741391 -5 0.6037127 0.5896262 0.5690387 0.6137449 0.0000000 0.5824018 0.5996439 -6 0.5732154 0.5501730 0.5485934 0.5929411 0.5824018 0.0000000 0.5288390 - 8 9 10 11 12 13 14 -1 0.5766718 0.5660895 0.5683304 0.5719693 0.6226728 0.6728131 0.5750047 -2 0.4971463 0.5490313 0.5243184 0.5391853 0.5644553 0.6744136 0.5829752 -3 0.5403817 0.5533377 0.5436161 0.5466104 0.5879563 0.7113603 0.5989087 -4 0.5687870 0.5869477 0.5803508 0.5565057 0.6144551 0.6930677 0.5804903 -5 0.5752063 0.5783020 0.5665295 0.6202925 0.6731970 0.7530942 0.5920443 -6 0.5383517 0.5650321 0.5755501 0.5050705 0.5679918 0.6866850 0.6247771 - 15 16 17 18 19 20 21 -1 0.6073901 0.5625086 0.6298085 0.6839116 0.6253922 0.5850534 0.5854676 -2 0.5565272 0.5293488 0.6039255 0.6855138 0.5908935 0.5536972 0.5547022 -3 0.5531249 0.5870121 0.6223477 0.7357607 0.6187409 0.5771011 0.5842369 -4 0.6210343 0.5826977 0.6336218 0.6823110 0.6159749 0.6190561 0.6242065 -5 0.6265050 0.6175060 0.6728411 0.7884869 0.6609743 0.6195715 0.5894389 -6 0.6519224 0.5712305 0.5715748 0.6771532 0.5941379 0.6673727 0.5898572 - 22 23 24 25 26 27 28 -1 0.6095295 0.6934781 0.5999860 0.6088046 0.6197764 0.6066686 0.6211419 -2 0.5878140 0.6628852 0.5682451 0.5791906 0.6066656 0.5995413 0.5965602 -3 0.6465141 0.6940547 0.5863456 0.6062325 0.6474157 0.6269250 0.6290007 -4 0.6051916 0.6744422 0.6047740 0.6336588 0.6559008 0.6234681 0.6082199 -5 0.6855924 0.7390451 0.6390592 0.6589127 0.6311749 0.6536696 0.6732542 -6 0.5940498 0.6707013 0.5385179 0.6147452 0.6292993 0.6175582 0.5907937 - 29 30 31 32 33 34 35 -1 0.5844203 0.6059321 0.5773507 0.6525094 0.6256215 0.6627669 0.6913530 -2 0.5678595 0.6170673 0.5642622 0.6286451 0.6083331 0.6212863 0.6786967 -3 0.6043891 0.6367675 0.5989635 0.6488272 0.6514032 0.6731370 0.7465592 -4 0.6085219 0.6349577 0.6107142 0.6546062 0.6269988 0.6578085 0.7201154 -5 0.6293438 0.6715405 0.6461450 0.6493028 0.6492614 0.7308142 0.7761261 -6 0.5876728 0.6498821 0.6282996 0.6253907 0.6177656 0.6705725 0.7063830 - 36 37 38 39 40 41 42 -1 0.6103589 0.6340481 0.6294326 0.6513052 0.6771381 0.6351929 0.5656728 -2 0.6154118 0.5915793 0.6189714 0.6587124 0.6358406 0.6389415 0.5564324 -3 0.6060781 0.5935379 0.6239267 0.6799280 0.7090062 0.6714266 0.6015138 -4 0.6495798 0.6089056 0.6104923 0.6267610 0.6540122 0.6414691 0.6004736 -5 0.6368448 0.6460347 0.6682632 0.6876339 0.7230903 0.6695214 0.5907328 -6 0.6500248 0.6268781 0.5976411 0.6613476 0.6693275 0.6775097 0.6127661 - 43 44 45 46 47 48 49 -1 0.6306231 0.6002481 0.6203340 0.6492316 0.6038990 0.5990162 0.6300217 -2 0.5975001 0.5968331 0.6196652 0.6856523 0.6119121 0.5902910 0.6471455 -3 0.6429738 0.6528078 0.6156019 0.7049608 0.6529912 0.6490557 0.6799733 -4 0.6417958 0.6307641 0.6522227 0.6887912 0.6480010 0.6302376 0.6774021 -5 0.6473546 0.6206601 0.6588930 0.7360828 0.6636870 0.6479241 0.6665464 -6 0.6429098 0.5966617 0.6294974 0.6868195 0.6418824 0.6516441 0.6600407 - 50 -1 0.6282584 -2 0.6008708 -3 0.6326575 -4 0.6592731 -5 0.6325287 -6 0.6345833 -> head(as.matrix(median.avg.dist)) - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -1 0.00 0.57 0.56 0.64 0.65 0.61 0.59 0.58 0.58 0.60 0.58 0.65 0.71 0.60 0.62 -2 0.57 0.00 0.56 0.61 0.60 0.61 0.55 0.53 0.61 0.56 0.54 0.60 0.68 0.55 0.58 -3 0.56 0.56 0.00 0.54 0.58 0.65 0.58 0.50 0.59 0.55 0.62 0.62 0.73 0.62 0.59 -4 0.64 0.61 0.54 0.00 0.64 0.63 0.61 0.56 0.58 0.60 0.62 0.60 0.69 0.58 0.64 -5 0.65 0.60 0.58 0.64 0.00 0.62 0.67 0.64 0.63 0.60 0.68 0.69 0.78 0.64 0.61 -6 0.61 0.61 0.65 0.63 0.62 0.00 0.61 0.62 0.63 0.66 0.60 0.60 0.70 0.63 0.69 - 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 -1 0.59 0.66 0.70 0.60 0.65 0.60 0.61 0.67 0.58 0.64 0.63 0.66 0.62 0.61 0.61 -2 0.58 0.56 0.68 0.58 0.59 0.56 0.61 0.66 0.58 0.63 0.63 0.64 0.63 0.58 0.64 -3 0.59 0.63 0.73 0.64 0.61 0.63 0.60 0.72 0.61 0.69 0.68 0.64 0.60 0.59 0.64 -4 0.58 0.65 0.70 0.63 0.57 0.64 0.62 0.70 0.60 0.64 0.67 0.65 0.65 0.61 0.62 -5 0.61 0.75 0.77 0.71 0.61 0.64 0.71 0.72 0.66 0.67 0.71 0.73 0.68 0.71 0.73 -6 0.62 0.67 0.69 0.64 0.70 0.70 0.61 0.70 0.59 0.74 0.72 0.71 0.67 0.64 0.71 - 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 -1 0.65 0.69 0.68 0.70 0.73 0.64 0.65 0.68 0.65 0.68 0.66 0.64 0.66 0.64 0.65 -2 0.62 0.63 0.63 0.63 0.74 0.59 0.65 0.62 0.65 0.66 0.60 0.60 0.69 0.64 0.70 -3 0.62 0.64 0.64 0.70 0.77 0.58 0.63 0.63 0.67 0.71 0.69 0.62 0.70 0.63 0.67 -4 0.66 0.66 0.65 0.70 0.76 0.68 0.64 0.64 0.67 0.72 0.65 0.63 0.71 0.65 0.69 -5 0.67 0.74 0.72 0.77 0.81 0.66 0.65 0.74 0.74 0.78 0.68 0.63 0.69 0.67 0.67 -6 0.70 0.69 0.68 0.71 0.80 0.70 0.68 0.70 0.72 0.73 0.73 0.71 0.72 0.68 0.73 - 46 47 48 49 50 -1 0.70 0.68 0.68 0.66 0.67 -2 0.66 0.61 0.70 0.70 0.65 -3 0.75 0.71 0.73 0.72 0.68 -4 0.72 0.67 0.68 0.73 0.68 -5 0.81 0.71 0.71 0.69 0.66 -6 0.75 0.71 0.74 0.76 0.73 -> # Run example to illustrate low variance of mean, median, and stdev results -> # Mean and median std dev are around 0.05 -> sdd <- avgdist(BCI, sample = 50, iterations = 100, meanfun = sd) -> summary(mean.avg.dist) - Min. 1st Qu. Median Mean 3rd Qu. Max. - 0.490 0.612 0.648 0.651 0.686 0.856 -> summary(median.avg.dist) - Min. 1st Qu. Median Mean 3rd Qu. Max. - 0.470 0.620 0.650 0.652 0.690 0.840 -> summary(sdd) - Min. 1st Qu. Median Mean 3rd Qu. Max. -0.04431 0.05657 0.05973 0.05978 0.06300 0.07492 -> # Test for when subsampling depth excludes some samples -> # Return samples that are removed for not meeting depth filter -> depth.avg.dist <- avgdist(BCI, sample = 450, iterations = 10) -Warning in avgdist(BCI, sample = 450, iterations = 10) : - The following sampling units were removed because they were below sampling depth: 1, 2, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 33, 34, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 -> # Print the result -> depth.avg.dist - 3 4 5 10 15 30 32 -3 0.0000000 0.3255556 0.3648889 0.2928889 0.3540000 0.4600000 0.4742222 -4 0.3255556 0.0000000 0.3760000 0.3208889 0.3471111 0.3944444 0.4328889 -5 0.3648889 0.3760000 0.0000000 0.3864444 0.3993333 0.4982222 0.5224444 -10 0.2928889 0.3208889 0.3864444 0.0000000 0.3126667 0.4315556 0.4193333 -15 0.3540000 0.3471111 0.3993333 0.3126667 0.0000000 0.4555556 0.4642222 -30 0.4600000 0.3944444 0.4982222 0.4315556 0.4555556 0.0000000 0.3820000 -32 0.4742222 0.4328889 0.5224444 0.4193333 0.4642222 0.3820000 0.0000000 -35 0.6671111 0.6366667 0.6984444 0.6891111 0.6628889 0.5244444 0.5973333 -40 0.5628889 0.5324444 0.6371111 0.5222222 0.5586667 0.4522222 0.4042222 - 35 40 -3 0.6671111 0.5628889 -4 0.6366667 0.5324444 -5 0.6984444 0.6371111 -10 0.6891111 0.5222222 -15 0.6628889 0.5586667 -30 0.5244444 0.4522222 -32 0.5973333 0.4042222 -35 0.0000000 0.4348889 -40 0.4348889 0.0000000 -> -> -> -> cleanEx() -> nameEx("beals") -> ### * beals -> -> flush(stderr()); flush(stdout()) -> -> ### Name: beals -> ### Title: Beals Smoothing and Degree of Absence -> ### Aliases: beals swan -> ### Keywords: manip smooth -> -> ### ** Examples -> -> data(dune) -> ## Default -> x <- beals(dune) -> ## Remove target species -> x <- beals(dune, include = FALSE) -> ## Smoothed values against presence or absence of species -> pa <- decostand(dune, "pa") -> boxplot(as.vector(x) ~ unlist(pa), xlab="Presence", ylab="Beals") -> ## Remove the bias of tarbet species: Yields lower values. -> beals(dune, type =3, include = FALSE) - Achimill Agrostol Airaprae Alopgeni Anthodor Bellpere Bromhord -1 0.49590853 0.38333415 0.01157407 0.4923280 0.30827883 0.4935662 0.43263047 -2 0.47083676 0.39501120 0.03361524 0.4718807 0.34723984 0.4917791 0.42000984 -3 0.34063019 0.52738394 0.01520046 0.5309152 0.21609954 0.4033301 0.33010938 -4 0.30816435 0.51198853 0.02876960 0.5971801 0.21542662 0.4398775 0.35732610 -5 0.59949785 0.27622698 0.06632771 0.3349203 0.48876285 0.4322142 0.44309579 -6 0.58819821 0.26299306 0.05967771 0.2700508 0.53154426 0.3696613 0.39760652 -7 0.56496165 0.29412293 0.05329633 0.3403047 0.48010987 0.4051777 0.40471531 -8 0.21230502 0.66906674 0.02588333 0.5187956 0.16247716 0.2720122 0.21219877 -9 0.30323659 0.59744543 0.02213662 0.5792855 0.21896113 0.3292320 0.28613526 -10 0.54083871 0.26902092 0.07349127 0.3372958 0.42671693 0.4705094 0.42934344 -11 0.40509331 0.31656550 0.10259239 0.3185489 0.38766111 0.3713794 0.31413659 -12 0.21008725 0.66278454 0.03625297 0.5753377 0.20078932 0.2802946 0.22974415 -13 0.21850759 0.68239707 0.02191119 0.6404427 0.16737280 0.2939740 0.24942466 -14 0.13570397 0.76284476 0.02298398 0.4107645 0.12128973 0.1682755 0.13757552 -15 0.09168815 0.79412733 0.02538032 0.4505613 0.10117099 0.1420251 0.09794548 -16 0.06335463 0.87877202 0.00742115 0.5232448 0.05538377 0.1516354 0.09458531 -17 0.55254140 0.07330247 0.29233391 0.1013889 0.69331132 0.3129358 0.34982363 -18 0.37751017 0.34451209 0.08535723 0.2838834 0.36918166 0.3676424 0.30478244 -19 0.29826049 0.25952255 0.35137675 0.1934048 0.51929869 0.2237843 0.18074796 -20 0.05429986 0.76675441 0.06144615 0.4063662 0.10738280 0.1450721 0.06706410 - Chenalbu Cirsarve Comapalu Eleopalu Elymrepe Empenigr -1 0.025132275 0.09504980 0.000000000 0.05592045 0.4667439 0.00000000 -2 0.043866562 0.08570299 0.026548839 0.08656209 0.4407282 0.01829337 -3 0.065338638 0.08967477 0.031898812 0.16099072 0.4137888 0.01074444 -4 0.057970906 0.12920228 0.039859621 0.16112450 0.4399661 0.02527165 -5 0.026434737 0.05520104 0.015892090 0.05419613 0.3575948 0.03029752 -6 0.021256367 0.03223112 0.030347896 0.08784329 0.3138879 0.03093489 -7 0.038467708 0.04706743 0.017083997 0.06694311 0.3586644 0.02304603 -8 0.063278453 0.06688407 0.100703044 0.29777644 0.3046956 0.02102222 -9 0.069879277 0.07647268 0.045830682 0.19018562 0.3523460 0.01838883 -10 0.025686639 0.06037513 0.029746617 0.07787078 0.3736128 0.03425596 -11 0.021234732 0.05778318 0.035740922 0.11146095 0.2884798 0.07310076 -12 0.103543341 0.07799259 0.045375827 0.19518888 0.3354080 0.03413656 -13 0.122547745 0.07905124 0.056084315 0.22437598 0.3511708 0.01840390 -14 0.042990591 0.03618335 0.241811837 0.55982776 0.1428372 0.01989756 -15 0.035609053 0.04022968 0.198176675 0.53973883 0.1462975 0.02215971 -16 0.056246994 0.05184498 0.201352298 0.51523810 0.1832397 0.00742115 -17 0.007716049 0.01049383 0.009876543 0.02777778 0.1929470 0.21968254 -18 0.014640428 0.04454602 0.042890320 0.17341352 0.2651538 0.06763669 -19 0.019591245 0.03668466 0.031845637 0.12592768 0.1422725 0.26011417 -20 0.037623741 0.03453783 0.185726965 0.58476297 0.1168700 0.05905666 - Hyporadi Juncarti Juncbufo Lolipere Planlanc Poaprat Poatriv -1 0.07702746 0.14794933 0.1987270 0.9226190 0.40103107 0.9863946 0.8826329 -2 0.07454127 0.13017869 0.2070478 0.8272395 0.40700777 0.8972046 0.8288385 -3 0.05562332 0.22291082 0.2544828 0.7205525 0.27933493 0.8083020 0.8383185 -4 0.06985986 0.21320122 0.2318440 0.7197924 0.25797285 0.7940926 0.8197302 -5 0.10245961 0.10406655 0.2164230 0.8380779 0.52628928 0.9035899 0.8094632 -6 0.11463153 0.11631772 0.2166255 0.8000021 0.58765018 0.8666677 0.7782619 -7 0.10837376 0.11293676 0.2110045 0.8053380 0.51905808 0.8925059 0.8018775 -8 0.06550319 0.33219882 0.2323566 0.5403355 0.20596764 0.6160461 0.7101299 -9 0.05343787 0.23134366 0.2675624 0.6874068 0.25274756 0.7523318 0.8247374 -10 0.13692492 0.09080902 0.1678040 0.8102783 0.52588347 0.8915882 0.7543592 -11 0.18108995 0.13478872 0.1656396 0.7180948 0.47012501 0.8062720 0.6404351 -12 0.06777311 0.27306206 0.3231724 0.5875943 0.22110550 0.6932541 0.8199960 -13 0.04250245 0.28204736 0.3339728 0.5714581 0.18153869 0.7063028 0.7993754 -14 0.04665747 0.46685537 0.1206518 0.3356311 0.14342002 0.3817081 0.5090703 -15 0.05040404 0.51561767 0.1370235 0.3689922 0.13523214 0.4078219 0.5263520 -16 0.01731602 0.54304667 0.1776781 0.3561752 0.07269979 0.4124222 0.6071083 -17 0.36492870 0.03333333 0.1038156 0.5858415 0.59641331 0.7434618 0.5036834 -18 0.17491099 0.18956922 0.1376386 0.7124388 0.45087176 0.7368632 0.5859071 -19 0.39145281 0.13543701 0.1127832 0.4289185 0.40784415 0.5548077 0.3605827 -20 0.07795311 0.53056145 0.1192488 0.3262685 0.13059496 0.3662817 0.4523029 - Ranuflam Rumeacet Sagiproc Salirepe Scorautu Trifprat Trifrepe -1 0.08105273 0.3160963 0.3371121 0.02729885 0.8898317 0.21701279 0.8782576 -2 0.13042865 0.3031318 0.3302063 0.05983781 0.9349640 0.20673650 0.9125666 -3 0.22632936 0.2909068 0.4204104 0.06065155 0.9036443 0.14654749 0.8817430 -4 0.21909541 0.2610006 0.4191908 0.07579199 0.9204237 0.12896524 0.8943213 -5 0.08063087 0.3979230 0.2612828 0.07589611 0.9576838 0.34808957 0.9142360 -6 0.10909966 0.4330705 0.2539380 0.08921540 0.9590466 0.35423465 0.9110822 -7 0.10541081 0.4113622 0.2954682 0.07094548 0.9550487 0.32489503 0.9171688 -8 0.40134447 0.2331043 0.4009544 0.11569906 0.8755515 0.09897600 0.8002526 -9 0.26006489 0.3464870 0.4531178 0.07351827 0.9145996 0.16269563 0.8714833 -10 0.10355742 0.3226025 0.2732735 0.09037489 0.9568824 0.26807372 0.9003730 -11 0.13269569 0.2753878 0.3673397 0.16465286 0.9442707 0.19982976 0.8979262 -12 0.29873222 0.3507140 0.5122033 0.08041977 0.9377963 0.13849854 0.9079979 -13 0.33309468 0.3107471 0.5131337 0.06572594 0.9255312 0.11199114 0.8841739 -14 0.64674225 0.1241545 0.2528665 0.15917563 0.8477706 0.06176123 0.6485949 -15 0.64449081 0.1459458 0.3151199 0.17750323 0.8430677 0.05831084 0.7170446 -16 0.66893881 0.1508409 0.3480368 0.15783292 0.8131968 0.03916718 0.6776273 -17 0.03549383 0.2913631 0.3292030 0.25651777 0.9839744 0.27593101 0.8141660 -18 0.18805395 0.2668100 0.3154533 0.17191937 0.9554011 0.20461193 0.8600701 -19 0.14551892 0.1831168 0.4798245 0.36429493 0.9902041 0.11966159 0.8147968 -20 0.62796060 0.1098600 0.3105433 0.21674174 0.8457313 0.03708580 0.6350394 - Vicilath Bracruta Callcusp -1 0.17244420 0.7476589 0.003527337 -2 0.18494940 0.7415172 0.034597921 -3 0.12833142 0.7666969 0.075789630 -4 0.12550967 0.7919786 0.081110164 -5 0.16693075 0.8079786 0.023129027 -6 0.18035860 0.8387650 0.040981168 -7 0.19027523 0.8089116 0.024070054 -8 0.10213052 0.8109194 0.201958942 -9 0.08630413 0.7972178 0.092982775 -10 0.23383453 0.7660374 0.033527777 -11 0.24317802 0.8182692 0.043950322 -12 0.08049055 0.8061715 0.100954127 -13 0.06604026 0.7465509 0.122856392 -14 0.07857237 0.7238162 0.347514804 -15 0.07370069 0.7997141 0.381379395 -16 0.03353260 0.8029953 0.364128496 -17 0.20728700 0.7635487 0.009876543 -18 0.26222869 0.8397471 0.109959916 -19 0.18188455 0.8161275 0.082361157 -20 0.09111967 0.8397124 0.397924041 -> ## Uses abundance information. -> ## Vector with beals smoothing values corresponding to the first species -> ## in dune. -> beals(dune, species=1, include=TRUE) - 1 2 3 4 5 6 7 8 -0.5923077 0.5032372 0.3499038 0.3306953 0.5944041 0.5928780 0.5824352 0.2082532 - 9 10 11 12 13 14 15 16 -0.2960799 0.5462492 0.3659392 0.2610043 0.1982372 0.0922619 0.1140625 0.1066506 - 17 18 19 20 -0.6020408 0.3844577 0.2865741 0.0750000 -> -> -> -> cleanEx() -> nameEx("betadisper") -> ### * betadisper -> -> flush(stderr()); flush(stdout()) -> -> ### Name: betadisper -> ### Title: Multivariate homogeneity of groups dispersions (variances) -> ### Aliases: betadisper scores.betadisper anova.betadisper plot.betadisper -> ### boxplot.betadisper TukeyHSD.betadisper eigenvals.betadisper -> ### print.betadisper ordimedian -> ### Keywords: methods multivariate hplot -> -> ### ** Examples -> -> data(varespec) -> -> ## Bray-Curtis distances between samples -> dis <- vegdist(varespec) -> -> ## First 16 sites grazed, remaining 8 sites ungrazed -> groups <- factor(c(rep(1,16), rep(2,8)), labels = c("grazed","ungrazed")) -> -> ## Calculate multivariate dispersions -> mod <- betadisper(dis, groups) -> mod - - Homogeneity of multivariate dispersions - -Call: betadisper(d = dis, group = groups) - -No. of Positive Eigenvalues: 15 -No. of Negative Eigenvalues: 8 - -Average distance to median: - grazed ungrazed - 0.3926 0.2706 - -Eigenvalues for PCoA axes: -(Showing 8 of 23 eigenvalues) - PCoA1 PCoA2 PCoA3 PCoA4 PCoA5 PCoA6 PCoA7 PCoA8 -1.7552 1.1334 0.4429 0.3698 0.2454 0.1961 0.1751 0.1284 -> -> ## Perform test -> anova(mod) -Analysis of Variance Table - -Response: Distances - Df Sum Sq Mean Sq F value Pr(>F) -Groups 1 0.07931 0.079306 4.6156 0.04295 * -Residuals 22 0.37801 0.017182 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> ## Permutation test for F -> permutest(mod, pairwise = TRUE, permutations = 99) - -Permutation test for homogeneity of multivariate dispersions -Permutation: free -Number of permutations: 99 - -Response: Distances - Df Sum Sq Mean Sq F N.Perm Pr(>F) -Groups 1 0.07931 0.079306 4.6156 99 0.03 * -Residuals 22 0.37801 0.017182 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Pairwise comparisons: -(Observed p-value below diagonal, permuted p-value above diagonal) - grazed ungrazed -grazed 0.06 -ungrazed 0.04295 -> -> ## Tukey's Honest Significant Differences -> (mod.HSD <- TukeyHSD(mod)) - Tukey multiple comparisons of means - 95% family-wise confidence level - -Fit: aov(formula = distances ~ group, data = df) - -$group - diff lwr upr p adj -ungrazed-grazed -0.1219422 -0.2396552 -0.004229243 0.0429502 - -> plot(mod.HSD) -> -> ## Plot the groups and distances to centroids on the -> ## first two PCoA axes -> plot(mod) -> -> ## with data ellipses instead of hulls -> plot(mod, ellipse = TRUE, hull = FALSE) # 1 sd data ellipse -> plot(mod, ellipse = TRUE, hull = FALSE, conf = 0.90) # 90% data ellipse -> -> # plot with manual colour specification -> my_cols <- c("#1b9e77", "#7570b3") -> plot(mod, col = my_cols, pch = c(16,17), cex = 1.1) -> -> ## can also specify which axes to plot, ordering respected -> plot(mod, axes = c(3,1), seg.col = "forestgreen", seg.lty = "dashed") -> -> ## Draw a boxplot of the distances to centroid for each group -> boxplot(mod) -> -> ## `scores` and `eigenvals` also work -> scrs <- scores(mod) -> str(scrs) -List of 2 - $ sites : num [1:24, 1:2] 0.0946 -0.3125 -0.3511 -0.3291 -0.1926 ... - ..- attr(*, "dimnames")=List of 2 - .. ..$ : chr [1:24] "18" "15" "24" "27" ... - .. ..$ : chr [1:2] "PCoA1" "PCoA2" - $ centroids: num [1:2, 1:2] -0.1455 0.2786 0.0758 -0.2111 - ..- attr(*, "dimnames")=List of 2 - .. ..$ : chr [1:2] "grazed" "ungrazed" - .. ..$ : chr [1:2] "PCoA1" "PCoA2" -> head(scores(mod, 1:4, display = "sites")) - PCoA1 PCoA2 PCoA3 PCoA4 -18 0.09459373 0.15914576 0.074400844 -0.202466025 -15 -0.31248809 0.10032751 -0.062243360 0.110844864 -24 -0.35106507 -0.05954096 -0.038079447 0.095060928 -27 -0.32914546 -0.17019348 0.231623720 0.019110623 -23 -0.19259443 -0.01459250 -0.005679372 -0.209718312 -19 -0.06794575 -0.14501690 -0.085645653 0.002431355 -> # group centroids/medians -> scores(mod, 1:4, display = "centroids") - PCoA1 PCoA2 PCoA3 PCoA4 -grazed -0.1455200 0.07584572 -0.01366220 -0.0178990 -ungrazed 0.2786095 -0.21114993 -0.03475586 0.0220129 -> # eigenvalues from the underlying principal coordinates analysis -> eigenvals(mod) - PCoA1 PCoA2 PCoA3 PCoA4 PCoA5 PCoA6 PCoA7 - 1.7552165 1.1334455 0.4429018 0.3698054 0.2453532 0.1960921 0.1751131 - PCoA8 PCoA9 PCoA10 PCoA11 PCoA12 PCoA13 PCoA14 - 0.1284467 0.0971594 0.0759601 0.0637178 0.0583225 0.0394934 0.0172699 - PCoA15 PCoA16 PCoA17 PCoA18 PCoA19 PCoA20 PCoA21 - 0.0051011 -0.0004131 -0.0064654 -0.0133147 -0.0253944 -0.0375105 -0.0480069 - PCoA22 PCoA23 --0.0537146 -0.0741390 -> -> ## try out bias correction; compare with mod3 -> (mod3B <- betadisper(dis, groups, type = "median", bias.adjust=TRUE)) - - Homogeneity of multivariate dispersions - -Call: betadisper(d = dis, group = groups, type = "median", bias.adjust -= TRUE) - -No. of Positive Eigenvalues: 15 -No. of Negative Eigenvalues: 8 - -Average distance to median: - grazed ungrazed - 0.4055 0.2893 - -Eigenvalues for PCoA axes: -(Showing 8 of 23 eigenvalues) - PCoA1 PCoA2 PCoA3 PCoA4 PCoA5 PCoA6 PCoA7 PCoA8 -1.7552 1.1334 0.4429 0.3698 0.2454 0.1961 0.1751 0.1284 -> anova(mod3B) -Analysis of Variance Table - -Response: Distances - Df Sum Sq Mean Sq F value Pr(>F) -Groups 1 0.07193 0.071927 3.7826 0.06468 . -Residuals 22 0.41834 0.019015 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> permutest(mod3B, permutations = 99) - -Permutation test for homogeneity of multivariate dispersions -Permutation: free -Number of permutations: 99 - -Response: Distances - Df Sum Sq Mean Sq F N.Perm Pr(>F) -Groups 1 0.07193 0.071927 3.7826 99 0.08 . -Residuals 22 0.41834 0.019015 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> ## should always work for a single group -> group <- factor(rep("grazed", NROW(varespec))) -> (tmp <- betadisper(dis, group, type = "median")) - - Homogeneity of multivariate dispersions - -Call: betadisper(d = dis, group = group, type = "median") - -No. of Positive Eigenvalues: 15 -No. of Negative Eigenvalues: 8 - -Average distance to median: -grazed -0.4255 - -Eigenvalues for PCoA axes: -(Showing 8 of 23 eigenvalues) - PCoA1 PCoA2 PCoA3 PCoA4 PCoA5 PCoA6 PCoA7 PCoA8 -1.7552 1.1334 0.4429 0.3698 0.2454 0.1961 0.1751 0.1284 -> (tmp <- betadisper(dis, group, type = "centroid")) - - Homogeneity of multivariate dispersions - -Call: betadisper(d = dis, group = group, type = "centroid") - -No. of Positive Eigenvalues: 15 -No. of Negative Eigenvalues: 8 - -Average distance to centroid: -grazed -0.4261 - -Eigenvalues for PCoA axes: -(Showing 8 of 23 eigenvalues) - PCoA1 PCoA2 PCoA3 PCoA4 PCoA5 PCoA6 PCoA7 PCoA8 -1.7552 1.1334 0.4429 0.3698 0.2454 0.1961 0.1751 0.1284 -> -> ## simulate missing values in 'd' and 'group' -> ## using spatial medians -> groups[c(2,20)] <- NA -> dis[c(2, 20)] <- NA -> mod2 <- betadisper(dis, groups) ## messages -missing observations due to 'group' removed -missing observations due to 'd' removed -> mod2 - - Homogeneity of multivariate dispersions - -Call: betadisper(d = dis, group = groups) - -No. of Positive Eigenvalues: 14 -No. of Negative Eigenvalues: 5 - -Average distance to median: - grazed ungrazed - 0.3984 0.3008 - -Eigenvalues for PCoA axes: -(Showing 8 of 19 eigenvalues) - PCoA1 PCoA2 PCoA3 PCoA4 PCoA5 PCoA6 PCoA7 PCoA8 -1.4755 0.8245 0.4218 0.3456 0.2159 0.1688 0.1150 0.1060 -> permutest(mod2, permutations = 99) - -Permutation test for homogeneity of multivariate dispersions -Permutation: free -Number of permutations: 99 - -Response: Distances - Df Sum Sq Mean Sq F N.Perm Pr(>F) -Groups 1 0.039979 0.039979 2.4237 99 0.14 -Residuals 18 0.296910 0.016495 -> anova(mod2) -Analysis of Variance Table - -Response: Distances - Df Sum Sq Mean Sq F value Pr(>F) -Groups 1 0.039979 0.039979 2.4237 0.1369 -Residuals 18 0.296910 0.016495 -> plot(mod2) -> boxplot(mod2) -> plot(TukeyHSD(mod2)) -> -> ## Using group centroids -> mod3 <- betadisper(dis, groups, type = "centroid") -missing observations due to 'group' removed -missing observations due to 'd' removed -> mod3 - - Homogeneity of multivariate dispersions - -Call: betadisper(d = dis, group = groups, type = "centroid") - -No. of Positive Eigenvalues: 14 -No. of Negative Eigenvalues: 5 - -Average distance to centroid: - grazed ungrazed - 0.4001 0.3108 - -Eigenvalues for PCoA axes: -(Showing 8 of 19 eigenvalues) - PCoA1 PCoA2 PCoA3 PCoA4 PCoA5 PCoA6 PCoA7 PCoA8 -1.4755 0.8245 0.4218 0.3456 0.2159 0.1688 0.1150 0.1060 -> permutest(mod3, permutations = 99) - -Permutation test for homogeneity of multivariate dispersions -Permutation: free -Number of permutations: 99 - -Response: Distances - Df Sum Sq Mean Sq F N.Perm Pr(>F) -Groups 1 0.033468 0.033468 3.1749 99 0.08 . -Residuals 18 0.189749 0.010542 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> anova(mod3) -Analysis of Variance Table - -Response: Distances - Df Sum Sq Mean Sq F value Pr(>F) -Groups 1 0.033468 0.033468 3.1749 0.09166 . -Residuals 18 0.189749 0.010542 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> plot(mod3) -> boxplot(mod3) -> plot(TukeyHSD(mod3)) -> -> -> -> -> cleanEx() -> nameEx("betadiver") -> ### * betadiver -> -> flush(stderr()); flush(stdout()) -> -> ### Name: betadiver -> ### Title: Indices of beta Diversity -> ### Aliases: betadiver scores.betadiver plot.betadiver -> ### Keywords: multivariate -> -> ### ** Examples -> -> ## Raw data and plotting -> data(sipoo) -> m <- betadiver(sipoo) -> plot(m) -> ## The indices -> betadiver(help=TRUE) -1 "w" = (b+c)/(2*a+b+c) -2 "-1" = (b+c)/(2*a+b+c) -3 "c" = (b+c)/2 -4 "wb" = b+c -5 "r" = 2*b*c/((a+b+c)^2-2*b*c) -6 "I" = log(2*a+b+c) - 2*a*log(2)/(2*a+b+c) - ((a+b)*log(a+b) + -(a+c)*log(a+c)) / (2*a+b+c) -7 "e" = exp(log(2*a+b+c) - 2*a*log(2)/(2*a+b+c) - ((a+b)*log(a+b) + -(a+c)*log(a+c)) / (2*a+b+c))-1 -8 "t" = (b+c)/(2*a+b+c) -9 "me" = (b+c)/(2*a+b+c) -10 "j" = a/(a+b+c) -11 "sor" = 2*a/(2*a+b+c) -12 "m" = (2*a+b+c)*(b+c)/(a+b+c) -13 "-2" = pmin(b,c)/(pmax(b,c)+a) -14 "co" = (a*c+a*b+2*b*c)/(2*(a+b)*(a+c)) -15 "cc" = (b+c)/(a+b+c) -16 "g" = (b+c)/(a+b+c) -17 "-3" = pmin(b,c)/(a+b+c) -18 "l" = (b+c)/2 -19 "19" = 2*(b*c+1)/(a+b+c)/(a+b+c-1) -20 "hk" = (b+c)/(2*a+b+c) -21 "rlb" = a/(a+c) -22 "sim" = pmin(b,c)/(pmin(b,c)+a) -23 "gl" = 2*abs(b-c)/(2*a+b+c) -24 "z" = (log(2)-log(2*a+b+c)+log(a+b+c))/log(2) -> ## The basic Whittaker index -> d <- betadiver(sipoo, "w") -> ## This should be equal to Sorensen index (binary Bray-Curtis in -> ## vegan) -> range(d - vegdist(sipoo, binary=TRUE)) -[1] 0 0 -> -> -> -> cleanEx() -> nameEx("bgdispersal") -> ### * bgdispersal -> -> flush(stderr()); flush(stdout()) -> -> ### Name: bgdispersal -> ### Title: Coefficients of Biogeographical Dispersal Direction -> ### Aliases: bgdispersal -> ### Keywords: multivariate nonparametric -> -> ### ** Examples -> -> mat <- matrix(c(32,15,14,10,70,30,100,4,10,30,25,0,18,0,40, -+ 0,0,20,0,0,0,0,4,0,30,20,0,0,0,0,25,74,42,1,45,89,5,16,16,20), -+ 4, 10, byrow=TRUE) -> bgdispersal(mat) -$DD1 - [,1] [,2] [,3] [,4] -[1,] 0.00 0.24 0.21 0.00 -[2,] -0.24 0.00 0.08 -0.24 -[3,] -0.21 -0.08 0.00 -0.21 -[4,] 0.00 0.24 0.21 0.00 - -$DD2 - [,1] [,2] [,3] [,4] -[1,] 0.0000000 0.3428571 0.3230769 0.0000000 -[2,] -0.3428571 0.0000000 0.1142857 -0.3428571 -[3,] -0.3230769 -0.1142857 0.0000000 -0.3230769 -[4,] 0.0000000 0.3428571 0.3230769 0.0000000 - -$DD3 - [,1] [,2] [,3] [,4] -[1,] 0.00000000 0.1567922 0.1420408 -0.01325831 -[2,] -0.15679216 0.0000000 0.1101196 -0.20049485 -[3,] -0.14204082 -0.1101196 0.0000000 -0.13586560 -[4,] 0.01325831 0.2004949 0.1358656 0.00000000 - -$DD4 - [,1] [,2] [,3] [,4] -[1,] 0.00000000 0.2513176 0.2425087 -0.01960102 -[2,] -0.25131757 0.0000000 0.1725441 -0.30993929 -[3,] -0.24250871 -0.1725441 0.0000000 -0.23381521 -[4,] 0.01960102 0.3099393 0.2338152 0.00000000 - -$McNemar - [,1] [,2] [,3] [,4] -[1,] NA 7.677938 9.0571232 0.000000 -[2,] NA NA 0.2912555 7.677938 -[3,] NA NA NA 9.057123 -[4,] NA NA NA NA - -$prob.McNemar - [,1] [,2] [,3] [,4] -[1,] NA 0.005590001 0.002616734 1.000000000 -[2,] NA NA 0.589417103 0.005590001 -[3,] NA NA NA 0.002616734 -[4,] NA NA NA NA - -> -> -> -> cleanEx() -> nameEx("bioenv") -> ### * bioenv -> -> flush(stderr()); flush(stdout()) -> -> ### Name: bioenv -> ### Title: Best Subset of Environmental Variables with Maximum (Rank) -> ### Correlation with Community Dissimilarities -> ### Aliases: bioenv bioenv.default bioenv.formula summary.bioenv bioenvdist -> ### Keywords: multivariate -> -> ### ** Examples -> -> # The method is very slow for large number of possible subsets. -> # Therefore only 6 variables in this example. -> data(varespec) -> data(varechem) -> sol <- bioenv(wisconsin(varespec) ~ log(N) + P + K + Ca + pH + Al, varechem) -> sol - -Call: -bioenv(formula = wisconsin(varespec) ~ log(N) + P + K + Ca + pH + Al, data = varechem) - -Subset of environmental variables with best correlation to community data. - -Correlations: spearman -Dissimilarities: bray -Metric: euclidean - -Best model has 3 parameters (max. 6 allowed): -P Ca Al -with correlation 0.4004806 - -> ## IGNORE_RDIFF_BEGIN -> summary(sol) - size correlation -P 1 0.2516 -P Al 2 0.4004 -P Ca Al 3 0.4005 -P Ca pH Al 4 0.3619 -log(N) P Ca pH Al 5 0.3216 -log(N) P K Ca pH Al 6 0.2822 -> ## IGNORE_RDIFF_END -> -> -> -> cleanEx() -> nameEx("biplot.rda") -> ### * biplot.rda -> -> flush(stderr()); flush(stdout()) -> -> ### Name: biplot.rda -> ### Title: PCA biplot -> ### Aliases: biplot.rda biplot.cca -> ### Keywords: hplot -> -> ### ** Examples -> -> data(dune) -> mod <- rda(dune, scale = TRUE) -> biplot(mod, scaling = "symmetric") -> -> ## different type for species and site scores -> biplot(mod, scaling = "symmetric", type = c("text", "points")) -> -> ## We can use ordiplot pipes in R 4.1 to build similar plots with -> ## flexible control -> ## Not run: -> ##D if (getRversion() >= "4.1") { -> ##D plot(mod, scaling = "symmetric", type="n") |> -> ##D text("sites", cex=0.8) |> -> ##D text("species", arrows=TRUE, length=0.02, col="red", cex=0.6) -> ##D } -> ## End(Not run) -> -> -> -> cleanEx() -> nameEx("capscale") -> ### * capscale -> -> flush(stderr()); flush(stdout()) -> -> ### Name: capscale -> ### Title: [Partial] Distance-based Redundancy Analysis -> ### Aliases: capscale dbrda -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(varespec) -> data(varechem) -> ## Basic Analysis -> vare.cap <- capscale(varespec ~ N + P + K + Condition(Al), varechem, -+ dist="bray") -> vare.cap -Call: capscale(formula = varespec ~ N + P + K + Condition(Al), data = -varechem, distance = "bray") - - Inertia Proportion Rank -Total 4.54444 1.00000 -Conditional 0.97719 0.21503 1 -Constrained 0.99717 0.21943 3 -Unconstrained 2.82904 0.62253 15 -Imaginary -0.25896 -0.05698 8 -Inertia is squared Bray distance -Species scores projected from ‘varespec’ - -Eigenvalues for constrained axes: - CAP1 CAP2 CAP3 -0.5413 0.3265 0.1293 - -Eigenvalues for unconstrained axes: - MDS1 MDS2 MDS3 MDS4 MDS5 MDS6 MDS7 MDS8 MDS9 MDS10 MDS11 -0.9065 0.5127 0.3379 0.2626 0.2032 0.1618 0.1242 0.0856 0.0689 0.0583 0.0501 - MDS12 MDS13 MDS14 MDS15 -0.0277 0.0208 0.0073 0.0013 - -> plot(vare.cap) -> anova(vare.cap) -Permutation test for capscale under reduced model -Permutation: free -Number of permutations: 999 - -Model: capscale(formula = varespec ~ N + P + K + Condition(Al), data = varechem, distance = "bray") - Df SumOfSqs F Pr(>F) -Model 3 0.99717 2.2324 0.004 ** -Residual 19 2.82904 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## Avoid negative eigenvalues with additive constant -> capscale(varespec ~ N + P + K + Condition(Al), varechem, -+ dist="bray", add =TRUE) -Call: capscale(formula = varespec ~ N + P + K + Condition(Al), data = -varechem, distance = "bray", add = TRUE) - - Inertia Proportion Rank -Total 6.2496 1.0000 -Conditional 1.0468 0.1675 1 -Constrained 1.1956 0.1913 3 -Unconstrained 4.0073 0.6412 19 -Inertia is Lingoes adjusted squared Bray distance -Species scores projected from ‘varespec’ - -Eigenvalues for constrained axes: - CAP1 CAP2 CAP3 -0.6103 0.3940 0.1913 - -Eigenvalues for unconstrained axes: - MDS1 MDS2 MDS3 MDS4 MDS5 MDS6 MDS7 MDS8 -0.9796 0.5811 0.4077 0.3322 0.2769 0.2346 0.1962 0.1566 -(Showing 8 of 19 unconstrained eigenvalues) - -Constant added to distances: 0.07413903 - -> ## Avoid negative eigenvalues by taking square roots of dissimilarities -> capscale(varespec ~ N + P + K + Condition(Al), varechem, -+ dist = "bray", sqrt.dist= TRUE) -Call: capscale(formula = varespec ~ N + P + K + Condition(Al), data = -varechem, distance = "bray", sqrt.dist = TRUE) - - Inertia Proportion Rank -Total 6.9500 1.0000 -Conditional 0.9535 0.1372 1 -Constrained 1.2267 0.1765 3 -Unconstrained 4.7698 0.6863 19 -Inertia is Bray distance -Species scores projected from ‘varespec’ - -Eigenvalues for constrained axes: - CAP1 CAP2 CAP3 -0.5817 0.4086 0.2365 - -Eigenvalues for unconstrained axes: - MDS1 MDS2 MDS3 MDS4 MDS5 MDS6 MDS7 MDS8 -0.9680 0.6100 0.4469 0.3837 0.3371 0.3012 0.2558 0.2010 -(Showing 8 of 19 unconstrained eigenvalues) - -> ## Principal coordinates analysis with extended dissimilarities -> capscale(varespec ~ 1, dist="bray", metaMDS = TRUE) -Square root transformation -Wisconsin double standardization -Call: capscale(formula = varespec ~ 1, distance = "bray", metaMDSdist = -TRUE) - - Inertia Rank -Total 2.54753 -Unconstrained 2.59500 19 -Imaginary -0.04747 4 -Inertia is squared Bray distance -Species scores projected from ‘varespec’ - -Eigenvalues for unconstrained axes: - MDS1 MDS2 MDS3 MDS4 MDS5 MDS6 MDS7 MDS8 -0.6075 0.3820 0.3335 0.2046 0.1731 0.1684 0.1505 0.1163 -(Showing 8 of 19 unconstrained eigenvalues) - -metaMDSdist transformed data: wisconsin(sqrt(varespec)) - -> ## dbrda -> dbrda(varespec ~ N + P + K + Condition(Al), varechem, -+ dist="bray") -Call: dbrda(formula = varespec ~ N + P + K + Condition(Al), data = -varechem, distance = "bray") - - Inertia Proportion Rank RealDims -Total 4.5444 1.0000 -Conditional 0.9726 0.2140 1 -Constrained 0.9731 0.2141 3 3 -Unconstrained 2.5987 0.5718 19 13 -Inertia is squared Bray distance - -Eigenvalues for constrained axes: -dbRDA1 dbRDA2 dbRDA3 -0.5362 0.3198 0.1171 - -Eigenvalues for unconstrained axes: - MDS1 MDS2 MDS3 MDS4 MDS5 MDS6 MDS7 MDS8 -0.9054 0.5070 0.3336 0.2581 0.2027 0.1605 0.1221 0.0825 -(Showing 8 of 19 unconstrained eigenvalues) - -> ## avoid negative eigenvalues also with Jaccard distances -> dbrda(varespec ~ N + P + K + Condition(Al), varechem, -+ dist="jaccard") -Call: dbrda(formula = varespec ~ N + P + K + Condition(Al), data = -varechem, distance = "jaccard") - - Inertia Proportion Rank -Total 6.5044 1.0000 -Conditional 1.0330 0.1588 1 -Constrained 1.2068 0.1855 3 -Unconstrained 4.2646 0.6557 19 -Inertia is squared Jaccard distance - -Eigenvalues for constrained axes: -dbRDA1 dbRDA2 dbRDA3 -0.5992 0.3994 0.2082 - -Eigenvalues for unconstrained axes: - MDS1 MDS2 MDS3 MDS4 MDS5 MDS6 MDS7 MDS8 -1.0388 0.6441 0.4518 0.3759 0.3239 0.2785 0.2279 0.1644 -(Showing 8 of 19 unconstrained eigenvalues) - -> -> -> -> cleanEx() -> nameEx("cascadeKM") -> ### * cascadeKM -> -> flush(stderr()); flush(stdout()) -> -> ### Name: cascadeKM -> ### Title: K-means partitioning using a range of values of K -> ### Aliases: cascadeKM cIndexKM plot.cascadeKM orderingKM pregraphKM -> ### Keywords: cluster -> -> ### ** Examples -> -> # Partitioning a (10 x 10) data matrix of random numbers -> mat <- matrix(runif(100),10,10) -> res <- cascadeKM(mat, 2, 5, iter = 25, criterion = 'calinski') -> toto <- plot(res) -> -> # Partitioning an autocorrelated time series -> vec <- sort(matrix(runif(30),30,1)) -> res <- cascadeKM(vec, 2, 5, iter = 25, criterion = 'calinski') -> toto <- plot(res) -> -> # Partitioning a large autocorrelated time series -> # Note that we remove the grid lines -> vec <- sort(matrix(runif(1000),1000,1)) -> res <- cascadeKM(vec, 2, 7, iter = 10, criterion = 'calinski') -> toto <- plot(res, gridcol=NA) -> -> -> -> -> cleanEx() -> nameEx("cca") -> ### * cca -> -> flush(stderr()); flush(stdout()) -> -> ### Name: cca -> ### Title: [Partial] [Constrained] Correspondence Analysis and Redundancy -> ### Analysis -> ### Aliases: cca cca.default cca.formula rda rda.default rda.formula -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(varespec) -> data(varechem) -> ## Common but bad way: use all variables you happen to have in your -> ## environmental data matrix -> vare.cca <- cca(varespec, varechem) -> vare.cca -Call: cca(X = varespec, Y = varechem) - - Inertia Proportion Rank -Total 2.0832 1.0000 -Constrained 1.4415 0.6920 14 -Unconstrained 0.6417 0.3080 9 -Inertia is scaled Chi-square - -Eigenvalues for constrained axes: - CCA1 CCA2 CCA3 CCA4 CCA5 CCA6 CCA7 CCA8 CCA9 CCA10 CCA11 -0.4389 0.2918 0.1628 0.1421 0.1180 0.0890 0.0703 0.0584 0.0311 0.0133 0.0084 - CCA12 CCA13 CCA14 -0.0065 0.0062 0.0047 - -Eigenvalues for unconstrained axes: - CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8 CA9 -0.19776 0.14193 0.10117 0.07079 0.05330 0.03330 0.01887 0.01510 0.00949 - -> plot(vare.cca) -> ## Formula interface and a better model -> vare.cca <- cca(varespec ~ Al + P*(K + Baresoil), data=varechem) -> vare.cca -Call: cca(formula = varespec ~ Al + P * (K + Baresoil), data = -varechem) - - Inertia Proportion Rank -Total 2.083 1.000 -Constrained 1.046 0.502 6 -Unconstrained 1.038 0.498 17 -Inertia is scaled Chi-square - -Eigenvalues for constrained axes: - CCA1 CCA2 CCA3 CCA4 CCA5 CCA6 -0.3756 0.2342 0.1407 0.1323 0.1068 0.0561 - -Eigenvalues for unconstrained axes: - CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8 -0.27577 0.15411 0.13536 0.11803 0.08887 0.05511 0.04919 0.03781 -(Showing 8 of 17 unconstrained eigenvalues) - -> plot(vare.cca) -> ## Partialling out and negative components of variance -> cca(varespec ~ Ca, varechem) -Call: cca(formula = varespec ~ Ca, data = varechem) - - Inertia Proportion Rank -Total 2.08320 1.00000 -Constrained 0.15722 0.07547 1 -Unconstrained 1.92598 0.92453 22 -Inertia is scaled Chi-square - -Eigenvalues for constrained axes: - CCA1 -0.15722 - -Eigenvalues for unconstrained axes: - CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8 -0.4745 0.2939 0.2140 0.1954 0.1748 0.1171 0.1121 0.0880 -(Showing 8 of 22 unconstrained eigenvalues) - -> cca(varespec ~ Ca + Condition(pH), varechem) -Call: cca(formula = varespec ~ Ca + Condition(pH), data = varechem) - - Inertia Proportion Rank -Total 2.0832 1.0000 -Conditional 0.1458 0.0700 1 -Constrained 0.1827 0.0877 1 -Unconstrained 1.7547 0.8423 21 -Inertia is scaled Chi-square - -Eigenvalues for constrained axes: - CCA1 -0.18269 - -Eigenvalues for unconstrained axes: - CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8 -0.3834 0.2749 0.2123 0.1760 0.1701 0.1161 0.1089 0.0880 -(Showing 8 of 21 unconstrained eigenvalues) - -> ## RDA -> data(dune) -> data(dune.env) -> dune.Manure <- rda(dune ~ Manure, dune.env) -> plot(dune.Manure) -> -> -> -> cleanEx() -> nameEx("clamtest") -> ### * clamtest -> -> flush(stderr()); flush(stdout()) -> -> ### Name: clamtest -> ### Title: Multinomial Species Classification Method (CLAM) -> ### Aliases: clamtest summary.clamtest plot.clamtest -> ### Keywords: htest -> -> ### ** Examples -> -> data(mite) -> data(mite.env) -> sol <- with(mite.env, clamtest(mite, Shrub=="None", alpha=0.005)) -> summary(sol) -Two Groups Species Classification Method (CLAM) - -Specialization threshold = 0.6666667 -Alpha level = 0.005 - -Estimated sample coverage: - FALSE TRUE -1.0000 0.9996 - -Minimum abundance for classification: -FALSE TRUE - 27 9 - - Species Proportion -Generalist 10 0.286 -Specialist_FALSE 14 0.400 -Specialist_TRUE 4 0.114 -Too_rare 7 0.200 -> head(sol) - Species Total_FALSE Total_TRUE Classes -1 Brachy 534 77 Generalist -2 PHTH 89 0 Specialist_FALSE -3 HPAV 389 207 Generalist -4 RARD 85 0 Specialist_FALSE -5 SSTR 22 0 Too_rare -6 Protopl 26 0 Too_rare -> plot(sol) -> -> -> -> cleanEx() -> nameEx("commsim") -> ### * commsim -> -> flush(stderr()); flush(stdout()) -> -> ### Name: commsim -> ### Title: Create an Object for Null Model Algorithms -> ### Aliases: commsim make.commsim print.commsim -> ### Keywords: multivariate datagen -> -> ### ** Examples -> -> ## write the r00 algorithm -> f <- function(x, n, ...) -+ array(replicate(n, sample(x)), c(dim(x), n)) -> (cs <- commsim("r00", fun=f, binary=TRUE, -+ isSeq=FALSE, mode="integer")) -An object of class “commsim” -‘r00’ method (binary, non-sequential, integer mode) - -> -> ## retrieving the sequential swap algorithm -> (cs <- make.commsim("swap")) -An object of class “commsim” -‘swap’ method (binary, sequential, integer mode) - -> -> ## feeding a commsim object as argument -> make.commsim(cs) -An object of class “commsim” -‘swap’ method (binary, sequential, integer mode) - -> -> ## making the missing c1 model using r1 as a template -> ## non-sequential algorithm for binary matrices -> ## that preserves the species (column) frequencies, -> ## but uses row marginal frequencies -> ## as probabilities of selecting sites -> f <- function (x, n, nr, nc, rs, cs, ...) { -+ out <- array(0L, c(nr, nc, n)) -+ J <- seq_len(nc) -+ storage.mode(rs) <- "double" -+ for (k in seq_len(n)) -+ for (j in J) -+ out[sample.int(nr, cs[j], prob = rs), j, k] <- 1L -+ out -+ } -> cs <- make.commsim("r1") -> cs$method <- "c1" -> cs$fun <- f -> -> ## structural constraints -> diagfun <- function(x, y) { -+ c(sum = sum(y) == sum(x), -+ fill = sum(y > 0) == sum(x > 0), -+ rowSums = all(rowSums(y) == rowSums(x)), -+ colSums = all(colSums(y) == colSums(x)), -+ rowFreq = all(rowSums(y > 0) == rowSums(x > 0)), -+ colFreq = all(colSums(y > 0) == colSums(x > 0))) -+ } -> evalfun <- function(meth, x, n) { -+ m <- nullmodel(x, meth) -+ y <- simulate(m, nsim=n) -+ out <- rowMeans(sapply(1:dim(y)[3], -+ function(i) diagfun(attr(y, "data"), y[,,i]))) -+ z <- as.numeric(c(attr(y, "binary"), attr(y, "isSeq"), -+ attr(y, "mode") == "double")) -+ names(z) <- c("binary", "isSeq", "double") -+ c(z, out) -+ } -> x <- matrix(rbinom(10*12, 1, 0.5)*rpois(10*12, 3), 12, 10) -> algos <- make.commsim() -> a <- t(sapply(algos, evalfun, x=x, n=10)) -> print(as.table(ifelse(a==1,1,0)), zero.print = ".") - binary isSeq double sum fill rowSums colSums rowFreq colFreq -r00 1 . . 1 1 . . . . -c0 1 . . 1 1 . 1 . 1 -r0 1 . . 1 1 1 . 1 . -r1 1 . . 1 1 1 . 1 . -r2 1 . . 1 1 1 . 1 . -quasiswap 1 . . 1 1 1 1 1 1 -greedyqswap 1 . . 1 1 1 1 1 1 -swap 1 1 . 1 1 1 1 1 1 -tswap 1 1 . 1 1 1 1 1 1 -curveball 1 1 . 1 1 1 1 1 1 -backtrack 1 . . 1 1 1 1 1 1 -r2dtable . . . 1 . 1 1 . . -swap_count . 1 . 1 1 1 1 . . -quasiswap_count . . . 1 1 1 1 . . -swsh_samp . . 1 1 1 . . 1 1 -swsh_both . . . 1 1 . . 1 1 -swsh_samp_r . . 1 1 1 1 . 1 1 -swsh_samp_c . . 1 1 1 . 1 1 1 -swsh_both_r . . . 1 1 1 . 1 1 -swsh_both_c . . . 1 1 . 1 1 1 -abuswap_r . 1 1 1 1 1 . 1 1 -abuswap_c . 1 1 1 1 . 1 1 1 -r00_samp . . 1 1 1 . . . . -c0_samp . . 1 1 1 . 1 . 1 -r0_samp . . 1 1 1 1 . 1 . -r00_ind . . . 1 . . . . . -c0_ind . . . 1 . . 1 . . -r0_ind . . . 1 . 1 . . . -r00_both . . . 1 1 . . . . -c0_both . . . 1 1 . 1 . 1 -r0_both . . . 1 1 1 . 1 . -> -> -> -> cleanEx() -> nameEx("contribdiv") -> ### * contribdiv -> -> flush(stderr()); flush(stdout()) -> -> ### Name: contribdiv -> ### Title: Contribution Diversity Approach -> ### Aliases: contribdiv plot.contribdiv -> ### Keywords: multivariate -> -> ### ** Examples -> -> ## Artificial example given in -> ## Table 2 in Lu et al. 2007 -> x <- matrix(c( -+ 1/3,1/3,1/3,0,0,0, -+ 0,0,1/3,1/3,1/3,0, -+ 0,0,0,1/3,1/3,1/3), -+ 3, 6, byrow = TRUE, -+ dimnames = list(LETTERS[1:3],letters[1:6])) -> x - a b c d e f -A 0.3333333 0.3333333 0.3333333 0.0000000 0.0000000 0.0000000 -B 0.0000000 0.0000000 0.3333333 0.3333333 0.3333333 0.0000000 -C 0.0000000 0.0000000 0.0000000 0.3333333 0.3333333 0.3333333 -> ## Compare results with Table 2 -> contribdiv(x, "richness") - alpha beta gamma -A 1 1.5 2.5 -B 1 0.5 1.5 -C 1 1.0 2.0 -> contribdiv(x, "simpson") - alpha beta gamma -A 0.6666667 0.1851852 0.8518519 -B 0.6666667 0.1111111 0.7777778 -C 0.6666667 0.1481481 0.8148148 -> ## Relative contribution (C values), compare with Table 2 -> (cd1 <- contribdiv(x, "richness", relative = TRUE, scaled = FALSE)) - alpha beta gamma -A 0 0.5 0.5 -B 0 -0.5 -0.5 -C 0 0.0 0.0 -> (cd2 <- contribdiv(x, "simpson", relative = TRUE, scaled = FALSE)) - alpha beta gamma -A 0 0.03703704 0.03703704 -B 0 -0.03703704 -0.03703704 -C 0 0.00000000 0.00000000 -> ## Differentiation coefficients -> attr(cd1, "diff.coef") # D_ST -[1] 0.5 -> attr(cd2, "diff.coef") # D_DT -[1] 0.1818182 -> ## BCI data set -> data(BCI) -> opar <- par(mfrow=c(2,2)) -> plot(contribdiv(BCI, "richness"), main = "Absolute") -> plot(contribdiv(BCI, "richness", relative = TRUE), main = "Relative") -> plot(contribdiv(BCI, "simpson")) -> plot(contribdiv(BCI, "simpson", relative = TRUE)) -> par(opar) -> -> -> -> graphics::par(get("par.postscript", pos = 'CheckExEnv')) -> cleanEx() -> nameEx("decorana") -> ### * decorana -> -> flush(stderr()); flush(stdout()) -> -> ### Name: decorana -> ### Title: Detrended Correspondence Analysis and Basic Reciprocal Averaging -> ### Aliases: decorana summary.decorana print.summary.decorana plot.decorana -> ### downweight scores.decorana points.decorana text.decorana -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(varespec) -> vare.dca <- decorana(varespec) -> vare.dca - -Call: -decorana(veg = varespec) - -Detrended correspondence analysis with 26 segments. -Rescaling of axes with 4 iterations. -Total inertia (scaled Chi-square): 2.0832 - - DCA1 DCA2 DCA3 DCA4 -Eigenvalues 0.5235 0.3253 0.20010 0.19176 -Additive Eigenvalues 0.5235 0.3217 0.17919 0.11922 -Decorana values 0.5249 0.1572 0.09669 0.06075 -Axis lengths 2.8161 2.2054 1.54650 1.64864 - -> summary(vare.dca) - -Call: -decorana(veg = varespec) - -Detrended correspondence analysis with 26 segments. -Rescaling of axes with 4 iterations. -Total inertia (scaled Chi-square): 2.0832 - - DCA1 DCA2 DCA3 DCA4 -Eigenvalues 0.5235 0.3253 0.20010 0.19176 -Additive Eigenvalues 0.5235 0.3217 0.17919 0.11922 -Decorana values 0.5249 0.1572 0.09669 0.06075 -Axis lengths 2.8161 2.2054 1.54650 1.64864 - -Species scores: - - DCA1 DCA2 DCA3 DCA4 Totals -Callvulg 0.04119 -1.53268 -2.55101 1.32277 45.07 -Empenigr 0.09019 0.82274 0.20569 0.30631 151.99 -Rhodtome 1.34533 2.47141 -0.34970 -1.13823 8.39 -Vaccmyrt 1.86298 1.71424 -0.60535 -0.40205 50.71 -Vaccviti 0.16641 0.71095 0.00313 -0.55801 275.03 -Pinusylv -0.73490 1.62050 -1.60275 -2.10199 4.11 -Descflex 1.97061 1.81651 1.74896 -0.91463 5.60 -Betupube 0.79745 3.36374 -0.94546 -1.01741 0.29 -Vacculig -0.08912 -1.17478 2.86624 0.87025 15.22 -Diphcomp -0.82669 -0.44195 2.58579 -0.38459 3.24 -Dicrsp 2.37743 -0.27373 -0.47099 -1.89036 40.50 -Dicrfusc 1.58267 -1.33770 -1.33563 1.47417 113.52 -Dicrpoly 0.86689 2.39519 -0.82064 -3.41534 6.06 -Hylosple 2.66242 1.19669 1.48288 -0.69978 18.04 -Pleuschr 1.64098 0.15607 0.30044 -0.26717 377.97 -Polypili -0.56213 0.14009 0.25198 0.49177 0.61 -Polyjuni 1.22244 -0.89173 0.61287 3.60066 13.85 -Polycomm 1.01545 2.08388 0.06402 0.84199 0.71 -Pohlnuta -0.00712 1.09704 -0.82126 -1.59862 2.62 -Ptilcili 0.48093 2.86420 -0.71801 -1.02698 14.01 -Barbhatc 0.58303 3.71792 -0.84212 -1.88837 3.19 -Cladarbu -0.18554 -1.18973 0.68113 0.55399 255.05 -Cladrang -0.83427 -0.78085 0.90603 0.70057 388.71 -Cladstel -1.67768 0.98907 -0.83789 -0.60206 486.71 -Cladunci 0.97686 -1.70859 -1.68281 -2.26756 56.28 -Cladcocc -0.27221 -0.76713 -0.63836 0.66927 2.79 -Cladcorn 0.29068 -0.97039 0.50414 0.95738 6.22 -Cladgrac 0.21778 -0.41879 0.06530 -0.31472 5.14 -Cladfimb 0.00889 -0.23922 -0.26505 0.33123 3.96 -Cladcris 0.37774 -1.09161 -0.55627 0.23868 7.47 -Cladchlo -0.91983 1.54955 -0.58109 -1.48643 1.16 -Cladbotr 0.66438 2.19584 -0.90331 -0.91391 0.47 -Cladamau -0.96418 -0.98992 2.71458 0.52352 0.14 -Cladsp -1.12318 -0.15330 -0.69833 0.44040 0.52 -Cetreric 0.27163 -1.28867 -0.81682 -1.93935 3.60 -Cetrisla -0.50158 2.22098 -1.16461 -1.89349 2.03 -Flavniva -1.67937 -3.67985 4.15644 3.18919 11.85 -Nepharct 2.18561 -0.82837 0.71958 5.81930 5.26 -Stersp -0.78699 -2.01214 2.31212 2.03946 17.52 -Peltapht 0.45763 -0.34395 0.09916 1.34695 0.76 -Icmaeric 0.04950 -1.97605 1.41509 2.10154 0.22 -Cladcerv -1.21585 -2.30519 2.55186 3.41532 0.10 -Claddefo 0.60517 -1.19771 -0.33388 0.22585 10.23 -Cladphyl -1.53959 1.48574 -1.43209 -1.52387 0.80 - -Site scores: - - DCA1 DCA2 DCA3 DCA4 Totals -18 -0.1729 -0.2841 0.4775 0.2521 89.2 -15 0.8539 -0.3360 0.0708 0.0924 89.8 -24 1.2467 -0.1183 -0.1211 -0.8718 94.2 -27 1.0675 0.4169 0.2897 -0.1758 125.6 -23 0.4234 0.0112 0.2179 0.1265 90.5 -19 0.0252 0.3600 -0.0263 -0.1168 81.3 -22 1.0695 -0.3707 -0.4285 0.4145 109.8 -16 0.7724 -0.5325 -0.2856 0.5269 88.5 -28 1.6189 0.5482 0.2342 -0.3333 110.7 -13 -0.2642 -0.6851 -0.3777 0.5003 101.9 -14 0.6431 -0.9604 -0.6000 -0.2885 81.7 -20 0.4504 -0.1666 0.1850 -0.1291 64.1 -25 1.2501 -0.2248 0.0244 0.3741 94.1 -7 -0.3910 -0.7618 0.8640 0.5557 103.4 -5 -0.6407 -0.9427 0.9465 0.7769 94.8 -6 -0.4523 -0.5529 0.3988 0.2781 110.9 -3 -1.1043 0.2106 -0.0653 -0.0539 106.7 -4 -0.9454 -0.5974 0.4639 0.4889 84.8 -2 -1.1971 0.5691 -0.3246 -0.2522 119.1 -9 -1.0983 0.7850 -0.5274 -0.4848 122.6 -12 -0.8673 0.5621 -0.3254 -0.3217 119.8 -10 -1.1842 0.7442 -0.4995 -0.3917 122.4 -11 -0.4134 0.0260 0.0107 -0.0682 112.8 -21 0.3210 1.2450 -0.2541 -0.5253 99.2 - -> plot(vare.dca) -> -> ### the detrending rationale: -> gaussresp <- function(x,u) exp(-(x-u)^2/2) -> x <- seq(0,6,length=15) ## The gradient -> u <- seq(-2,8,len=23) ## The optima -> pack <- outer(x,u,gaussresp) -> matplot(x, pack, type="l", main="Species packing") -> opar <- par(mfrow=c(2,2)) -> plot(scores(prcomp(pack)), asp=1, type="b", main="PCA") -> plot(scores(decorana(pack, ira=1)), asp=1, type="b", main="CA") -> plot(scores(decorana(pack)), asp=1, type="b", main="DCA") -> plot(scores(cca(pack ~ x), dis="sites"), asp=1, type="b", main="CCA") -> -> ### Let's add some noise: -> noisy <- (0.5 + runif(length(pack)))*pack -> par(mfrow=c(2,1)) -> matplot(x, pack, type="l", main="Ideal model") -> matplot(x, noisy, type="l", main="Noisy model") -> par(mfrow=c(2,2)) -> plot(scores(prcomp(noisy)), type="b", main="PCA", asp=1) -> plot(scores(decorana(noisy, ira=1)), type="b", main="CA", asp=1) -> plot(scores(decorana(noisy)), type="b", main="DCA", asp=1) -> plot(scores(cca(noisy ~ x), dis="sites"), asp=1, type="b", main="CCA") -> par(opar) -> -> -> -> graphics::par(get("par.postscript", pos = 'CheckExEnv')) -> cleanEx() -> nameEx("decostand") -> ### * decostand -> -> flush(stderr()); flush(stdout()) -> -> ### Name: decostand -> ### Title: Standardization Methods for Community Ecology -> ### Aliases: decostand wisconsin decobackstand -> ### Keywords: multivariate manip -> -> ### ** Examples -> -> data(varespec) -> sptrans <- decostand(varespec, "max") -> apply(sptrans, 2, max) -Callvulg Empenigr Rhodtome Vaccmyrt Vaccviti Pinusylv Descflex Betupube - 1 1 1 1 1 1 1 1 -Vacculig Diphcomp Dicrsp Dicrfusc Dicrpoly Hylosple Pleuschr Polypili - 1 1 1 1 1 1 1 1 -Polyjuni Polycomm Pohlnuta Ptilcili Barbhatc Cladarbu Cladrang Cladstel - 1 1 1 1 1 1 1 1 -Cladunci Cladcocc Cladcorn Cladgrac Cladfimb Cladcris Cladchlo Cladbotr - 1 1 1 1 1 1 1 1 -Cladamau Cladsp Cetreric Cetrisla Flavniva Nepharct Stersp Peltapht - 1 1 1 1 1 1 1 1 -Icmaeric Cladcerv Claddefo Cladphyl - 1 1 1 1 -> sptrans <- wisconsin(varespec) -> -> # CLR transformation for rows, with pseudocount -> varespec.clr <- decostand(varespec, "clr", pseudocount=1) -> -> # ALR transformation for rows, with pseudocount and reference sample -> varespec.alr <- decostand(varespec, "alr", pseudocount=1, reference=1) -> -> ## Chi-square: PCA similar but not identical to CA. -> ## Use wcmdscale for weighted analysis and identical results. -> sptrans <- decostand(varespec, "chi.square") -> plot(procrustes(rda(sptrans), cca(varespec))) -> -> -> -> cleanEx() -> nameEx("designdist") -> ### * designdist -> -> flush(stderr()); flush(stdout()) -> -> ### Encoding: UTF-8 -> -> ### Name: designdist -> ### Title: Design your own Dissimilarities -> ### Aliases: designdist chaodist -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(BCI) -> ## Four ways of calculating the same Sørensen dissimilarity -> d0 <- vegdist(BCI, "bray", binary = TRUE) -> d1 <- designdist(BCI, "(A+B-2*J)/(A+B)") -> d2 <- designdist(BCI, "(b+c)/(2*a+b+c)", abcd = TRUE) -> d3 <- designdist(BCI, "gamma/alpha - 1", alphagamma = TRUE) -> ## Arrhenius dissimilarity: the value of z in the species-area model -> ## S = c*A^z when combining two sites of equal areas, where S is the -> ## number of species, A is the area, and c and z are model parameters. -> ## The A below is not the area (which cancels out), but number of -> ## species in one of the sites, as defined in designdist(). -> dis <- designdist(BCI, "(log(A+B-J)-log(A+B)+log(2))/log(2)") -> ## This can be used in clustering or ordination... -> ordiplot(cmdscale(dis)) -species scores not available -> ## ... or in analysing beta diversity (without gradients) -> summary(dis) - Min. 1st Qu. Median Mean 3rd Qu. Max. - 0.2733 0.3895 0.4192 0.4213 0.4537 0.5906 -> -> -> -> cleanEx() -> nameEx("deviance.cca") -> ### * deviance.cca -> -> flush(stderr()); flush(stdout()) -> -> ### Name: deviance.cca -> ### Title: Statistics Resembling Deviance and AIC for Constrained -> ### Ordination -> ### Aliases: deviance.cca deviance.rda extractAIC.cca -> ### Keywords: multivariate models -> -> ### ** Examples -> -> # The deviance of correspondence analysis equals Chi-square -> data(dune) -> data(dune.env) -> chisq.test(dune) -Warning in chisq.test(dune) : - Chi-squared approximation may be incorrect - - Pearson's Chi-squared test - -data: dune -X-squared = 1449, df = 551, p-value < 2.2e-16 - -> deviance(cca(dune)) -[1] 1448.956 -> # Stepwise selection (forward from an empty model "dune ~ 1") -> ord <- cca(dune ~ ., dune.env) -> step(cca(dune ~ 1, dune.env), scope = formula(ord)) -Start: AIC=87.66 -dune ~ 1 - - Df AIC -+ Moisture 3 86.608 -+ Management 3 86.935 -+ A1 1 87.411 - 87.657 -+ Manure 4 88.832 -+ Use 2 89.134 - -Step: AIC=86.61 -dune ~ Moisture - - Df AIC - 86.608 -+ Management 3 86.813 -+ A1 1 86.992 -+ Use 2 87.259 -+ Manure 4 87.342 -- Moisture 3 87.657 -Call: cca(formula = dune ~ Moisture, data = dune.env) - - Inertia Proportion Rank -Total 2.1153 1.0000 -Constrained 0.6283 0.2970 3 -Unconstrained 1.4870 0.7030 16 -Inertia is scaled Chi-square - -Eigenvalues for constrained axes: - CCA1 CCA2 CCA3 -0.4187 0.1330 0.0766 - -Eigenvalues for unconstrained axes: - CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8 CA9 CA10 CA11 -0.4098 0.2259 0.1761 0.1234 0.1082 0.0908 0.0859 0.0609 0.0566 0.0467 0.0419 - CA12 CA13 CA14 CA15 CA16 -0.0201 0.0143 0.0099 0.0085 0.0080 - -> -> -> -> cleanEx() -> nameEx("dispindmorisita") -> ### * dispindmorisita -> -> flush(stderr()); flush(stdout()) -> -> ### Name: dispindmorisita -> ### Title: Morisita index of intraspecific aggregation -> ### Aliases: dispindmorisita -> ### Keywords: multivariate spatial -> -> ### ** Examples -> -> data(dune) -> x <- dispindmorisita(dune) -> x - imor mclu muni imst pchisq -Achimill 2.1666667 1.923488 0.327101099 0.50672636 9.157890e-03 -Agrostol 1.8085106 1.294730 0.785245032 0.51373357 1.142619e-05 -Airaprae 8.0000000 4.463082 -1.523370880 0.61382303 3.571702e-04 -Alopgeni 2.5396825 1.395781 0.711614757 0.53074307 3.024441e-08 -Anthodor 2.6666667 1.692616 0.495325824 0.52660266 5.897217e-05 -Bellpere 2.0512821 2.154361 0.158876373 0.45535255 3.451547e-02 -Bromhord 3.2380952 1.989452 0.279036892 0.53466422 1.170437e-04 -Chenalbu NaN Inf -Inf NaN NaN -Cirsarve 20.0000000 14.852327 -9.093483518 1.00000000 5.934709e-03 -Comapalu 6.6666667 5.617442 -2.364494506 0.53647558 1.055552e-02 -Eleopalu 3.7333333 1.577180 0.579438187 0.55851854 2.958285e-10 -Elymrepe 2.7692308 1.554093 0.596260659 0.53293787 1.180195e-06 -Empenigr 20.0000000 14.852327 -9.093483518 1.00000000 5.934709e-03 -Hyporadi 6.6666667 2.731541 -0.261685440 0.61393969 7.832274e-07 -Juncarti 3.1372549 1.814843 0.406265675 0.53635966 2.066336e-05 -Juncbufo 4.1025641 2.154361 0.158876373 0.55458486 1.503205e-05 -Lolipere 1.5849970 1.243023 0.822921342 0.50911591 5.873839e-05 -Planlanc 2.4615385 1.554093 0.596260659 0.52459747 1.921730e-05 -Poaprat 1.1702128 1.294730 0.785245032 0.28876015 1.046531e-01 -Poatriv 1.4644137 1.223425 0.837201879 0.50641728 2.747301e-04 -Ranuflam 2.4175824 2.065564 0.223578191 0.50981405 7.010483e-03 -Rumeacet 3.9215686 1.814843 0.406265675 0.55792432 1.530085e-07 -Sagiproc 2.4210526 1.729070 0.468764025 0.51893672 4.956394e-04 -Salirepe 5.8181818 2.385233 -0.009348352 0.59744520 2.687397e-07 -Scorautu 0.9643606 1.261365 0.809556915 -0.09356972 5.823404e-01 -Trifprat 6.6666667 2.731541 -0.261685440 0.61393969 7.832274e-07 -Trifrepe 1.2210916 1.301138 0.780576445 0.36709402 6.335449e-02 -Vicilath 3.3333333 5.617442 -2.364494506 0.25266513 1.301890e-01 -Bracruta 1.1904762 1.288590 0.789719093 0.33001160 8.071762e-02 -Callcusp 5.3333333 2.539147 -0.121498169 0.58001287 7.982634e-06 -> y <- dispindmorisita(dune, unique.rm = TRUE) -> y - imor mclu muni imst pchisq -Achimill 2.1666667 1.923488 0.327101099 0.50672636 9.157890e-03 -Agrostol 1.8085106 1.294730 0.785245032 0.51373357 1.142619e-05 -Airaprae 8.0000000 4.463082 -1.523370880 0.61382303 3.571702e-04 -Alopgeni 2.5396825 1.395781 0.711614757 0.53074307 3.024441e-08 -Anthodor 2.6666667 1.692616 0.495325824 0.52660266 5.897217e-05 -Bellpere 2.0512821 2.154361 0.158876373 0.45535255 3.451547e-02 -Bromhord 3.2380952 1.989452 0.279036892 0.53466422 1.170437e-04 -Comapalu 6.6666667 5.617442 -2.364494506 0.53647558 1.055552e-02 -Eleopalu 3.7333333 1.577180 0.579438187 0.55851854 2.958285e-10 -Elymrepe 2.7692308 1.554093 0.596260659 0.53293787 1.180195e-06 -Hyporadi 6.6666667 2.731541 -0.261685440 0.61393969 7.832274e-07 -Juncarti 3.1372549 1.814843 0.406265675 0.53635966 2.066336e-05 -Juncbufo 4.1025641 2.154361 0.158876373 0.55458486 1.503205e-05 -Lolipere 1.5849970 1.243023 0.822921342 0.50911591 5.873839e-05 -Planlanc 2.4615385 1.554093 0.596260659 0.52459747 1.921730e-05 -Poaprat 1.1702128 1.294730 0.785245032 0.28876015 1.046531e-01 -Poatriv 1.4644137 1.223425 0.837201879 0.50641728 2.747301e-04 -Ranuflam 2.4175824 2.065564 0.223578191 0.50981405 7.010483e-03 -Rumeacet 3.9215686 1.814843 0.406265675 0.55792432 1.530085e-07 -Sagiproc 2.4210526 1.729070 0.468764025 0.51893672 4.956394e-04 -Salirepe 5.8181818 2.385233 -0.009348352 0.59744520 2.687397e-07 -Scorautu 0.9643606 1.261365 0.809556915 -0.09356972 5.823404e-01 -Trifprat 6.6666667 2.731541 -0.261685440 0.61393969 7.832274e-07 -Trifrepe 1.2210916 1.301138 0.780576445 0.36709402 6.335449e-02 -Vicilath 3.3333333 5.617442 -2.364494506 0.25266513 1.301890e-01 -Bracruta 1.1904762 1.288590 0.789719093 0.33001160 8.071762e-02 -Callcusp 5.3333333 2.539147 -0.121498169 0.58001287 7.982634e-06 -> dim(x) ## with unique species -[1] 30 5 -> dim(y) ## unique species removed -[1] 27 5 -> -> -> -> cleanEx() -> nameEx("dispweight") -> ### * dispweight -> -> flush(stderr()); flush(stdout()) -> -> ### Name: dispweight -> ### Title: Dispersion-based weighting of species counts -> ### Aliases: dispweight gdispweight summary.dispweight -> ### Keywords: multivariate manip -> -> ### ** Examples -> -> data(mite, mite.env) -> ## dispweight and its summary -> mite.dw <- with(mite.env, dispweight(mite, Shrub, nsimul = 99)) -> ## IGNORE_RDIFF_BEGIN -> summary(mite.dw) - Dispersion Weight Df Pr(Disp.) -Brachy 9.6908 0.1031909 67 0.01 ** -PHTH 3.2809 0.3047900 49 0.01 ** -HPAV 6.5263 0.1532264 67 0.01 ** -RARD 6.0477 0.1653525 49 0.01 ** -SSTR 2.2619 0.4421053 49 0.01 ** -Protopl 5.4229 0.1844031 49 0.01 ** -MEGR 4.5354 0.2204860 67 0.01 ** -MPRO 1.2687 1.0000000 67 0.09 . -TVIE 2.5956 0.3852706 67 0.01 ** -HMIN 10.0714 0.0992906 67 0.01 ** -HMIN2 7.5674 0.1321466 49 0.01 ** -NPRA 2.6743 0.3739344 67 0.01 ** -TVEL 9.6295 0.1038474 49 0.01 ** -ONOV 11.3628 0.0880064 67 0.01 ** -SUCT 8.7372 0.1144533 67 0.01 ** -LCIL 129.4436 0.0077254 67 0.01 ** -Oribatl1 4.1250 0.2424248 67 0.01 ** -Ceratoz1 1.7150 0.5830768 67 0.01 ** -PWIL 2.2943 0.4358538 67 0.01 ** -Galumna1 2.8777 0.3474943 49 0.01 ** -Stgncrs2 3.8242 0.2614953 49 0.01 ** -HRUF 1.7575 0.5690021 67 0.01 ** -Trhypch1 14.9225 0.0670128 67 0.01 ** -PPEL 1.3628 0.7337770 49 0.05 * -NCOR 2.5875 0.3864771 67 0.01 ** -SLAT 2.7857 0.3589744 49 0.01 ** -FSET 4.8901 0.2044944 49 0.01 ** -Lepidzts 1.6577 0.6032360 49 0.01 ** -Eupelops 1.4611 0.6844033 67 0.02 * -Miniglmn 1.6505 0.6058733 49 0.01 ** -LRUG 12.0658 0.0828790 67 0.01 ** -PLAG2 3.2403 0.3086090 67 0.01 ** -Ceratoz3 3.5125 0.2846947 67 0.01 ** -Oppiminu 3.1680 0.3156525 67 0.01 ** -Trimalc2 10.5927 0.0944046 67 0.01 ** ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -Based on 99 simulations on 'c0_ind' nullmodel -> ## IGNORE_RDIFF_END -> ## generalized dispersion weighting -> mite.dw <- gdispweight(mite ~ Shrub + WatrCont, data = mite.env) -> rda(mite.dw ~ Shrub + WatrCont, data = mite.env) -Call: rda(formula = mite.dw ~ Shrub + WatrCont, data = mite.env) - - Inertia Proportion Rank -Total 38.1640 1.0000 -Constrained 9.2129 0.2414 3 -Unconstrained 28.9511 0.7586 35 -Inertia is variance - -Eigenvalues for constrained axes: - RDA1 RDA2 RDA3 -7.986 0.748 0.480 - -Eigenvalues for unconstrained axes: - PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 -5.886 3.634 2.791 2.592 1.932 1.573 1.210 1.078 -(Showing 8 of 35 unconstrained eigenvalues) - -> -> -> -> cleanEx() -> nameEx("distconnected") -> ### * distconnected -> -> flush(stderr()); flush(stdout()) -> -> ### Name: distconnected -> ### Title: Connectedness of Dissimilarities -> ### Aliases: distconnected no.shared -> ### Keywords: multivariate -> -> ### ** Examples -> -> ## There are no disconnected data in vegan, and the following uses an -> ## extremely low threshold limit for connectedness. This is for -> ## illustration only, and not a recommended practice. -> data(dune) -> dis <- vegdist(dune) -> gr <- distconnected(dis, toolong=0.4) -Connectivity of distance matrix with threshold dissimilarity 0.4 -Data are disconnected: 6 groups -Groups sizes - 1 2 3 4 5 6 - 1 11 2 4 1 1 -> # Make sites with no shared species as NA in Manhattan dissimilarities -> dis <- vegdist(dune, "manhattan") -> is.na(dis) <- no.shared(dune) -> -> -> -> cleanEx() -> nameEx("diversity") -> ### * diversity -> -> flush(stderr()); flush(stdout()) -> -> ### Name: diversity -> ### Title: Ecological Diversity Indices -> ### Aliases: diversity simpson.unb fisher.alpha specnumber -> ### Keywords: univar -> -> ### ** Examples -> -> data(BCI, BCI.env) -> H <- diversity(BCI) -> simp <- diversity(BCI, "simpson") -> invsimp <- diversity(BCI, "inv") -> ## Unbiased Simpson -> unbias.simp <- simpson.unb(BCI) -> ## Fisher alpha -> alpha <- fisher.alpha(BCI) -> ## Plot all -> pairs(cbind(H, simp, invsimp, unbias.simp, alpha), pch="+", col="blue") -> ## Species richness (S) and Pielou's evenness (J): -> S <- specnumber(BCI) ## rowSums(BCI > 0) does the same... -> J <- H/log(S) -> ## beta diversity defined as gamma/alpha - 1: -> ## alpha is the average no. of species in a group, and gamma is the -> ## total number of species in the group -> (alpha <- with(BCI.env, tapply(specnumber(BCI), Habitat, mean))) - OldHigh OldLow OldSlope Swamp Young -85.75000 91.76923 91.58333 94.00000 90.00000 -> (gamma <- with(BCI.env, specnumber(BCI, Habitat))) - OldHigh OldLow OldSlope Swamp Young - 158 210 183 128 117 -> gamma/alpha - 1 - OldHigh OldLow OldSlope Swamp Young -0.8425656 1.2883487 0.9981802 0.3617021 0.3000000 -> ## similar calculations with Shannon diversity -> (alpha <- with(BCI.env, tapply(diversity(BCI), Habitat, mean))) # average - OldHigh OldLow OldSlope Swamp Young -3.638598 3.876413 3.887122 4.003780 3.246729 -> (gamma <- with(BCI.env, diversity(BCI, groups=Habitat))) # pooled - OldHigh OldLow OldSlope Swamp Young -3.873186 4.284972 4.212098 4.164335 3.387536 -> ## additive beta diversity based on Shannon index -> gamma-alpha - OldHigh OldLow OldSlope Swamp Young -0.2345878 0.4085595 0.3249760 0.1605548 0.1408068 -> -> -> -> cleanEx() -> nameEx("dune") -> ### * dune -> -> flush(stderr()); flush(stdout()) -> -> ### Name: dune -> ### Title: Vegetation and Environment in Dutch Dune Meadows. -> ### Aliases: dune dune.env -> ### Keywords: datasets -> -> ### ** Examples -> -> data(dune) -> data(dune.env) -> -> -> -> cleanEx() -> nameEx("dune.taxon") -> ### * dune.taxon -> -> flush(stderr()); flush(stdout()) -> -> ### Name: dune.taxon -> ### Title: Taxonomic Classification and Phylogeny of Dune Meadow Species -> ### Aliases: dune.taxon dune.phylodis -> ### Keywords: datasets -> -> ### ** Examples -> -> data(dune.taxon) -> data(dune.phylodis) -> -> -> -> cleanEx() -> nameEx("eigenvals") -> ### * eigenvals -> -> flush(stderr()); flush(stdout()) -> -> ### Name: eigenvals -> ### Title: Extract Eigenvalues from an Ordination Object -> ### Aliases: eigenvals eigenvals.default eigenvals.prcomp -> ### eigenvals.princomp eigenvals.cca eigenvals.wcmdscale eigenvals.pcnm -> ### eigenvals.dudi eigenvals.pca eigenvals.pco eigenvals.decorana -> ### summary.eigenvals -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(varespec) -> data(varechem) -> mod <- cca(varespec ~ Al + P + K, varechem) -> ev <- eigenvals(mod) -> ev - CCA1 CCA2 CCA3 CA1 CA2 CA3 CA4 CA5 -0.3615566 0.1699600 0.1126167 0.3500372 0.2200788 0.1850741 0.1551179 0.1351054 - CA6 CA7 CA8 CA9 CA10 CA11 CA12 CA13 -0.1002670 0.0772991 0.0536938 0.0365603 0.0350887 0.0282291 0.0170651 0.0122474 - CA14 CA15 CA16 CA17 CA18 CA19 CA20 -0.0101910 0.0094701 0.0055090 0.0030529 0.0025118 0.0019485 0.0005178 -> summary(ev) -Importance of components: - CCA1 CCA2 CCA3 CA1 CA2 CA3 CA4 -Eigenvalue 0.3616 0.16996 0.11262 0.3500 0.2201 0.18507 0.15512 -Proportion Explained 0.1736 0.08159 0.05406 0.1680 0.1056 0.08884 0.07446 -Cumulative Proportion 0.1736 0.25514 0.30920 0.4772 0.5829 0.67172 0.74618 - CA5 CA6 CA7 CA8 CA9 CA10 CA11 -Eigenvalue 0.13511 0.10027 0.07730 0.05369 0.03656 0.03509 0.02823 -Proportion Explained 0.06485 0.04813 0.03711 0.02577 0.01755 0.01684 0.01355 -Cumulative Proportion 0.81104 0.85917 0.89627 0.92205 0.93960 0.95644 0.96999 - CA12 CA13 CA14 CA15 CA16 CA17 -Eigenvalue 0.017065 0.012247 0.010191 0.009470 0.005509 0.003053 -Proportion Explained 0.008192 0.005879 0.004892 0.004546 0.002644 0.001465 -Cumulative Proportion 0.978183 0.984062 0.988954 0.993500 0.996145 0.997610 - CA18 CA19 CA20 -Eigenvalue 0.002512 0.0019485 0.0005178 -Proportion Explained 0.001206 0.0009353 0.0002486 -Cumulative Proportion 0.998816 0.9997514 1.0000000 -> -> ## choose which eignevalues to return -> eigenvals(mod, model = "unconstrained") - CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8 -0.3500372 0.2200788 0.1850741 0.1551179 0.1351054 0.1002670 0.0772991 0.0536938 - CA9 CA10 CA11 CA12 CA13 CA14 CA15 CA16 -0.0365603 0.0350887 0.0282291 0.0170651 0.0122474 0.0101910 0.0094701 0.0055090 - CA17 CA18 CA19 CA20 -0.0030529 0.0025118 0.0019485 0.0005178 -> -> -> -> cleanEx() -> nameEx("envfit") -> ### * envfit -> -> flush(stderr()); flush(stdout()) -> -> ### Name: envfit -> ### Title: Fits an Environmental Vector or Factor onto an Ordination -> ### Aliases: envfit envfit.default envfit.formula vectorfit factorfit -> ### plot.envfit scores.envfit labels.envfit -> ### Keywords: multivariate aplot htest -> -> ### ** Examples -> -> data(varespec, varechem) -> library(MASS) -> ord <- metaMDS(varespec) -Square root transformation -Wisconsin double standardization -Run 0 stress 0.1843196 -Run 1 stress 0.2455911 -Run 2 stress 0.2169404 -Run 3 stress 0.2313231 -Run 4 stress 0.1974406 -Run 5 stress 0.1858401 -Run 6 stress 0.1948413 -Run 7 stress 0.2265716 -Run 8 stress 0.2104573 -Run 9 stress 0.1962451 -Run 10 stress 0.2673136 -Run 11 stress 0.1976151 -Run 12 stress 0.1852397 -Run 13 stress 0.2341081 -Run 14 stress 0.1955837 -Run 15 stress 0.2137396 -Run 16 stress 0.2109613 -Run 17 stress 0.1825658 -... New best solution -... Procrustes: rmse 0.04163108 max resid 0.1518283 -Run 18 stress 0.1843196 -Run 19 stress 0.2570114 -Run 20 stress 0.3760489 -*** Best solution was not repeated -- monoMDS stopping criteria: - 20: stress ratio > sratmax -> (fit <- envfit(ord, varechem, perm = 999)) - -***VECTORS - - NMDS1 NMDS2 r2 Pr(>r) -N -0.05727 -0.99836 0.2537 0.044 * -P 0.61968 0.78485 0.1938 0.096 . -K 0.76641 0.64235 0.1809 0.120 -Ca 0.68515 0.72840 0.4119 0.004 ** -Mg 0.63249 0.77457 0.4270 0.003 ** -S 0.19134 0.98152 0.1752 0.144 -Al -0.87163 0.49017 0.5269 0.002 ** -Fe -0.93605 0.35187 0.4451 0.004 ** -Mn 0.79872 -0.60171 0.5231 0.002 ** -Zn 0.61754 0.78654 0.1879 0.120 -Mo -0.90307 0.42949 0.0609 0.490 -Baresoil 0.92492 -0.38015 0.2508 0.053 . -Humdepth 0.93285 -0.36027 0.5200 0.001 *** -pH -0.64801 0.76163 0.2308 0.051 . ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -Permutation: free -Number of permutations: 999 - - -> scores(fit, "vectors") - NMDS1 NMDS2 -N -0.02884498 -0.5028120 -P 0.27282092 0.3455381 -K 0.32599478 0.2732275 -Ca 0.43970784 0.4674593 -Mg 0.41331681 0.5061682 -S 0.08008661 0.4108311 -Al -0.63271699 0.3558174 -Fe -0.62445907 0.2347377 -Mn 0.57765925 -0.4351757 -Zn 0.26769911 0.3409636 -Mo -0.22294149 0.1060277 -Baresoil 0.46317948 -0.1903704 -Humdepth 0.67271356 -0.2598028 -pH -0.31130902 0.3658919 -> plot(ord) -> plot(fit) -> plot(fit, p.max = 0.05, col = "red") -> ## Adding fitted arrows to CCA. We use "lc" scores, and hope -> ## that arrows are scaled similarly in cca and envfit plots -> ord <- cca(varespec ~ Al + P + K, varechem) -> plot(ord, type="p") -> fit <- envfit(ord, varechem, perm = 999, display = "lc") -> plot(fit, p.max = 0.05, col = "red") -> ## 'scaling' must be set similarly in envfit and in ordination plot -> plot(ord, type = "p", scaling = "sites") -> fit <- envfit(ord, varechem, perm = 0, display = "lc", scaling = "sites") -> plot(fit, col = "red") -> -> ## Class variables, formula interface, and displaying the -> ## inter-class variability with ordispider, and semitransparent -> ## white background for labels (semitransparent colours are not -> ## supported by all graphics devices) -> data(dune) -> data(dune.env) -> ord <- cca(dune) -> fit <- envfit(ord ~ Moisture + A1, dune.env, perm = 0) -> plot(ord, type = "n") -> with(dune.env, ordispider(ord, Moisture, col="skyblue")) -> with(dune.env, points(ord, display = "sites", col = as.numeric(Moisture), -+ pch=16)) -> plot(fit, cex=1.2, axis=TRUE, bg = rgb(1, 1, 1, 0.5)) -> ## Use shorter labels for factor centroids -> labels(fit) -$vectors -[1] "A1" - -$factors -[1] "Moisture1" "Moisture2" "Moisture4" "Moisture5" - -> plot(ord) -> plot(fit, labels=list(factors = paste("M", c(1,2,4,5), sep = "")), -+ bg = rgb(1,1,0,0.5)) -> -> -> -> cleanEx() - -detaching ‘package:MASS’ - -> nameEx("eventstar") -> ### * eventstar -> -> flush(stderr()); flush(stdout()) -> -> ### Name: eventstar -> ### Title: Scale Parameter at the Minimum of the Tsallis Evenness Profile -> ### Aliases: eventstar -> ### Keywords: optimize multivariate utilities -> -> ### ** Examples -> -> data(BCI) -> (x <- eventstar(BCI[1:5,])) - qstar Estar Hstar Dstar -1 0.6146389 0.4263687 10.524584 67.03551 -2 0.6249249 0.4080263 9.534034 57.66840 -3 0.6380858 0.4062032 9.225458 57.69174 -4 0.6245808 0.4062213 10.140189 65.50247 -5 0.6404825 0.4219957 9.828138 66.96440 -> ## profiling -> y <- as.numeric(BCI[10,]) -> (z <- eventstar(y)) - qstar Estar Hstar Dstar -1 0.6372529 0.4117557 9.546332 61.77715 -> q <- seq(0, 2, 0.05) -> Eprof <- tsallis(y, scales=q, norm=TRUE) -> Hprof <- tsallis(y, scales=q) -> Dprof <- tsallis(y, scales=q, hill=TRUE) -> opar <- par(mfrow=c(3,1)) -> plot(q, Eprof, type="l", main="Evenness") -> abline(v=z$qstar, h=tsallis(y, scales=z$qstar, norm=TRUE), col=2) -> plot(q, Hprof, type="l", main="Diversity") -> abline(v=z$qstar, h=tsallis(y, scales=z$qstar), col=2) -> plot(q, Dprof, type="l", main="Effective number of species") -> abline(v=z$qstar, h=tsallis(y, scales=z$qstar, hill=TRUE), col=2) -> par(opar) -> -> -> -> graphics::par(get("par.postscript", pos = 'CheckExEnv')) -> cleanEx() -> nameEx("fisherfit") -> ### * fisherfit -> -> flush(stderr()); flush(stdout()) -> -> ### Name: fisherfit -> ### Title: Fit Fisher's Logseries and Preston's Lognormal Model to -> ### Abundance Data -> ### Aliases: fisherfit as.fisher plot.fisherfit prestonfit prestondistr -> ### as.preston plot.prestonfit lines.prestonfit plot.preston -> ### lines.preston plot.fisher veiledspec -> ### Keywords: univar distribution -> -> ### ** Examples -> -> data(BCI) -> mod <- fisherfit(BCI[5,]) -> mod - -Fisher log series model -No. of species: 101 -Fisher alpha: 37.96423 - -> # prestonfit seems to need large samples -> mod.oct <- prestonfit(colSums(BCI)) -> mod.ll <- prestondistr(colSums(BCI)) -> mod.oct - -Preston lognormal model -Method: Quasi-Poisson fit to octaves -No. of species: 225 - - mode width S0 - 4.885798 2.932690 32.022923 - -Frequencies by Octave - 0 1 2 3 4 5 6 7 -Observed 9.500000 16.00000 18.00000 19.000 30.00000 35.00000 31.00000 26.50000 -Fitted 7.994154 13.31175 19.73342 26.042 30.59502 31.99865 29.79321 24.69491 - 8 9 10 11 -Observed 18.00000 13.00000 7.000000 2.0000 -Fitted 18.22226 11.97021 7.000122 3.6443 - -> mod.ll - -Preston lognormal model -Method: maximized likelihood to log2 abundances -No. of species: 225 - - mode width S0 - 4.365002 2.753531 33.458185 - -Frequencies by Octave - 0 1 2 3 4 5 6 7 -Observed 9.50000 16.00000 18.00000 19.00000 30.00000 35.00000 31.00000 26.50000 -Fitted 9.52392 15.85637 23.13724 29.58961 33.16552 32.58022 28.05054 21.16645 - 8 9 10 11 -Observed 18.00000 13.000000 7.000000 2.00000 -Fitted 13.99829 8.113746 4.121808 1.83516 - -> plot(mod.oct) -> lines(mod.ll, line.col="blue3") # Different -> ## Smoothed density -> den <- density(log2(colSums(BCI))) -> lines(den$x, ncol(BCI)*den$y, lwd=2) # Fairly similar to mod.oct -> ## Extrapolated richness -> veiledspec(mod.oct) -Extrapolated Observed Veiled - 235.40577 225.00000 10.40577 -> veiledspec(mod.ll) -Extrapolated Observed Veiled - 230.931018 225.000000 5.931018 -> -> -> -> cleanEx() -> nameEx("goodness.cca") -> ### * goodness.cca -> -> flush(stderr()); flush(stdout()) -> -> ### Name: goodness.cca -> ### Title: Diagnostic Tools for [Constrained] Ordination (CCA, RDA, DCA, -> ### CA, PCA) -> ### Aliases: goodness goodness.cca inertcomp spenvcor intersetcor vif.cca -> ### alias.cca -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(dune) -> data(dune.env) -> mod <- cca(dune ~ A1 + Management + Condition(Moisture), data=dune.env) -> goodness(mod, addprevious = TRUE) - CCA1 CCA2 CCA3 CCA4 -Achimill 0.36630013 0.3822685 0.3838616 0.4934158 -Agrostol 0.67247051 0.6724758 0.6779597 0.7773267 -Airaprae 0.36213737 0.3698100 0.3816619 0.3908018 -Alopgeni 0.61547145 0.6966105 0.7042650 0.7212918 -Anthodor 0.24619147 0.2795001 0.3509172 0.3609709 -Bellpere 0.41185412 0.4179432 0.4847618 0.4849622 -Bromhord 0.33487622 0.3397416 0.3870032 0.5505037 -Chenalbu 0.23594716 0.2684323 0.2828928 0.2885321 -Cirsarve 0.29041563 0.3013655 0.3080671 0.3591280 -Comapalu 0.16338257 0.6836790 0.7390659 0.7963425 -Eleopalu 0.55132024 0.6099415 0.6193301 0.6259818 -Elymrepe 0.25239595 0.2710266 0.2761491 0.2882666 -Empenigr 0.27089495 0.3132399 0.3153052 0.3154203 -Hyporadi 0.31349648 0.3371809 0.3387669 0.3388716 -Juncarti 0.43923609 0.4492937 0.4871043 0.5224072 -Juncbufo 0.70439967 0.7226263 0.7228786 0.7257471 -Lolipere 0.48141171 0.5720410 0.5727299 0.6034007 -Planlanc 0.54969676 0.6084389 0.6802195 0.6826265 -Poaprat 0.40267189 0.4944813 0.5014516 0.5326546 -Poatriv 0.49694972 0.5409439 0.5468830 0.5594817 -Ranuflam 0.68677962 0.6983001 0.7020461 0.7064850 -Rumeacet 0.44788204 0.5211145 0.7673956 0.7691199 -Sagiproc 0.27039747 0.3497634 0.3553109 0.3613746 -Salirepe 0.64788354 0.7264891 0.7276110 0.7639711 -Scorautu 0.54312496 0.5510319 0.6078931 0.6140593 -Trifprat 0.37328840 0.4101104 0.6624199 0.6625703 -Trifrepe 0.03048149 0.2115857 0.3300132 0.4207437 -Vicilath 0.17824132 0.1784611 0.3762406 0.4279428 -Bracruta 0.15585567 0.1641095 0.1672797 0.2449864 -Callcusp 0.30771429 0.3143582 0.3308502 0.3518027 -> goodness(mod, addprevious = TRUE, summ = TRUE) - Achimill Agrostol Airaprae Alopgeni Anthodor Bellpere Bromhord Chenalbu -0.4934158 0.7773267 0.3908018 0.7212918 0.3609709 0.4849622 0.5505037 0.2885321 - Cirsarve Comapalu Eleopalu Elymrepe Empenigr Hyporadi Juncarti Juncbufo -0.3591280 0.7963425 0.6259818 0.2882666 0.3154203 0.3388716 0.5224072 0.7257471 - Lolipere Planlanc Poaprat Poatriv Ranuflam Rumeacet Sagiproc Salirepe -0.6034007 0.6826265 0.5326546 0.5594817 0.7064850 0.7691199 0.3613746 0.7639711 - Scorautu Trifprat Trifrepe Vicilath Bracruta Callcusp -0.6140593 0.6625703 0.4207437 0.4279428 0.2449864 0.3518027 -> # Inertia components -> inertcomp(mod, prop = TRUE) - pCCA CCA CA -Achimill 0.34271900 0.15069678 0.5065842 -Agrostol 0.55602406 0.22130269 0.2226733 -Airaprae 0.06404726 0.32675457 0.6091982 -Alopgeni 0.34238968 0.37890210 0.2787082 -Anthodor 0.10259139 0.25837947 0.6390291 -Bellpere 0.40972447 0.07523776 0.5150378 -Bromhord 0.33046684 0.22003683 0.4494963 -Chenalbu 0.11064346 0.17788865 0.7114679 -Cirsarve 0.26649913 0.09262886 0.6408720 -Comapalu 0.16096277 0.63537969 0.2036575 -Eleopalu 0.53954819 0.08643366 0.3740182 -Elymrepe 0.22234322 0.06592337 0.7117334 -Empenigr 0.10361994 0.21180040 0.6845797 -Hyporadi 0.03889627 0.29997533 0.6611284 -Juncarti 0.43439190 0.08801527 0.4775928 -Juncbufo 0.66622672 0.05952038 0.2742529 -Lolipere 0.46273045 0.14067027 0.3965993 -Planlanc 0.51993753 0.16268893 0.3173735 -Poaprat 0.39408053 0.13857406 0.4673454 -Poatriv 0.05598349 0.50349824 0.4405183 -Ranuflam 0.68509904 0.02138594 0.2935150 -Rumeacet 0.40125987 0.36786003 0.2308801 -Sagiproc 0.26050435 0.10087025 0.6386254 -Salirepe 0.12527838 0.63869277 0.2360289 -Scorautu 0.10895437 0.50510492 0.3859407 -Trifprat 0.34544815 0.31712212 0.3374297 -Trifrepe 0.02132183 0.39942191 0.5792563 -Vicilath 0.12125433 0.30668844 0.5720572 -Bracruta 0.07222706 0.17275938 0.7550136 -Callcusp 0.29447422 0.05732850 0.6481973 -> inertcomp(mod) - pCCA CCA CA -Achimill 0.0173766015 0.007640656 0.02568493 -Agrostol 0.0456558521 0.018171449 0.01828399 -Airaprae 0.0066672285 0.034014687 0.06341666 -Alopgeni 0.0325977567 0.036073980 0.02653486 -Anthodor 0.0096274015 0.024246897 0.05996790 -Bellpere 0.0154640710 0.002839669 0.01943887 -Bromhord 0.0180126793 0.011993496 0.02450059 -Chenalbu 0.0031913088 0.005130874 0.02052099 -Cirsarve 0.0110663060 0.003846389 0.02661204 -Comapalu 0.0127652351 0.050389111 0.01615116 -Eleopalu 0.0797827194 0.012780901 0.05530588 -Elymrepe 0.0193932154 0.005749967 0.06207879 -Empenigr 0.0063826176 0.013046147 0.04216766 -Hyporadi 0.0046669914 0.035992710 0.07932587 -Juncarti 0.0359126341 0.007276518 0.03948420 -Juncbufo 0.0494087668 0.004414156 0.02033917 -Lolipere 0.0368344271 0.011197683 0.03157023 -Planlanc 0.0366139947 0.011456552 0.02234944 -Poaprat 0.0142991623 0.005028142 0.01695757 -Poatriv 0.0028845344 0.025942611 0.02269759 -Ranuflam 0.0446783229 0.001394671 0.01914141 -Rumeacet 0.0288221948 0.026423110 0.01658394 -Sagiproc 0.0151161507 0.005853146 0.03705718 -Salirepe 0.0142756439 0.072779924 0.02689581 -Scorautu 0.0030643984 0.014206339 0.01085478 -Trifprat 0.0228613139 0.020986733 0.02233067 -Trifrepe 0.0008339368 0.015622139 0.02265580 -Vicilath 0.0049088357 0.012415912 0.02315905 -Bracruta 0.0032317812 0.007730074 0.03378289 -Callcusp 0.0319130878 0.006212868 0.07024716 -> # vif.cca -> vif.cca(mod) - Moisture.L Moisture.Q Moisture.C A1 ManagementHF ManagementNM - 1.504327 1.284489 1.347660 1.367328 2.238653 2.570972 -ManagementSF - 2.424444 -> # Aliased constraints -> mod <- cca(dune ~ ., dune.env) -> mod -Call: cca(formula = dune ~ A1 + Moisture + Management + Use + Manure, -data = dune.env) - - Inertia Proportion Rank -Total 2.1153 1.0000 -Constrained 1.5032 0.7106 12 -Unconstrained 0.6121 0.2894 7 -Inertia is scaled Chi-square -Some constraints or conditions were aliased because they were redundant - -Eigenvalues for constrained axes: - CCA1 CCA2 CCA3 CCA4 CCA5 CCA6 CCA7 CCA8 CCA9 CCA10 CCA11 -0.4671 0.3410 0.1761 0.1532 0.0953 0.0703 0.0589 0.0499 0.0318 0.0260 0.0228 - CCA12 -0.0108 - -Eigenvalues for unconstrained axes: - CA1 CA2 CA3 CA4 CA5 CA6 CA7 -0.27237 0.10876 0.08975 0.06305 0.03489 0.02529 0.01798 - -> vif.cca(mod) - A1 Moisture.L Moisture.Q Moisture.C ManagementHF ManagementNM - 2.208249 2.858927 3.072715 3.587087 6.608315 142.359372 -ManagementSF Use.L Use.Q Manure.L Manure.Q Manure.C - 12.862713 2.642718 3.007238 80.828330 49.294455 21.433337 - Manure^4 - NA -> alias(mod) -Model : -dune ~ A1 + Moisture + Management + Use + Manure - -Complete : - A1 Moisture.L Moisture.Q Moisture.C ManagementHF ManagementNM -Manure^4 8.366600 - ManagementSF Use.L Use.Q Manure.L Manure.Q Manure.C -Manure^4 5.291503 -4.472136 2.645751 - -> with(dune.env, table(Management, Manure)) - Manure -Management 0 1 2 3 4 - BF 0 2 1 0 0 - HF 0 1 2 2 0 - NM 6 0 0 0 0 - SF 0 0 1 2 3 -> # The standard correlations (not recommended) -> ## IGNORE_RDIFF_BEGIN -> spenvcor(mod) - CCA1 CCA2 CCA3 CCA4 CCA5 CCA6 CCA7 CCA8 -0.9636709 0.9487249 0.9330741 0.8734876 0.9373716 0.8362687 0.9748793 0.8392720 - CCA9 CCA10 CCA11 CCA12 -0.8748741 0.6087512 0.6633248 0.7581210 -> intersetcor(mod) - CCA1 CCA2 CCA3 CCA4 CCA5 -A1 -0.5332506 -0.13691202 -0.47996401 -0.259859587 0.09894964 -Moisture.L -0.8785505 -0.17867589 0.03714134 0.181952935 0.09826534 -Moisture.Q -0.1956664 0.33044917 -0.27321286 -0.180333890 -0.26609291 -Moisture.C -0.2023782 0.09698397 0.28596824 -0.261712720 0.49103002 -ManagementHF 0.3473460 -0.01680324 -0.51205769 0.194144965 -0.30752664 -ManagementNM -0.5699549 0.61111645 0.14751127 -0.013777789 -0.04571982 -ManagementSF -0.1197499 -0.64084416 0.19780650 0.134892908 0.09679992 -Use.L -0.1871999 -0.32990444 -0.30941161 -0.372747011 -0.09586963 -Use.Q -0.1820298 0.48874152 -0.01997442 -0.009812946 -0.04812588 -Manure.L 0.3175126 -0.65945634 0.03724864 -0.025383543 0.04077470 -Manure.Q -0.4075615 0.21149073 0.49297244 -0.176686201 -0.11973190 -Manure.C 0.4676279 -0.11376054 0.29132473 -0.173382982 -0.14219924 -Manure^4 0.2222349 0.12789494 -0.12921227 0.108367170 0.02559567 - CCA6 CCA7 CCA8 CCA9 CCA10 -A1 -0.15225816 -0.25788462 -0.19247720 0.27694466 -0.1158449480 -Moisture.L -0.02923342 -0.07858647 0.10772510 -0.07101300 0.0952517164 -Moisture.Q -0.11211675 -0.05062810 0.48302647 -0.06138704 -0.2053304965 -Moisture.C -0.23581275 0.38693407 0.10144580 0.21907160 0.1875632770 -ManagementHF -0.24278705 -0.16364055 0.14053438 -0.31066725 0.1310215145 -ManagementNM -0.06430101 -0.23917584 -0.14375754 0.27103732 0.0002768613 -ManagementSF -0.01611984 0.49726250 -0.08073472 0.30235728 -0.1381281272 -Use.L 0.19127262 0.44624831 0.18450714 -0.12950951 0.0452826749 -Use.Q 0.13485545 -0.10367354 0.11020112 -0.41245485 -0.0766932005 -Manure.L -0.22265819 0.49627772 0.16971786 0.03943343 -0.0045229147 -Manure.Q -0.19402211 0.11937394 -0.17611673 0.44002593 0.0903998202 -Manure.C 0.14760330 -0.07842345 -0.37774417 -0.10181374 0.1055057288 -Manure^4 -0.36683782 -0.05953330 -0.40927409 0.06054381 -0.1500198368 - CCA11 CCA12 -A1 0.03550223 0.08881387 -Moisture.L -0.06404776 0.08587882 -Moisture.Q 0.21810558 -0.16917878 -Moisture.C -0.13701079 0.14260914 -ManagementHF -0.17283125 -0.13296499 -ManagementNM 0.01358436 -0.09533598 -ManagementSF 0.01468592 0.06614834 -Use.L 0.08584883 -0.32559307 -Use.Q -0.41893616 -0.04881247 -Manure.L -0.02396993 -0.13049087 -Manure.Q -0.12987366 -0.07137031 -Manure.C -0.05176927 0.41550238 -Manure^4 0.41603287 -0.01661279 -> ## IGNORE_RDIFF_END -> -> -> -> cleanEx() -> nameEx("goodness.metaMDS") -> ### * goodness.metaMDS -> -> flush(stderr()); flush(stdout()) -> -> ### Name: goodness.metaMDS -> ### Title: Goodness of Fit and Shepard Plot for Nonmetric Multidimensional -> ### Scaling -> ### Aliases: goodness.metaMDS goodness.monoMDS stressplot -> ### stressplot.default stressplot.monoMDS -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(varespec) -> mod <- metaMDS(varespec) -Square root transformation -Wisconsin double standardization -Run 0 stress 0.1843196 -Run 1 stress 0.2455911 -Run 2 stress 0.2169404 -Run 3 stress 0.2313231 -Run 4 stress 0.1974406 -Run 5 stress 0.1858401 -Run 6 stress 0.1948413 -Run 7 stress 0.2265716 -Run 8 stress 0.2104573 -Run 9 stress 0.1962451 -Run 10 stress 0.2673136 -Run 11 stress 0.1976151 -Run 12 stress 0.1852397 -Run 13 stress 0.2341081 -Run 14 stress 0.1955837 -Run 15 stress 0.2137396 -Run 16 stress 0.2109613 -Run 17 stress 0.1825658 -... New best solution -... Procrustes: rmse 0.04163108 max resid 0.1518283 -Run 18 stress 0.1843196 -Run 19 stress 0.2570114 -Run 20 stress 0.3760489 -*** Best solution was not repeated -- monoMDS stopping criteria: - 20: stress ratio > sratmax -> stressplot(mod) -> gof <- goodness(mod) -> gof - [1] 0.02984509 0.03513713 0.04189022 0.04598306 0.04003163 0.03441492 - [7] 0.03294805 0.03050081 0.03060723 0.02994055 0.03526429 0.02621404 -[13] 0.03831063 0.02980886 0.03369757 0.02225859 0.03561516 0.03505229 -[19] 0.06577486 0.03268415 0.03503187 0.02956635 0.05167876 0.04602055 -> plot(mod, display = "sites", type = "n") -> points(mod, display = "sites", cex = 2*gof/mean(gof)) -> -> -> -> cleanEx() -> nameEx("indpower") -> ### * indpower -> -> flush(stderr()); flush(stdout()) -> -> ### Name: indpower -> ### Title: Indicator Power of Species -> ### Aliases: indpower -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(dune) -> ## IP values -> ip <- indpower(dune) -> ## and TIP values -> diag(ip) <- NA -> (TIP <- rowMeans(ip, na.rm=TRUE)) -i.Achimill i.Agrostol i.Airaprae i.Alopgeni i.Anthodor i.Bellpere i.Bromhord - 0.3186250 0.3342800 0.2168133 0.3416198 0.3567884 0.3432281 0.3665632 -i.Chenalbu i.Cirsarve i.Comapalu i.Eleopalu i.Elymrepe i.Empenigr i.Hyporadi - 0.2095044 0.2781640 0.1713273 0.2414787 0.3263516 0.2016196 0.2378197 -i.Juncarti i.Juncbufo i.Lolipere i.Planlanc i.Poaprat i.Poatriv i.Ranuflam - 0.2915850 0.3331330 0.3998442 0.3426064 0.4094319 0.3929520 0.2663080 -i.Rumeacet i.Sagiproc i.Salirepe i.Scorautu i.Trifprat i.Trifrepe i.Vicilath - 0.3484684 0.3788905 0.2898512 0.4362493 0.3145854 0.4503764 0.2605349 -i.Bracruta i.Callcusp - 0.4252676 0.2070766 -> -> ## p value calculation for a species -> ## from Halme et al. 2009 -> ## i is ID for the species -> i <- 1 -> fun <- function(x, i) indpower(x)[i,-i] -> ## 'c0' randomizes species occurrences -> os <- oecosimu(dune, fun, "c0", i=i, nsimul=99) -Warning in oecosimu(dune, fun, "c0", i = i, nsimul = 99) : - nullmodel transformed 'comm' to binary data -> ## get z values from oecosimu output -> z <- os$oecosimu$z -> ## p-value -> (p <- sum(z) / sqrt(length(z))) -[1] -1.744972 -> ## 'heterogeneity' measure -> (chi2 <- sum((z - mean(z))^2)) -[1] 100.9547 -> pchisq(chi2, df=length(z)-1) -[1] 1 -> ## Halme et al.'s suggested output -> out <- c(TIP=TIP[i], -+ significance=p, -+ heterogeneity=chi2, -+ minIP=min(fun(dune, i=i)), -+ varIP=sd(fun(dune, i=i)^2)) -> out -TIP.i.Achimill significance heterogeneity minIP varIP - 0.3186250 -1.7449718 100.9546945 0.0000000 0.2142097 -> -> -> -> cleanEx() -> nameEx("influence.cca") -> ### * influence.cca -> -> flush(stderr()); flush(stdout()) -> -> ### Name: influence.cca -> ### Title: Linear Model Diagnostics for Constrained Ordination -> ### Aliases: hatvalues.cca hatvalues.rda sigma.cca rstandard.cca -> ### rstudent.cca cooks.distance.cca SSD.cca vcov.cca qr.cca -> ### df.residual.cca -> ### Keywords: models multivariate -> -> ### ** Examples -> -> -> data(varespec, varechem) -> mod <- cca(varespec ~ Al + P + K, varechem) -> ## leverage -> hatvalues(mod) - 18 15 24 27 23 19 22 -0.06904416 0.06666628 0.15245083 0.18944882 0.09291510 0.05122338 0.15309307 - 16 28 13 14 20 25 7 -0.09605909 0.27139695 0.75889765 0.04958141 0.06582891 0.10590183 0.20630888 - 5 6 3 4 2 9 12 -0.19797654 0.16280522 0.22738889 0.30915530 0.15557066 0.14855598 0.09046701 - 10 11 21 -0.12745850 0.10984996 0.14195559 -> plot(hatvalues(mod), type = "h") -> ## ordination plot with leverages: points with high leverage have -> ## similar LC and WA scores -> plot(mod, type = "n") -> ordispider(mod) # segment from LC to WA scores -> points(mod, dis="si", cex=5*hatvalues(mod), pch=21, bg=2) # WA scores -> text(mod, dis="bp", col=4) -> -> ## deviation and influence -> head(rstandard(mod)) - Callvulg Empenigr Rhodtome Vaccmyrt Vaccviti Pinusylv -18 0.4084518 0.9442480 -0.68178124 -0.798241724 0.9883838 -0.3086868 -15 -1.3902462 -1.5717947 -0.70784872 -0.645563228 0.2353736 -0.1679226 -24 0.9622453 -0.9520875 -0.08884556 -0.654099911 0.2420416 0.4832198 -27 -1.1080099 1.0938951 1.70146427 -0.196668562 -0.3937467 -0.7424140 -23 0.3979939 1.3218254 -0.63872221 -1.003315524 1.8996365 -0.4495408 -19 -1.5874575 0.7894087 -0.59609083 -0.006142973 0.1334143 -0.1060450 - Descflex Betupube Vacculig Diphcomp Dicrsp Dicrfusc -18 -0.5785258 -0.4585683 0.7640788 4.3748349 -0.39301720 -0.656213958 -15 -0.5416812 -0.4594716 -0.3410155 -0.2704388 -0.05769657 0.406022095 -24 -0.6409619 0.1908003 0.0198320 -0.2175720 3.75416938 -0.009140093 -27 4.2976822 -0.2704153 0.9211453 -0.2037075 -0.84410200 -0.712968237 -23 -0.8356637 -0.2779318 -0.0206861 -0.2899895 -0.67773316 -0.294674408 -19 -0.4453843 -0.3739569 -0.3174207 -0.2429740 -0.14281646 -0.819230368 - Dicrpoly Hylosple Pleuschr Polypili Polyjuni Polycomm -18 -0.4933634 -0.6030042 -1.3812122 -0.07430854 -0.5332731 -0.7140513 -15 -0.3630434 -0.4055353 1.9930791 0.02126658 -0.2274864 -0.6730241 -24 2.2312025 -1.3907968 0.5792314 -0.45358405 -0.4628096 -0.2153846 -27 -0.5715008 1.6310289 0.8124329 -0.34628172 -0.8630615 0.9423113 -23 -0.4684368 -1.1995321 -0.8241477 -0.04953929 0.7890327 -0.6774675 -19 -0.3186606 -0.3948224 0.6180114 0.05035990 0.8260214 2.3626483 - Pohlnuta Ptilcili Barbhatc Cladarbu Cladrang Cladstel -18 0.2918311 -0.42027512 -0.40191333 1.5303054 0.85056948 -0.2218833 -15 -0.6168627 -0.47096984 -0.42715787 0.1758993 -0.45409579 -0.3739920 -24 1.9274063 0.09984384 0.21066100 0.1668363 -0.08508535 -1.2835676 -27 -1.5729552 -0.31944598 -0.09167396 -0.1864165 0.51080623 -0.1083797 -23 0.4875575 0.61798970 -0.18848086 0.5574309 0.28079468 -0.4026464 -19 -0.1141521 -0.25344373 -0.31179839 -0.2391669 -0.65577452 0.6584127 - Cladunci Cladcocc Cladcorn Cladgrac Cladfimb Cladcris -18 -0.39796095 0.93836573 -0.2564543 0.33864378 1.1572584 -0.2083305 -15 0.06761526 0.24340663 -0.1767166 0.27491203 1.0721632 1.9724410 -24 1.24902375 -0.98471253 -0.4801382 2.51184311 -1.4063518 -0.3084304 -27 -0.59021669 -1.25354423 -0.2460447 -1.09351514 -1.1681499 -1.0337232 -23 -0.34604539 -0.10730202 3.9477300 2.51924664 0.3536280 3.3882402 -19 -0.33866721 0.02698153 0.1776632 0.03968833 -0.7512944 -0.4763562 - Cladchlo Cladbotr Cladamau Cladsp Cetreric Cetrisla -18 -0.5711604 -0.4914716 4.0852019 0.2489284 -0.4428064 -0.5834462 -15 -0.4347061 -0.6517740 -0.3155708 -0.2568784 0.2369559 -0.3468005 -24 0.6013607 0.4603779 -0.1576900 -0.5995616 2.7826114 0.3931826 -27 -0.5436659 -0.2788962 -0.1606997 0.1557879 -0.7298364 -0.5867612 -23 0.1029999 0.6494142 -0.3415411 -0.2330698 -0.6309632 -0.5301977 -19 0.2793712 -0.1315438 -0.2705486 -0.2865837 -0.4664078 -0.5056846 - Flavniva Nepharct Stersp Peltapht Icmaeric Cladcerv -18 0.30428187 -0.3624631 -0.23665431 -0.1571633 -0.630333375 0.12058739 -15 0.17345018 -0.1919943 0.05469573 -0.3233311 -0.561177494 0.08518455 -24 -0.74154401 -0.4146848 -0.05500461 -0.7609417 0.255058737 -0.92761801 -27 0.11301489 -0.5064006 -0.08681568 -0.1247151 -0.001277338 -0.04038189 -23 0.09411988 -0.4627811 0.47668055 3.5826478 -0.274664798 -0.05517988 -19 0.07211309 -0.1693122 -0.17244475 -0.3155345 -0.461532920 -0.02709075 - Claddefo Cladphyl -18 -0.43581630 -0.2098378 -15 0.94176661 -0.1028102 -24 -0.07508682 -1.0479632 -27 -1.06110299 -0.4908554 -23 2.66430575 -0.4244333 -19 -0.08427954 -0.1692474 -> head(cooks.distance(mod)) - Callvulg Empenigr Rhodtome Vaccmyrt Vaccviti Pinusylv -18 0.003093283 0.01653142 0.0086184263 1.181427e-02 0.0181129462 0.0017667454 -15 0.034513793 0.04411649 0.0089472619 7.441951e-03 0.0009892926 0.0005035324 -24 0.041636714 0.04076229 0.0003549575 1.923947e-02 0.0026344196 0.0105001237 -27 0.071736260 0.06992022 0.1691597848 2.260067e-03 0.0090591037 0.0322065174 -23 0.004056312 0.04474315 0.0104472601 2.577825e-02 0.0924100906 0.0051750754 -19 0.034013281 0.00841101 0.0047958896 5.093326e-07 0.0002402422 0.0001517834 - Descflex Betupube Vacculig Diphcomp Dicrsp Dicrfusc -18 0.006205594 0.003898934 1.082466e-02 0.3548634058 2.863921e-03 7.984152e-03 -15 0.005239584 0.003769873 2.076622e-03 0.0013060122 5.944416e-05 2.943802e-03 -24 0.018474359 0.001637053 1.768633e-05 0.0021286828 6.337714e-01 3.756697e-06 -27 1.079245024 0.004272814 4.958014e-02 0.0024247421 4.163335e-02 2.970242e-02 -23 0.017883042 0.001978130 1.095811e-05 0.0021534900 1.176240e-02 2.223634e-03 -19 0.002677405 0.001887502 1.359924e-03 0.0007968265 2.752966e-04 9.058502e-03 - Dicrpoly Hylosple Pleuschr Polypili Polyjuni Polycomm -18 0.004513066 0.006741841 0.035371924 1.023801e-04 0.0052727512 0.009453588 -15 0.002353565 0.002936747 0.070934636 8.076156e-06 0.0009241023 0.008088546 -24 0.223863289 0.086982577 0.015087217 9.251676e-03 0.0096318471 0.002086096 -27 0.019084693 0.155444288 0.038567940 7.006653e-03 0.0435246182 0.051884812 -23 0.005619275 0.036846999 0.017393559 6.284604e-05 0.0159429407 0.011753178 -19 0.001370570 0.002104010 0.005155103 3.423056e-05 0.0092093061 0.075342921 - Pohlnuta Ptilcili Barbhatc Cladarbu Cladrang -18 0.0015790689 0.0032749544 0.0029950405 0.0434204290 0.0134139742 -15 0.0067949512 0.0039609143 0.0032582625 0.0005525065 0.0036821731 -24 0.1670519112 0.0004482780 0.0019955986 0.0012516596 0.0003255476 -27 0.1445719869 0.0059627459 0.0004910701 0.0020305802 0.0152462776 -23 0.0060873754 0.0097800450 0.0009097308 0.0079572035 0.0020190921 -19 0.0001758783 0.0008669766 0.0013121758 0.0007720518 0.0058043470 - Cladstel Cladunci Cladcocc Cladcorn Cladgrac Cladfimb -18 0.0009128242 2.936424e-03 1.632609e-02 0.0012194323 2.126298e-03 0.024831249 -15 0.0024976637 8.163919e-05 1.057972e-03 0.0005576530 1.349574e-03 0.020527262 -24 0.0740870642 7.015301e-02 4.360375e-02 0.0103666250 2.837200e-01 0.088939118 -27 0.0006863532 2.035516e-02 9.181862e-02 0.0035373629 6.987166e-02 0.079734929 -23 0.0041517010 3.066511e-03 2.948453e-04 0.3990922140 1.625248e-01 0.003202372 -19 0.0058511426 1.548070e-03 9.826017e-06 0.0004260291 2.126033e-05 0.007618415 - Cladcris Cladchlo Cladbotr Cladamau Cladsp Cetreric -18 0.0008047178 0.0060485887 0.0044785217 0.3094317912 0.001148912 0.003635513 -15 0.0694732020 0.0033744318 0.0075858327 0.0017782910 0.001178323 0.001002639 -24 0.0042777886 0.0162620357 0.0095308986 0.0011181833 0.016164882 0.348184969 -27 0.0624395810 0.0172709295 0.0045450274 0.0015089732 0.001418140 0.031124511 -23 0.2939860714 0.0002716767 0.0107999564 0.0029872002 0.001391075 0.010194981 -19 0.0030627243 0.0010534342 0.0002335528 0.0009879496 0.001108529 0.002936134 - Cetrisla Flavniva Nepharct Stersp Peltapht Icmaeric -18 0.006311601 1.716683e-03 0.0024359336 1.038405e-03 0.0004579733 7.366793e-03 -15 0.002147676 5.372282e-04 0.0006582422 5.342149e-05 0.0018668272 5.623539e-03 -24 0.006951741 2.472742e-02 0.0077328775 1.360514e-04 0.0260380002 2.925400e-03 -27 0.020117510 7.463161e-04 0.0149844191 4.404005e-04 0.0009088445 9.533741e-08 -23 0.007198701 2.268512e-04 0.0054844061 5.818798e-03 0.3286900860 1.931899e-03 -19 0.003451467 7.018956e-05 0.0003869197 4.013694e-04 0.0013438101 2.875078e-03 - Cladcerv Claddefo Cladphyl -18 2.696135e-04 3.521639e-03 0.0008164040 -15 1.295779e-04 1.583784e-02 0.0001887477 -24 3.869397e-02 2.535317e-04 0.0493852158 -27 9.528504e-05 6.579101e-02 0.0140785723 -23 7.797221e-05 1.817802e-01 0.0046131462 -19 9.905729e-06 9.587131e-05 0.0003866237 -> -> ## Influence measures from lm -> y <- decostand(varespec, "chi.square") # needed in cca -> y1 <- with(y, Cladstel) # take one species for lm -> lmod1 <- lm(y1 ~ Al + P + K, varechem, weights = rowSums(varespec)) -> ## numerically identical within 2e-15 -> all(abs(cooks.distance(lmod1) - cooks.distance(mod)[, "Cladstel"]) < 1e-8) -[1] TRUE -> -> ## t-values of regression coefficients based on type = "canoco" -> ## residuals -> coef(mod) - CCA1 CCA2 CCA3 -Al 0.007478556 -0.001883637 0.003380774 -P -0.006491081 -0.102189737 -0.022306682 -K -0.006755568 0.015343662 0.017067351 -> coef(mod)/sqrt(diag(vcov(mod, type = "canoco"))) - CCA1 CCA2 CCA3 -Al 6.5615451 -1.397643 3.313629 -P -0.4576132 -6.092557 -1.756774 -K -2.0862129 4.007159 5.887926 -> -> -> -> cleanEx() -> nameEx("isomap") -> ### * isomap -> -> flush(stderr()); flush(stdout()) -> -> ### Name: isomap -> ### Title: Isometric Feature Mapping Ordination -> ### Aliases: isomap isomapdist plot.isomap summary.isomap -> ### Keywords: multivariate -> -> ### ** Examples -> -> ## The following examples also overlay minimum spanning tree to -> ## the graphics in red. -> op <- par(mar=c(4,4,1,1)+0.2, mfrow=c(2,2)) -> data(BCI) -> dis <- vegdist(BCI) -> tr <- spantree(dis) -> pl <- ordiplot(cmdscale(dis), main="cmdscale") -species scores not available -> lines(tr, pl, col="red") -> ord <- isomap(dis, k=3) -> ord - -Isometric Feature Mapping (isomap) - -Call: -isomap(dist = dis, k = 3) - -Distance method: bray shortest isomap -Criterion: k = 3 -> pl <- plot(ord, main="isomap k=3") -> lines(tr, pl, col="red") -> pl <- plot(isomap(dis, k=5), main="isomap k=5") -> lines(tr, pl, col="red") -> pl <- plot(isomap(dis, epsilon=0.45), main="isomap epsilon=0.45") -> lines(tr, pl, col="red") -> par(op) -> ## colour points and web by the dominant species -> dom <- apply(BCI, 1, which.max) -> ## need nine colours, but default palette has only eight -> op <- palette(c(palette("default"), "sienna")) -> plot(ord, pch = 16, col = dom, n.col = dom) -> palette(op) -> -> -> -> graphics::par(get("par.postscript", pos = 'CheckExEnv')) -> cleanEx() -> nameEx("kendall.global") -> ### * kendall.global -> -> flush(stderr()); flush(stdout()) -> -> ### Name: kendall.global -> ### Title: Kendall coefficient of concordance -> ### Aliases: kendall.global kendall.post -> ### Keywords: multivariate nonparametric -> -> ### ** Examples -> -> data(mite) -> mite.hel <- decostand(mite, "hel") -> -> # Reproduce the results shown in Table 2 of Legendre (2005), a single group -> mite.small <- mite.hel[c(4,9,14,22,31,34,45,53,61,69),c(13:15,23)] -> kendall.global(mite.small, nperm=49) -$Concordance_analysis - Group.1 -W 0.44160305 -F 2.37252221 -Prob.F 0.04403791 -Chi2 15.89770992 -Prob.perm 0.06000000 - -attr(,"class") -[1] "kendall.global" -> kendall.post(mite.small, mult="holm", nperm=49) -$A_posteriori_tests - TVEL ONOV SUCT Trhypch1 -Spearman.mean 0.3265678 0.3965503 0.4570402 -0.1681251 -W.per.species 0.4949258 0.5474127 0.5927802 0.1239061 -Prob 0.0800000 0.0600000 0.0200000 0.6800000 -Corrected prob 0.1800000 0.1800000 0.0800000 0.6800000 - -$Correction.type -[1] "holm" - -attr(,"class") -[1] "kendall.post" -> -> # Reproduce the results shown in Tables 3 and 4 of Legendre (2005), 2 groups -> group <-c(1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,2,1,2,1,1,1,1,2,1,2,1,1,1,1,1,2,2,2,2,2) -> kendall.global(mite.hel, group=group, nperm=49) -$Concordance_analysis - Group.1 Group.2 -W 3.097870e-01 2.911888e-01 -F 1.032305e+01 4.108130e+00 -Prob.F 1.177138e-85 4.676566e-22 -Corrected prob.F 2.354275e-85 4.676566e-22 -Chi2 5.130073e+02 2.210123e+02 -Prob.perm 2.000000e-02 2.000000e-02 -Corrected prob.perm 4.000000e-02 4.000000e-02 - -$Correction.type -[1] "holm" - -attr(,"class") -[1] "kendall.global" -> kendall.post(mite.hel, group=group, mult="holm", nperm=49) -$A_posteriori_tests_Group -$A_posteriori_tests_Group[[1]] - Brachy PHTH RARD SSTR Protopl MEGR -Spearman.mean 0.1851177 0.4258111 0.359058 0.2505486 0.1802160 0.2833298 -W.per.species 0.2190711 0.4497357 0.385764 0.2817757 0.2143736 0.3131911 -Prob 0.0400000 0.0200000 0.020000 0.0200000 0.0200000 0.0200000 -Corrected prob 0.7000000 0.7000000 0.700000 0.7000000 0.7000000 0.7000000 - MPRO HMIN HMIN2 NPRA TVEL ONOV -Spearman.mean 0.09248024 0.2444656 0.4138494 0.1263751 0.4177343 0.3301159 -W.per.species 0.13029357 0.2759462 0.4382723 0.1627761 0.4419954 0.3580278 -Prob 0.06000000 0.0200000 0.0200000 0.0400000 0.0200000 0.0200000 -Corrected prob 0.70000000 0.7000000 0.7000000 0.7000000 0.7000000 0.7000000 - SUCT Oribatl1 PWIL Galumna1 Stgncrs2 HRUF -Spearman.mean 0.2185421 0.421216 0.2574779 0.4180699 0.3623428 0.1250230 -W.per.species 0.2511028 0.445332 0.2884163 0.4423170 0.3889118 0.1614804 -Prob 0.0200000 0.020000 0.0200000 0.0200000 0.0200000 0.0400000 -Corrected prob 0.7000000 0.700000 0.7000000 0.7000000 0.7000000 0.7000000 - PPEL SLAT FSET Lepidzts Eupelops Miniglmn -Spearman.mean 0.2188216 0.3016159 0.4217606 0.2577037 0.1108022 0.2301430 -W.per.species 0.2513707 0.3307153 0.4458539 0.2886327 0.1478521 0.2622203 -Prob 0.0400000 0.0200000 0.0200000 0.0200000 0.1200000 0.0200000 -Corrected prob 0.7000000 0.7000000 0.7000000 0.7000000 0.7000000 0.7000000 - -$A_posteriori_tests_Group[[2]] - HPAV TVIE LCIL Ceratoz1 Trhypch1 NCOR -Spearman.mean 0.1222579 0.2712078 0.1906408 0.1375601 0.1342409 0.3342345 -W.per.species 0.2020527 0.3374616 0.2642189 0.2159637 0.2129463 0.3947586 -Prob 0.0600000 0.0200000 0.0400000 0.0200000 0.0200000 0.0200000 -Corrected prob 0.7000000 0.7000000 0.7000000 0.7000000 0.7000000 0.7000000 - LRUG PLAG2 Ceratoz3 Oppiminu Trimalc2 -Spearman.mean 0.3446561 0.1833099 0.3188922 0.1764232 0.2498877 -W.per.species 0.4042328 0.2575544 0.3808111 0.2512938 0.3180797 -Prob 0.0200000 0.0200000 0.0200000 0.0200000 0.0200000 -Corrected prob 0.7000000 0.7000000 0.7000000 0.7000000 0.7000000 - - -$Correction.type -[1] "holm" - -attr(,"class") -[1] "kendall.post" -> -> # NOTE: 'nperm' argument usually needs to be larger than 49. -> # It was set to this low value for demonstration purposes. -> -> -> -> cleanEx() -> nameEx("linestack") -> ### * linestack -> -> flush(stderr()); flush(stdout()) -> -> ### Name: linestack -> ### Title: Plots One-dimensional Diagrams without Overwriting Labels -> ### Aliases: linestack -> ### Keywords: hplot aplot -> -> ### ** Examples -> -> ## First DCA axis -> data(dune) -> ord <- decorana(dune) -> linestack(scores(ord, choices=1, display="sp")) -> linestack(scores(ord, choices=1, display="si"), side="left", add=TRUE) -> title(main="DCA axis 1") -> -> ## Expressions as labels -> N <- 10 # Number of sites -> df <- data.frame(Ca = rlnorm(N, 2), NO3 = rlnorm(N, 4), -+ SO4 = rlnorm(N, 10), K = rlnorm(N, 3)) -> ord <- rda(df, scale = TRUE) -> ### vector of expressions for labels -> labs <- expression(Ca^{2+phantom()}, -+ NO[3]^{-phantom()}, -+ SO[4]^{2-phantom()}, -+ K^{+phantom()}) -> scl <- "sites" -> linestack(scores(ord, choices = 1, display = "species", scaling = scl), -+ labels = labs, air = 2) -> linestack(scores(ord, choices = 1, display = "site", scaling = scl), -+ side = "left", add = TRUE) -> title(main = "PCA axis 1") -> -> -> -> cleanEx() -> nameEx("make.cepnames") -> ### * make.cepnames -> -> flush(stderr()); flush(stdout()) -> -> ### Name: make.cepnames -> ### Title: Abbreviates a Botanical or Zoological Latin Name into an -> ### Eight-character Name -> ### Aliases: make.cepnames -> ### Keywords: character -> -> ### ** Examples -> -> make.cepnames(c("Aa maderoi", "Poa sp.", "Cladina rangiferina", -+ "Cladonia cornuta", "Cladonia cornuta var. groenlandica", -+ "Cladonia rangiformis", "Bryoerythrophyllum")) -[1] "Aamade" "Poasp" "Cladrang" "Cladcorn" "Cladgroe" -[6] "Cladrang.1" "Bryrythr" -> data(BCI) -> colnames(BCI) <- make.cepnames(colnames(BCI)) -> -> -> -> cleanEx() -> nameEx("mantel") -> ### * mantel -> -> flush(stderr()); flush(stdout()) -> -> ### Name: mantel -> ### Title: Mantel and Partial Mantel Tests for Dissimilarity Matrices -> ### Aliases: mantel mantel.partial -> ### Keywords: multivariate htest -> -> ### ** Examples -> -> ## Is vegetation related to environment? -> data(varespec) -> data(varechem) -> veg.dist <- vegdist(varespec) # Bray-Curtis -> env.dist <- vegdist(scale(varechem), "euclid") -> mantel(veg.dist, env.dist) - -Mantel statistic based on Pearson's product-moment correlation - -Call: -mantel(xdis = veg.dist, ydis = env.dist) - -Mantel statistic r: 0.3047 - Significance: 0.001 - -Upper quantiles of permutations (null model): - 90% 95% 97.5% 99% -0.108 0.144 0.172 0.209 -Permutation: free -Number of permutations: 999 - -> mantel(veg.dist, env.dist, method="spear") - -Mantel statistic based on Spearman's rank correlation rho - -Call: -mantel(xdis = veg.dist, ydis = env.dist, method = "spear") - -Mantel statistic r: 0.2838 - Significance: 0.004 - -Upper quantiles of permutations (null model): - 90% 95% 97.5% 99% -0.109 0.144 0.171 0.207 -Permutation: free -Number of permutations: 999 - -> -> -> -> cleanEx() -> nameEx("mantel.correlog") -> ### * mantel.correlog -> -> flush(stderr()); flush(stdout()) -> -> ### Name: mantel.correlog -> ### Title: Mantel Correlogram -> ### Aliases: mantel.correlog plot.mantel.correlog -> ### Keywords: multivariate -> -> ### ** Examples -> -> # Mite data available in "vegan" -> data(mite) -> data(mite.xy) -> mite.hel <- decostand(mite, "hellinger") -> -> # Detrend the species data by regression on the site coordinates -> mite.hel.resid <- resid(lm(as.matrix(mite.hel) ~ ., data=mite.xy)) -> -> # Compute the detrended species distance matrix -> mite.hel.D <- dist(mite.hel.resid) -> -> # Compute Mantel correlogram with cutoff, Pearson statistic -> mite.correlog <- mantel.correlog(mite.hel.D, XY=mite.xy, nperm=49) -> summary(mite.correlog) - Length Class Mode -mantel.res 65 -none- numeric -n.class 1 -none- numeric -break.pts 14 -none- numeric -mult 1 -none- character -n.tests 1 -none- numeric -call 4 -none- call -> mite.correlog - -Mantel Correlogram Analysis - -Call: - -mantel.correlog(D.eco = mite.hel.D, XY = mite.xy, nperm = 49) - - class.index n.dist Mantel.cor Pr(Mantel) Pr(corrected) -D.cl.1 0.514182 358.000000 0.135713 0.02 0.02 * -D.cl.2 1.242546 650.000000 0.118174 0.02 0.04 * -D.cl.3 1.970910 796.000000 0.037820 0.06 0.06 . -D.cl.4 2.699274 696.000000 -0.098605 0.02 0.08 . -D.cl.5 3.427638 500.000000 -0.112682 0.02 0.10 . -D.cl.6 4.156002 468.000000 -0.107603 0.02 0.12 -D.cl.7 4.884366 364.000000 -0.022264 0.16 0.16 -D.cl.8 5.612730 326.000000 NA NA NA -D.cl.9 6.341094 260.000000 NA NA NA -D.cl.10 7.069458 184.000000 NA NA NA -D.cl.11 7.797822 130.000000 NA NA NA -D.cl.12 8.526186 66.000000 NA NA NA -D.cl.13 9.254550 32.000000 NA NA NA ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> # or: print(mite.correlog) -> # or: print.mantel.correlog(mite.correlog) -> plot(mite.correlog) -> -> # Compute Mantel correlogram without cutoff, Spearman statistic -> mite.correlog2 <- mantel.correlog(mite.hel.D, XY=mite.xy, cutoff=FALSE, -+ r.type="spearman", nperm=49) -> summary(mite.correlog2) - Length Class Mode -mantel.res 65 -none- numeric -n.class 1 -none- numeric -break.pts 14 -none- numeric -mult 1 -none- character -n.tests 1 -none- numeric -call 6 -none- call -> mite.correlog2 - -Mantel Correlogram Analysis - -Call: - -mantel.correlog(D.eco = mite.hel.D, XY = mite.xy, cutoff = FALSE, r.type = "spearman", nperm = 49) - - class.index n.dist Mantel.cor Pr(Mantel) Pr(corrected) -D.cl.1 0.514182 358.000000 0.134229 0.02 0.02 * -D.cl.2 1.242546 650.000000 0.121270 0.02 0.04 * -D.cl.3 1.970910 796.000000 0.035413 0.08 0.08 . -D.cl.4 2.699274 696.000000 -0.095899 0.02 0.08 . -D.cl.5 3.427638 500.000000 -0.118692 0.02 0.10 . -D.cl.6 4.156002 468.000000 -0.117148 0.02 0.12 -D.cl.7 4.884366 364.000000 -0.031123 0.04 0.14 -D.cl.8 5.612730 326.000000 0.026064 0.12 0.16 -D.cl.9 6.341094 260.000000 0.050573 0.02 0.18 -D.cl.10 7.069458 184.000000 0.057017 0.02 0.20 -D.cl.11 7.797822 130.000000 0.036195 0.04 0.22 -D.cl.12 8.526186 66.000000 -0.054242 0.06 0.24 -D.cl.13 9.254550 32.000000 -0.066677 0.02 0.26 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> plot(mite.correlog2) -> -> # NOTE: 'nperm' argument usually needs to be larger than 49. -> # It was set to this low value for demonstration purposes. -> -> -> -> -> cleanEx() -> nameEx("metaMDS") -> ### * metaMDS -> -> flush(stderr()); flush(stdout()) -> -> ### Name: metaMDS -> ### Title: Nonmetric Multidimensional Scaling with Stable Solution from -> ### Random Starts, Axis Scaling and Species Scores -> ### Aliases: metaMDS metaMDSdist metaMDSiter metaMDSredist initMDS postMDS -> ### plot.metaMDS points.metaMDS text.metaMDS scores.metaMDS -> ### Keywords: multivariate -> -> ### ** Examples -> -> ## The recommended way of running NMDS (Minchin 1987) -> ## -> data(dune) -> ## IGNORE_RDIFF_BEGIN -> ## Global NMDS using monoMDS -> sol <- metaMDS(dune) -Run 0 stress 0.1192678 -Run 1 stress 0.1886532 -Run 2 stress 0.1192678 -... Procrustes: rmse 5.822835e-06 max resid 1.845818e-05 -... Similar to previous best -Run 3 stress 0.1192678 -... Procrustes: rmse 6.697234e-06 max resid 2.061976e-05 -... Similar to previous best -Run 4 stress 0.1183186 -... New best solution -... Procrustes: rmse 0.02027078 max resid 0.06496407 -Run 5 stress 0.1192679 -Run 6 stress 0.1939202 -Run 7 stress 0.1808911 -Run 8 stress 0.1183186 -... New best solution -... Procrustes: rmse 1.651369e-06 max resid 5.655239e-06 -... Similar to previous best -Run 9 stress 0.1192678 -Run 10 stress 0.1183186 -... Procrustes: rmse 1.505928e-06 max resid 4.480433e-06 -... Similar to previous best -Run 11 stress 0.1192679 -Run 12 stress 0.1192678 -Run 13 stress 0.1886532 -Run 14 stress 0.1183186 -... Procrustes: rmse 1.665347e-05 max resid 5.474507e-05 -... Similar to previous best -Run 15 stress 0.1192678 -Run 16 stress 0.1183186 -... Procrustes: rmse 5.869596e-06 max resid 1.970358e-05 -... Similar to previous best -Run 17 stress 0.2075713 -Run 18 stress 0.1192678 -Run 19 stress 0.1192679 -Run 20 stress 0.1183186 -... Procrustes: rmse 7.276516e-06 max resid 1.734809e-05 -... Similar to previous best -*** Best solution repeated 5 times -> sol - -Call: -metaMDS(comm = dune) - -global Multidimensional Scaling using monoMDS - -Data: dune -Distance: bray - -Dimensions: 2 -Stress: 0.1183186 -Stress type 1, weak ties -Best solution was repeated 5 time(s) in 20 tries -The best solution was from try 8 (random start) -Scaling: centring, PC rotation, halfchange scaling -Species: expanded scores based on ‘dune’ - -> plot(sol, type="t") -> ## Start from previous best solution -> sol <- metaMDS(dune, previous.best = sol) -Starting from 2-dimensional configuration -Run 0 stress 0.1183186 -Run 1 stress 0.1183186 -... New best solution -... Procrustes: rmse 6.592553e-06 max resid 2.026403e-05 -... Similar to previous best -Run 2 stress 0.1812935 -Run 3 stress 0.1183186 -... Procrustes: rmse 4.27681e-06 max resid 1.352647e-05 -... Similar to previous best -Run 4 stress 0.1192678 -Run 5 stress 0.1192678 -Run 6 stress 0.1183186 -... Procrustes: rmse 2.276086e-06 max resid 7.260292e-06 -... Similar to previous best -Run 7 stress 0.1183186 -... New best solution -... Procrustes: rmse 2.111216e-06 max resid 6.785766e-06 -... Similar to previous best -Run 8 stress 0.1192678 -Run 9 stress 0.1183186 -... Procrustes: rmse 8.198219e-06 max resid 2.150265e-05 -... Similar to previous best -Run 10 stress 0.1183186 -... Procrustes: rmse 3.222973e-05 max resid 9.837238e-05 -... Similar to previous best -Run 11 stress 0.1183186 -... Procrustes: rmse 9.836666e-06 max resid 3.27482e-05 -... Similar to previous best -Run 12 stress 0.1183186 -... Procrustes: rmse 2.659083e-05 max resid 8.216893e-05 -... Similar to previous best -Run 13 stress 0.1192678 -Run 14 stress 0.1183186 -... Procrustes: rmse 2.801942e-05 max resid 9.121405e-05 -... Similar to previous best -Run 15 stress 0.1192678 -Run 16 stress 0.1183186 -... Procrustes: rmse 1.230098e-05 max resid 4.079838e-05 -... Similar to previous best -Run 17 stress 0.1192679 -Run 18 stress 0.1192678 -Run 19 stress 0.1192679 -Run 20 stress 0.1809577 -*** Best solution repeated 7 times -> ## Local NMDS and stress 2 of monoMDS -> sol2 <- metaMDS(dune, model = "local", stress=2) -Run 0 stress 0.1928478 -Run 1 stress 0.1928475 -... New best solution -... Procrustes: rmse 0.0001176864 max resid 0.0003465431 -... Similar to previous best -Run 2 stress 0.1928476 -... Procrustes: rmse 0.0003230671 max resid 0.0009395776 -... Similar to previous best -Run 3 stress 0.192849 -... Procrustes: rmse 0.0006536789 max resid 0.001926441 -... Similar to previous best -Run 4 stress 0.1928475 -... New best solution -... Procrustes: rmse 7.245208e-05 max resid 0.0002138775 -... Similar to previous best -Run 5 stress 0.1928478 -... Procrustes: rmse 0.0003528988 max resid 0.000994985 -... Similar to previous best -Run 6 stress 0.1928478 -... Procrustes: rmse 0.0003262433 max resid 0.0009223561 -... Similar to previous best -Run 7 stress 0.1928476 -... Procrustes: rmse 0.0001088032 max resid 0.0003261059 -... Similar to previous best -Run 8 stress 0.1928475 -... New best solution -... Procrustes: rmse 0.0001255324 max resid 0.0003130854 -... Similar to previous best -Run 9 stress 0.1928479 -... Procrustes: rmse 0.0002657286 max resid 0.0007827887 -... Similar to previous best -Run 10 stress 0.1928478 -... Procrustes: rmse 0.0002328617 max resid 0.0006821765 -... Similar to previous best -Run 11 stress 0.1928475 -... New best solution -... Procrustes: rmse 6.504858e-05 max resid 0.0001794597 -... Similar to previous best -Run 12 stress 0.1928475 -... Procrustes: rmse 4.196348e-05 max resid 0.0001142366 -... Similar to previous best -Run 13 stress 0.1928475 -... Procrustes: rmse 0.0001178624 max resid 0.000345921 -... Similar to previous best -Run 14 stress 0.1928475 -... Procrustes: rmse 0.0001018613 max resid 0.0002984941 -... Similar to previous best -Run 15 stress 0.1928479 -... Procrustes: rmse 0.0003213105 max resid 0.0009295638 -... Similar to previous best -Run 16 stress 0.1928476 -... Procrustes: rmse 0.0001588096 max resid 0.000458987 -... Similar to previous best -Run 17 stress 0.1928479 -... Procrustes: rmse 0.0003293185 max resid 0.000960931 -... Similar to previous best -Run 18 stress 0.1928475 -... Procrustes: rmse 0.0001481571 max resid 0.0004335513 -... Similar to previous best -Run 19 stress 0.1928476 -... Procrustes: rmse 0.000180329 max resid 0.0005048001 -... Similar to previous best -Run 20 stress 0.1928475 -... Procrustes: rmse 1.074795e-05 max resid 3.583309e-05 -... Similar to previous best -*** Best solution repeated 10 times -> sol2 - -Call: -metaMDS(comm = dune, model = "local", stress = 2) - -local Multidimensional Scaling using monoMDS - -Data: dune -Distance: bray - -Dimensions: 2 -Stress: 0.1928475 -Stress type 2, weak ties -Best solution was repeated 10 time(s) in 20 tries -The best solution was from try 11 (random start) -Scaling: centring, PC rotation, halfchange scaling -Species: expanded scores based on ‘dune’ - -> ## Use Arrhenius exponent 'z' as a binary dissimilarity measure -> sol <- metaMDS(dune, distfun = betadiver, distance = "z") -Run 0 stress 0.1067169 -Run 1 stress 0.1073148 -Run 2 stress 0.1073148 -Run 3 stress 0.1067169 -... New best solution -... Procrustes: rmse 5.139263e-06 max resid 1.72906e-05 -... Similar to previous best -Run 4 stress 0.1067169 -... Procrustes: rmse 4.498737e-06 max resid 1.408227e-05 -... Similar to previous best -Run 5 stress 0.1073148 -Run 6 stress 0.1653484 -Run 7 stress 0.1073148 -Run 8 stress 0.1067169 -... Procrustes: rmse 5.848227e-06 max resid 1.923197e-05 -... Similar to previous best -Run 9 stress 0.1073148 -Run 10 stress 0.1073148 -Run 11 stress 0.1067169 -... Procrustes: rmse 3.364993e-06 max resid 7.105337e-06 -... Similar to previous best -Run 12 stress 0.107471 -Run 13 stress 0.107471 -Run 14 stress 0.1073148 -Run 15 stress 0.107471 -Run 16 stress 0.1073148 -Run 17 stress 0.1069786 -... Procrustes: rmse 0.006774349 max resid 0.02387355 -Run 18 stress 0.1067169 -... New best solution -... Procrustes: rmse 3.536972e-06 max resid 1.241593e-05 -... Similar to previous best -Run 19 stress 0.1067169 -... Procrustes: rmse 2.356116e-06 max resid 5.608413e-06 -... Similar to previous best -Run 20 stress 0.1067169 -... Procrustes: rmse 8.175633e-07 max resid 1.839172e-06 -... Similar to previous best -*** Best solution repeated 3 times -> sol - -Call: -metaMDS(comm = dune, distance = "z", distfun = betadiver) - -global Multidimensional Scaling using monoMDS - -Data: dune -Distance: beta.z - -Dimensions: 2 -Stress: 0.1067169 -Stress type 1, weak ties -Best solution was repeated 3 time(s) in 20 tries -The best solution was from try 18 (random start) -Scaling: centring, PC rotation, halfchange scaling -Species: expanded scores based on ‘dune’ - -> ## IGNORE_RDIFF_END -> -> -> -> cleanEx() -> nameEx("mite") -> ### * mite -> -> flush(stderr()); flush(stdout()) -> -> ### Name: mite -> ### Title: Oribatid Mite Data with Explanatory Variables -> ### Aliases: mite mite.env mite.pcnm mite.xy -> ### Keywords: datasets -> -> ### ** Examples -> -> data(mite) -> -> -> -> cleanEx() -> nameEx("monoMDS") -> ### * monoMDS -> -> flush(stderr()); flush(stdout()) -> -> ### Name: monoMDS -> ### Title: Global and Local Non-metric Multidimensional Scaling and Linear -> ### and Hybrid Scaling -> ### Aliases: monoMDS scores.monoMDS plot.monoMDS points.monoMDS -> ### text.monoMDS -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(dune) -> dis <- vegdist(dune) -> m <- monoMDS(dis, model = "loc") -> m - -Call: -monoMDS(dist = dis, model = "loc") - -Local non-metric Multidimensional Scaling - -20 points, dissimilarity ‘bray’, call ‘vegdist(x = dune)’ - -Dimensions: 2 -Stress: 0.1238001 -Stress type 1, weak ties -Scores scaled to unit root mean square, rotated to principal components -Stopped after 80 iterations: Stress nearly unchanged (ratio > sratmax) -> plot(m) -> -> -> -> cleanEx() -> nameEx("mrpp") -> ### * mrpp -> -> flush(stderr()); flush(stdout()) -> -> ### Name: mrpp -> ### Title: Multi Response Permutation Procedure and Mean Dissimilarity -> ### Matrix -> ### Aliases: mrpp meandist summary.meandist plot.meandist -> ### Keywords: multivariate nonparametric htest -> -> ### ** Examples -> -> data(dune) -> data(dune.env) -> dune.mrpp <- with(dune.env, mrpp(dune, Management)) -> dune.mrpp - -Call: -mrpp(dat = dune, grouping = Management) - -Dissimilarity index: euclidean -Weights for groups: n - -Class means and counts: - - BF HF NM SF -delta 10.03 11.08 10.66 12.27 -n 3 5 6 6 - -Chance corrected within-group agreement A: 0.1246 -Based on observed delta 11.15 and expected delta 12.74 - -Significance of delta: 0.003 -Permutation: free -Number of permutations: 999 - -> -> # Save and change plotting parameters -> def.par <- par(no.readonly = TRUE) -> layout(matrix(1:2,nr=1)) -> -> plot(dune.ord <- metaMDS(dune, trace=0), type="text", display="sites" ) -> with(dune.env, ordihull(dune.ord, Management)) -> -> with(dune.mrpp, { -+ fig.dist <- hist(boot.deltas, xlim=range(c(delta,boot.deltas)), -+ main="Test of Differences Among Groups") -+ abline(v=delta); -+ text(delta, 2*mean(fig.dist$counts), adj = -0.5, -+ expression(bold(delta)), cex=1.5 ) } -+ ) -> par(def.par) -> ## meandist -> dune.md <- with(dune.env, meandist(vegdist(dune), Management)) -> dune.md - BF HF NM SF -BF 0.4159972 0.4736637 0.7296979 0.6247169 -HF 0.4736637 0.4418115 0.7217933 0.5673664 -NM 0.7296979 0.7217933 0.6882438 0.7723367 -SF 0.6247169 0.5673664 0.7723367 0.5813015 -attr(,"class") -[1] "meandist" "matrix" -attr(,"n") -grouping -BF HF NM SF - 3 5 6 6 -> summary(dune.md) - -Mean distances: - Average -within groups 0.5746346 -between groups 0.6664172 -overall 0.6456454 - -Summary statistics: - Statistic -MRPP A weights n 0.1423836 -MRPP A weights n-1 0.1339124 -MRPP A weights n(n-1) 0.1099842 -Classification strength 0.1127012 -> plot(dune.md) -> plot(dune.md, kind="histogram") -> -> -> -> graphics::par(get("par.postscript", pos = 'CheckExEnv')) -> cleanEx() -> nameEx("mso") -> ### * mso -> -> flush(stderr()); flush(stdout()) -> -> ### Name: mso -> ### Title: Functions for performing and displaying a spatial partitioning -> ### of cca or rda results -> ### Aliases: mso msoplot -> ### Keywords: spatial multivariate -> -> ### ** Examples -> -> ## Reconstruct worked example of Wagner (submitted): -> X <- matrix(c(1, 2, 3, 2, 1, 0), 3, 2) -> Y <- c(3, -1, -2) -> tmat <- c(1:3) -> ## Canonical correspondence analysis (cca): -> Example.cca <- cca(X, Y) -> Example.cca <- mso(Example.cca, tmat) -Set of permutations < 'minperm'. Generating entire set. -> msoplot(Example.cca) -> Example.cca$vario - H Dist n All Sum CA CCA se -1 1 1 2 0.25 0.3456633 0.07461735 0.2710459 0 -2 2 2 1 1.00 0.8086735 0.01147959 0.7971939 NA -> -> ## Correspondence analysis (ca): -> Example.ca <- mso(cca(X), tmat) -Set of permutations < 'minperm'. Generating entire set. -> msoplot(Example.ca) -> -> ## Unconstrained ordination with test for autocorrelation -> ## using oribatid mite data set as in Wagner (2004) -> data(mite) -> data(mite.env) -> data(mite.xy) -> -> mite.cca <- cca(log(mite + 1)) -> mite.cca <- mso(mite.cca, mite.xy, grain = 1, permutations = 99) -> msoplot(mite.cca) -> mite.cca -Call: mso(object.cca = mite.cca, object.xy = mite.xy, grain = 1, -permutations = 99) - - Inertia Rank -Total 1.164 -Unconstrained 1.164 34 -Inertia is scaled Chi-square - -Eigenvalues for unconstrained axes: - CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8 -0.3662 0.1328 0.0723 0.0658 0.0559 0.0481 0.0418 0.0391 -(Showing 8 of 34 unconstrained eigenvalues) - -mso variogram: - - H Dist n All CA CA.signif -0 0 0.3555 63 0.6250 0.6250 0.01 -1 1 1.0659 393 0.7556 0.7556 0.01 -2 2 2.0089 534 0.8931 0.8931 0.01 -3 3 2.9786 417 1.0988 1.0988 0.01 -4 4 3.9817 322 1.3321 1.3321 0.01 -5 5 5.0204 245 1.5109 1.5109 0.01 -10 10 6.8069 441 1.7466 1.7466 0.01 - -Permutation: free -Number of permutations: 99 - -> -> ## Constrained ordination with test for residual autocorrelation -> ## and scale-invariance of species-environment relationships -> mite.cca <- cca(log(mite + 1) ~ SubsDens + WatrCont + Substrate + Shrub + Topo, mite.env) -> mite.cca <- mso(mite.cca, mite.xy, permutations = 99) -> msoplot(mite.cca) -Error variance of regression model underestimated by 0.4 percent -> mite.cca -Call: mso(object.cca = mite.cca, object.xy = mite.xy, permutations = -99) - - Inertia Proportion Rank -Total 1.1638 1.0000 -Constrained 0.5211 0.4478 11 -Unconstrained 0.6427 0.5522 34 -Inertia is scaled Chi-square - -Eigenvalues for constrained axes: - CCA1 CCA2 CCA3 CCA4 CCA5 CCA6 CCA7 CCA8 CCA9 CCA10 -0.31207 0.06601 0.04117 0.02938 0.02438 0.01591 0.01201 0.00752 0.00612 0.00373 - CCA11 -0.00284 - -Eigenvalues for unconstrained axes: - CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8 -0.07888 0.06752 0.05457 0.04023 0.03855 0.03491 0.03233 0.02692 -(Showing 8 of 34 unconstrained eigenvalues) - -mso variogram: - - H Dist n All Sum CA CCA se CA.signif -0 0 0.3555 63 0.6250 0.7479 0.5512 0.1967 0.03506 0.01 -1 1 1.0659 393 0.7556 0.8820 0.6339 0.2482 0.01573 0.19 -2 2 2.0089 534 0.8931 0.9573 0.6473 0.3100 0.01487 0.75 -3 3 2.9786 417 1.0988 1.1010 0.6403 0.4607 0.01858 0.36 -4 4 3.9817 322 1.3321 1.2548 0.6521 0.6027 0.02439 0.98 -5 5 5.0204 245 1.5109 1.4564 0.6636 0.7928 0.02801 0.45 -10 10 6.8069 441 1.7466 1.6266 0.6914 0.9351 0.02052 0.24 - -Permutation: free -Number of permutations: 99 - -> -> -> -> cleanEx() -> nameEx("multipart") -> ### * multipart -> -> flush(stderr()); flush(stdout()) -> -> ### Name: multipart -> ### Title: Multiplicative Diversity Partitioning -> ### Aliases: multipart multipart.default multipart.formula -> ### Keywords: multivariate -> -> ### ** Examples -> -> ## NOTE: 'nsimul' argument usually needs to be >= 99 -> ## here much lower value is used for demonstration -> -> data(mite) -> data(mite.xy) -> data(mite.env) -> ## Function to get equal area partitions of the mite data -> cutter <- function (x, cut = seq(0, 10, by = 2.5)) { -+ out <- rep(1, length(x)) -+ for (i in 2:(length(cut) - 1)) -+ out[which(x > cut[i] & x <= cut[(i + 1)])] <- i -+ return(out)} -> ## The hierarchy of sample aggregation -> levsm <- with(mite.xy, data.frame( -+ l2=cutter(y, cut = seq(0, 10, by = 2.5)), -+ l3=cutter(y, cut = seq(0, 10, by = 5)))) -> ## Multiplicative diversity partitioning -> multipart(mite, levsm, index="renyi", scales=1, nsimul=19) -multipart object - -Call: multipart(y = mite, x = levsm, index = "renyi", scales = 1, -nsimul = 19) - -nullmodel method ‘r2dtable’ with 19 simulations -options: index renyi, scales 1, global FALSE -alternative hypothesis: statistic is less or greater than simulated values - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -alpha.1 11.235 -91.662 14.09161 14.05255 14.08685 14.1485 0.05 * -gamma 12.006 -391.053 14.13939 14.13048 14.13932 14.1485 0.05 * -beta.1 1.071 30.431 1.00339 0.99912 1.00340 1.0059 0.05 * ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> multipart(mite ~ l2 + l3, levsm, index="renyi", scales=1, nsimul=19) -multipart object - -Call: multipart(formula = mite ~ l2 + l3, data = levsm, index = -"renyi", scales = 1, nsimul = 19) - -nullmodel method ‘r2dtable’ with 19 simulations -options: index renyi, scales 1, global FALSE -alternative hypothesis: statistic is less or greater than simulated values - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -alpha.1 8.0555 -66.643 12.2056 12.1143 12.2120 12.2910 0.05 * -alpha.2 11.2353 -94.626 14.0818 14.0246 14.0917 14.1193 0.05 * -alpha.3 12.0064 -355.962 14.1391 14.1283 14.1374 14.1485 0.05 * -gamma 14.1603 0.000 14.1603 14.1603 14.1603 14.1603 1.00 -beta.1 1.3568 35.028 1.1566 1.1478 1.1565 1.1660 0.05 * -beta.2 1.0710 33.423 1.0041 1.0015 1.0035 1.0078 0.05 * -beta.3 1.1794 419.166 1.0015 1.0008 1.0016 1.0023 0.05 * ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> multipart(mite ~ ., levsm, index="renyi", scales=1, nsimul=19, relative=TRUE) -multipart object - -Call: multipart(formula = mite ~ ., data = levsm, index = "renyi", -scales = 1, relative = TRUE, nsimul = 19) - -nullmodel method ‘r2dtable’ with 19 simulations -options: index renyi, scales 1, global FALSE -alternative hypothesis: statistic is less or greater than simulated values - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -alpha.1 8.055481 -53.544 12.204883 12.071168 12.198307 12.3689 0.05 * -alpha.2 11.235261 -99.506 14.079276 14.032767 14.076147 14.1247 0.05 * -alpha.3 12.006443 -343.946 14.135245 14.123604 14.136297 14.1438 0.05 * -gamma 14.160271 0.000 14.160271 14.160271 14.160271 14.1603 1.00 -beta.1 0.078594 19.568 0.068267 0.067236 0.068392 0.0691 0.05 * -beta.2 0.535514 35.966 0.501994 0.500294 0.502062 0.5035 0.05 * -beta.3 0.589695 404.814 0.500885 0.500583 0.500848 0.5013 0.05 * ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> multipart(mite ~ ., levsm, index="renyi", scales=1, nsimul=19, global=TRUE) -multipart object - -Call: multipart(formula = mite ~ ., data = levsm, index = "renyi", -scales = 1, global = TRUE, nsimul = 19) - -nullmodel method ‘r2dtable’ with 19 simulations -options: index renyi, scales 1, global TRUE -alternative hypothesis: statistic is less or greater than simulated values - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -alpha.1 8.0555 -69.630 12.19342 12.09434 12.18504 12.3160 0.05 * -alpha.2 11.2353 -81.676 14.09224 14.05248 14.09208 14.1625 0.05 * -alpha.3 12.0064 -321.419 14.13850 14.12429 14.13991 14.1456 0.05 * -gamma 14.1603 0.000 14.16027 14.16027 14.16027 14.1603 1.00 -beta.1 1.7578 105.552 1.16133 1.14975 1.16210 1.1708 0.05 * -beta.2 1.2603 102.695 1.00483 0.99985 1.00484 1.0077 0.05 * -beta.3 1.1794 378.335 1.00154 1.00104 1.00144 1.0025 0.05 * ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> -> -> cleanEx() -> nameEx("nestedtemp") -> ### * nestedtemp -> -> flush(stderr()); flush(stdout()) -> -> ### Name: nestedtemp -> ### Title: Nestedness Indices for Communities of Islands or Patches -> ### Aliases: nestedtemp nestedchecker nestedn0 nesteddisc nestednodf -> ### nestedbetasor nestedbetajac plot.nestedtemp plot.nestednodf -> ### Keywords: univar -> -> ### ** Examples -> -> data(sipoo) -> ## Matrix temperature -> out <- nestedtemp(sipoo) -> out -nestedness temperature: 10.24036 -with matrix fill 0.2233333 -> plot(out) -> plot(out, kind="incid") -> ## Use oecosimu to assess the non-randomness of checker board units -> nestedchecker(sipoo) -Checkerboard Units : 2767 -C-score (species mean): 2.258776 -> oecosimu(sipoo, nestedchecker, "quasiswap") -oecosimu object - -Call: oecosimu(comm = sipoo, nestfun = nestedchecker, method = -"quasiswap") - -nullmodel method ‘quasiswap’ with 99 simulations - -alternative hypothesis: statistic is less or greater than simulated values - -Checkerboard Units : 2767 -C-score (species mean): 2.258776 - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -checkerboards 2767 0.48679 2719.6 2578.2 2703.0 2954.7 0.51 -> ## Another Null model and standardized checkerboard score -> oecosimu(sipoo, nestedchecker, "r00", statistic = "C.score") -oecosimu object - -Call: oecosimu(comm = sipoo, nestfun = nestedchecker, method = "r00", -statistic = "C.score") - -nullmodel method ‘r00’ with 99 simulations - -alternative hypothesis: statistic is less or greater than simulated values - -Checkerboard Units : 2767 -C-score (species mean): 2.258776 - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -C.score 2.2588 -27.712 9.2068 8.6902 9.2367 9.6964 0.01 ** ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> -> -> cleanEx() -> nameEx("nullmodel") -> ### * nullmodel -> -> flush(stderr()); flush(stdout()) -> -> ### Name: nullmodel -> ### Title: Null Model and Simulation -> ### Aliases: nullmodel simmat print.nullmodel simulate.nullmodel -> ### update.nullmodel str.nullmodel print.simmat smbind -> ### Keywords: multivariate datagen -> -> ### ** Examples -> -> data(mite) -> x <- as.matrix(mite)[1:12, 21:30] -> -> ## non-sequential nullmodel -> (nm <- nullmodel(x, "r00")) -An object of class “nullmodel” -‘r00’ method (binary, non-sequential) -12 x 10 matrix - -> (sm <- simulate(nm, nsim=10)) -An object of class “simmat” -‘r00’ method (binary, non-sequential) -12 x 10 matrix -Number of permuted matrices = 10 - -> -> ## sequential nullmodel -> (nm <- nullmodel(x, "swap")) -An object of class “nullmodel” -‘swap’ method (binary, sequential) -12 x 10 matrix -Iterations = 0 - -> (sm1 <- simulate(nm, nsim=10, thin=5)) -An object of class “simmat” -‘swap’ method (binary, sequential) -12 x 10 matrix -Number of permuted matrices = 10 -Start = 5, End = 50, Thin = 5 - -> (sm2 <- simulate(nm, nsim=10, thin=5)) -An object of class “simmat” -‘swap’ method (binary, sequential) -12 x 10 matrix -Number of permuted matrices = 10 -Start = 55, End = 100, Thin = 5 - -> -> ## sequential nullmodel with burnin and extra updating -> (nm <- nullmodel(x, "swap")) -An object of class “nullmodel” -‘swap’ method (binary, sequential) -12 x 10 matrix -Iterations = 0 - -> (sm1 <- simulate(nm, burnin=10, nsim=10, thin=5)) -An object of class “simmat” -‘swap’ method (binary, sequential) -12 x 10 matrix -Number of permuted matrices = 10 -Start = 15, End = 60, Thin = 5 - -> (sm2 <- simulate(nm, nsim=10, thin=5)) -An object of class “simmat” -‘swap’ method (binary, sequential) -12 x 10 matrix -Number of permuted matrices = 10 -Start = 5, End = 50, Thin = 5 - -> -> ## sequential nullmodel with separate initial burnin -> (nm <- nullmodel(x, "swap")) -An object of class “nullmodel” -‘swap’ method (binary, sequential) -12 x 10 matrix -Iterations = 0 - -> nm <- update(nm, nsim=10) -> (sm2 <- simulate(nm, nsim=10, thin=5)) -An object of class “simmat” -‘swap’ method (binary, sequential) -12 x 10 matrix -Number of permuted matrices = 10 -Start = 15, End = 60, Thin = 5 - -> -> ## combining multiple simmat objects -> -> ## stratification -> nm1 <- nullmodel(x[1:6,], "r00") -> sm1 <- simulate(nm1, nsim=10) -> nm2 <- nullmodel(x[7:12,], "r00") -> sm2 <- simulate(nm2, nsim=10) -> smbind(sm1, sm2, MARGIN=1) -An object of class “simmat” -‘r00’ method (binary, non-sequential) -12 x 10 matrix -Number of permuted matrices = 10 - -> -> ## binding subsequent samples from sequential algorithms -> ## start, end, thin retained -> nm <- nullmodel(x, "swap") -> nm <- update(nm, nsim=10) -> sm1 <- simulate(nm, nsim=10, thin=5) -> sm2 <- simulate(nm, nsim=20, thin=5) -> sm3 <- simulate(nm, nsim=10, thin=5) -> smbind(sm3, sm2, sm1, MARGIN=3) -An object of class “simmat” -‘swap’ method (binary, sequential) -12 x 10 matrix -Number of permuted matrices = 40 -Start = 15, End = 210, Thin = 5 - -> -> ## 'replicate' based usage which is similar to the output -> ## of 'parLapply' or 'mclapply' in the 'parallel' package -> ## start, end, thin are set, also noting number of chains -> smfun <- function(x, burnin, nsim, thin) { -+ nm <- nullmodel(x, "swap") -+ nm <- update(nm, nsim=burnin) -+ simulate(nm, nsim=nsim, thin=thin) -+ } -> smlist <- replicate(3, smfun(x, burnin=50, nsim=10, thin=5), simplify=FALSE) -> smbind(smlist, MARGIN=3) # Number of permuted matrices = 30 -An object of class “simmat” -‘swap’ method (binary, sequential) -12 x 10 matrix -Number of permuted matrices = 30 -Start = 55, End = 100, Thin = 5 (3 chains) - -> -> ## Not run: -> ##D ## parallel null model calculations -> ##D library(parallel) -> ##D -> ##D if (.Platform$OS.type == "unix") { -> ##D ## forking on Unix systems -> ##D smlist <- mclapply(1:3, function(i) smfun(x, burnin=50, nsim=10, thin=5)) -> ##D smbind(smlist, MARGIN=3) -> ##D } -> ##D -> ##D ## socket type cluster, works on all platforms -> ##D cl <- makeCluster(3) -> ##D clusterEvalQ(cl, library(vegan)) -> ##D clusterExport(cl, c("smfun", "x")) -> ##D smlist <- parLapply(cl, 1:3, function(i) smfun(x, burnin=50, nsim=10, thin=5)) -> ##D stopCluster(cl) -> ##D smbind(smlist, MARGIN=3) -> ## End(Not run) -> -> -> -> cleanEx() -> nameEx("oecosimu") -> ### * oecosimu -> -> flush(stderr()); flush(stdout()) -> -> ### Name: oecosimu -> ### Title: Evaluate Statistics with Null Models of Biological Communities -> ### Aliases: oecosimu as.ts.oecosimu toCoda toCoda.oecosimu -> ### Keywords: multivariate datagen nonparametric -> -> ### ** Examples -> -> ## Use the first eigenvalue of correspondence analysis as an index -> ## of structure: a model for making your own functions. -> data(sipoo) -> ## Traditional nestedness statistics (number of checkerboard units) -> oecosimu(sipoo, nestedchecker, "r0") -oecosimu object - -Call: oecosimu(comm = sipoo, nestfun = nestedchecker, method = "r0") - -nullmodel method ‘r0’ with 99 simulations - -alternative hypothesis: statistic is less or greater than simulated values - -Checkerboard Units : 2767 -C-score (species mean): 2.258776 - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -checkerboards 2767 -18.241 8052.2 7437.4 8073.0 8553.2 0.01 ** ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## sequential model, one-sided test, a vector statistic -> out <- oecosimu(sipoo, decorana, "swap", burnin=100, thin=10, -+ statistic="evals", alt = "greater") -> out -oecosimu object - -Call: oecosimu(comm = sipoo, nestfun = decorana, method = "swap", -burnin = 100, thin = 10, statistic = "evals", alternative = "greater") - -nullmodel method ‘swap’ with 99 simulations -options: thin 10, burnin 100 -alternative hypothesis: statistic is greater than simulated values - - -Call: -nestfun(veg = comm) - -Detrended correspondence analysis with 26 segments. -Rescaling of axes with 4 iterations. -Total inertia (scaled Chi-square): 2.4436 - - DCA1 DCA2 DCA3 DCA4 -Eigenvalues 0.3822 0.2612 0.1668 0.08723 -Additive Eigenvalues 0.3822 0.2609 0.1631 0.07650 -Decorana values 0.4154 0.2465 0.1391 0.04992 -Axis lengths 2.9197 2.5442 2.7546 1.78074 - - - statistic SES mean 50% 95% Pr(sim.) -DCA1 0.382249 2.44651 0.31759 0.32108 0.3547 0.01 ** -DCA2 0.261208 1.69812 0.21616 0.21680 0.2577 0.04 * -DCA3 0.166788 0.68565 0.15357 0.15231 0.1842 0.24 -DCA4 0.087226 -1.72504 0.12755 0.12424 0.1654 0.96 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## Inspect the swap sequence as a time series object -> plot(as.ts(out)) -> lag.plot(as.ts(out)) -> acf(as.ts(out)) -> ## Density plot -> densityplot(permustats(out), as.table = TRUE, layout = c(1,4)) -> ## Use quantitative null models to compare -> ## mean Bray-Curtis dissimilarities -> data(dune) -> meandist <- function(x) mean(vegdist(x, "bray")) -> mbc1 <- oecosimu(dune, meandist, "r2dtable") -> mbc1 -oecosimu object - -Call: oecosimu(comm = dune, nestfun = meandist, method = "r2dtable") - -nullmodel method ‘r2dtable’ with 99 simulations - -alternative hypothesis: statistic is less or greater than simulated values - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -statistic 0.64565 15.512 0.46676 0.44220 0.46772 0.4856 0.01 ** ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> ## Define your own null model as a 'commsim' function: shuffle cells -> ## in each row -> foo <- function(x, n, nr, nc, ...) { -+ out <- array(0, c(nr, nc, n)) -+ for (k in seq_len(n)) -+ out[,,k] <- apply(x, 2, function(z) sample(z, length(z))) -+ out -+ } -> cf <- commsim("myshuffle", foo, isSeq = FALSE, binary = FALSE, -+ mode = "double") -> oecosimu(dune, meandist, cf) -oecosimu object - -Call: oecosimu(comm = dune, nestfun = meandist, method = cf) - -nullmodel method ‘myshuffle’ with 99 simulations - -alternative hypothesis: statistic is less or greater than simulated values - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -statistic 0.64565 3.9465 0.63491 0.63002 0.63471 0.6407 0.01 ** ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> ## Use pre-built null model -> nm <- simulate(nullmodel(sipoo, "curveball"), 99) -> oecosimu(nm, nestedchecker) -oecosimu object - -Call: oecosimu(comm = nm, nestfun = nestedchecker) - -nullmodel method ‘curveball’ with 99 simulations -options: thin 1, burnin 0 -alternative hypothesis: statistic is less or greater than simulated values - -Checkerboard Units : 2767 -C-score (species mean): 2.258776 - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -checkerboards 2767 0.36404 2732.4 2585.0 2710.0 3007 0.57 -> ## Several chains of a sequential model -- this can be generalized -> ## for parallel processing (see ?smbind) -> nm <- replicate(5, simulate(nullmodel(sipoo, "swap"), 99, -+ thin=10, burnin=100), simplify = FALSE) -> ## nm is now a list of nullmodels: use smbind to combine these into one -> ## nullmodel with several chains -> ## IGNORE_RDIFF_BEGIN -> nm <- smbind(nm, MARGIN = 3) -> nm -An object of class “simmat” -‘swap’ method (binary, sequential) -18 x 50 matrix -Number of permuted matrices = 495 -Start = 110, End = 1090, Thin = 10 (5 chains) - -> oecosimu(nm, nestedchecker) -oecosimu object - -Call: oecosimu(comm = nm, nestfun = nestedchecker) - -nullmodel method ‘swap’ with 495 simulations -options: thin 10, burnin 100, chains 5 -alternative hypothesis: statistic is less or greater than simulated values - -Checkerboard Units : 2767 -C-score (species mean): 2.258776 - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -checkerboards 2767 0.89035 2696.7 2567.3 2691.0 2879 0.369 -> ## IGNORE_RDIFF_END -> ## After this you can use toCoda() and tools in the coda package to -> ## analyse the chains (these will show that thin, burnin and nsimul are -> ## all too low for real analysis). -> -> -> -> cleanEx() -> nameEx("ordiArrowTextXY") -> ### * ordiArrowTextXY -> -> flush(stderr()); flush(stdout()) -> -> ### Name: ordiArrowTextXY -> ### Title: Support Functions for Drawing Vectors -> ### Aliases: ordiArrowMul ordiArrowTextXY -> ### Keywords: utilities -> -> ### ** Examples -> -> ## Scale arrows by hand to fill 80% of the plot -> ## Biplot arrows by hand -> data(varespec, varechem) -> ord <- cca(varespec ~ Al + P + K, varechem) -> plot(ord, display = c("species","sites")) -> -> ## biplot scores -> bip <- scores(ord, choices = 1:2, display = "bp") -> -> ## scaling factor for arrows to fill 80% of plot -> (mul <- ordiArrowMul(bip, fill = 0.8)) -[1] 2.074233 -> bip.scl <- bip * mul # Scale the biplot scores -> labs <- rownames(bip) # Arrow labels -> -> ## calculate coordinate of labels for arrows -> (bip.lab <- ordiArrowTextXY(bip.scl, rescale = FALSE, labels = labs)) - [,1] [,2] -Al 1.8804734 -0.3507570 -P -0.9168309 -1.6419845 -K -0.9931606 -0.3713207 -> -> ## draw arrows and text labels -> arrows(0, 0, bip.scl[,1], bip.scl[,2], length = 0.1) -> text(bip.lab, labels = labs) -> -> ## Handling of ordination objects directly -> mul2 <- ordiArrowMul(ord, display = "bp", fill = 0.8) -> stopifnot(all.equal(mul, mul2)) -> -> -> -> cleanEx() -> nameEx("ordiarrows") -> ### * ordiarrows -> -> flush(stderr()); flush(stdout()) -> -> ### Name: ordiarrows -> ### Title: Add Arrows and Line Segments to Ordination Diagrams -> ### Aliases: ordiarrows ordisegments ordigrid -> ### Keywords: aplot -> -> ### ** Examples -> -> example(pyrifos) - -pyrifs> data(pyrifos) - -pyrifs> ditch <- gl(12, 1, length=132) - -pyrifs> week <- gl(11, 12, labels=c(-4, -1, 0.1, 1, 2, 4, 8, 12, 15, 19, 24)) - -pyrifs> dose <- factor(rep(c(0.1, 0, 0, 0.9, 0, 44, 6, 0.1, 44, 0.9, 0, 6), 11)) -> mod <- rda(pyrifos) -> plot(mod, type = "n") -> ## Annual succession by ditches, colour by dose -> ordiarrows(mod, ditch, label = TRUE, col = as.numeric(dose)) -> legend("topright", levels(dose), lty=1, col=1:5, title="Dose") -> ## Show only control and highest Pyrifos treatment -> plot(mod, type = "n") -> ordiarrows(mod, ditch, label = TRUE, -+ show.groups = c("2", "3", "5", "11")) -> ordiarrows(mod, ditch, label = TRUE, show = c("6", "9"), -+ col = 2) -> legend("topright", c("Control", "Pyrifos 44"), lty = 1, col = c(1,2)) -> -> -> -> cleanEx() -> nameEx("ordihull") -> ### * ordihull -> -> flush(stderr()); flush(stdout()) -> -> ### Name: ordihull -> ### Title: Display Groups or Factor Levels in Ordination Diagrams -> ### Aliases: ordihull ordispider ordiellipse ordibar ordicluster -> ### summary.ordihull scores.ordihull summary.ordiellipse ordiareatest -> ### Keywords: aplot -> -> ### ** Examples -> -> data(dune) -> data(dune.env) -> mod <- cca(dune ~ Management, dune.env) -> plot(mod, type="n", scaling = "symmetric") -> ## Catch the invisible result of ordihull... -> pl <- with(dune.env, ordihull(mod, Management, -+ scaling = "symmetric", label = TRUE)) -> ## ... and find centres and areas of the hulls -> summary(pl) - BF HF NM SF -CCA1 0.2917476 0.36826105 -1.3505642 0.2762936 -CCA2 0.8632208 0.09419919 0.2681515 -0.8139398 -Area 0.1951715 0.59943363 1.7398193 1.0144372 -> ## use more colours and add ellipsoid hulls -> plot(mod, type = "n") -> pl <- with(dune.env, ordihull(mod, Management, -+ scaling = "symmetric", col = 1:4, -+ draw="polygon", label =TRUE)) -> with(dune.env, ordiellipse(mod, Management, scaling = "symmetric", -+ kind = "ehull", col = 1:4, lwd=3)) -> ## ordispider to connect WA and LC scores -> plot(mod, dis=c("wa","lc"), type="p") -> ordispider(mod) -> ## Other types of plots -> plot(mod, type = "p", display="sites") -> cl <- hclust(vegdist(dune)) -> ordicluster(mod, cl, prune=3, col = cutree(cl, 4)) -> ## confidence ellipse: location of the class centroids -> plot(mod, type="n", display = "sites") -> with(dune.env, text(mod, display="sites", labels = as.character(Management), -+ col=as.numeric(Management))) -> pl <- with(dune.env, ordiellipse(mod, Management, kind="se", conf=0.95, lwd=2, -+ draw = "polygon", col=1:4, border=1:4, -+ alpha=63)) -> summary(pl) - BF HF NM SF -CCA1 0.4312652 0.5583211 -1.87848340 0.5601499 -CCA2 1.3273917 0.6373120 -0.05503211 -1.3859924 -Area 1.4559842 1.3806668 2.73667419 1.5559135 -> ## add confidence bars -> with(dune.env, ordibar(mod, Management, kind="se", conf=0.95, lwd=2, col=1:4, -+ label=TRUE)) -> -> -> -> cleanEx() -> nameEx("ordilabel") -> ### * ordilabel -> -> flush(stderr()); flush(stdout()) -> -> ### Name: ordilabel -> ### Title: Add Text on Non-transparent Label to an Ordination Plot. -> ### Aliases: ordilabel -> ### Keywords: aplot -> -> ### ** Examples -> -> data(dune) -> ord <- cca(dune) -> plot(ord, type = "n") -> ordilabel(ord, dis="sites", cex=1.2, font=3, fill="hotpink", col="blue") -> ## You may prefer separate plots, but here species as well -> ordilabel(ord, dis="sp", font=2, priority=colSums(dune)) -> -> -> -> cleanEx() -> nameEx("ordiplot") -> ### * ordiplot -> -> flush(stderr()); flush(stdout()) -> -> ### Name: ordiplot -> ### Title: Alternative plot and identify Functions for Ordination -> ### Aliases: ordiplot identify.ordiplot scores.ordiplot points.ordiplot -> ### text.ordiplot -> ### Keywords: hplot iplot aplot -> -> ### ** Examples -> -> ## Draw a plot for a non-vegan ordination (cmdscale). -> data(dune) -> dune.dis <- vegdist(wisconsin(dune)) -> dune.mds <- cmdscale(dune.dis, eig = TRUE) -> dune.mds$species <- wascores(dune.mds$points, dune, expand = TRUE) -> pl <- ordiplot(dune.mds, type = "none") -> points(pl, "sites", pch=21, col="red", bg="yellow") -> text(pl, "species", col="blue", cex=0.9) -> ## Not run: -> ##D ## same plot using pipes (pipes |> are available from R version 4.1.0) -> ##D if (getRversion() >= "4.1") { -> ##D ordiplot(dune.mds, type="n") |> -> ##D points("sites", pch=21, col="red", bg="yellow") |> -> ##D text("species", col="blue", cex=0.9) -> ##D ## Some people think that species should be shown with arrows in PCA. -> ##D ## Other ordination methods also return an invisible ordiplot object and -> ##D ## we can use pipes to draw those arrows. -> ##D mod <- rda(dune) -> ##D plot(mod, type="n") |> -> ##D points("sites", pch=16, col="red") |> -> ##D text("species", arrows = TRUE, length=0.05, col="blue") -> ##D } -> ## End(Not run) -> ## Default plot of the previous using identify to label selected points -> ## Not run: -> ##D pl <- ordiplot(dune.mds) -> ##D identify(pl, "spec") -> ## End(Not run) -> -> -> -> cleanEx() -> nameEx("ordipointlabel") -> ### * ordipointlabel -> -> flush(stderr()); flush(stdout()) -> -> ### Name: ordipointlabel -> ### Title: Ordination Plots with Points and Optimized Locations for Text -> ### Aliases: ordipointlabel plot.ordipointlabel -> ### Keywords: hplot aplot -> -> ### ** Examples -> -> data(dune) -> ord <- cca(dune) -> plt <- ordipointlabel(ord) -> -> ## set scaling - should be no warnings! -> ordipointlabel(ord, scaling = "sites") -> -> ## plot then add -> plot(ord, scaling = "symmetric", type = "n") -> ordipointlabel(ord, display = "species", scaling = "symm", add = TRUE) -> ordipointlabel(ord, display = "sites", scaling = "symm", add = TRUE) -> -> ## redraw plot without rerunning SANN optimisation -> plot(plt) -> -> -> -> cleanEx() -> nameEx("ordiresids") -> ### * ordiresids -> -> flush(stderr()); flush(stdout()) -> -> ### Name: ordiresids -> ### Title: Plots of Residuals and Fitted Values for Constrained Ordination -> ### Aliases: ordiresids -> ### Keywords: hplot -> -> ### ** Examples -> -> data(varespec) -> data(varechem) -> mod <- cca(varespec ~ Al + P + K, varechem) -> ordiresids(mod) -> ordiresids(mod, formula = Residuals ~ Fitted | Species, residuals="standard", -+ cex = 0.5) -> -> -> -> cleanEx() -> nameEx("ordistep") -> ### * ordistep -> -> flush(stderr()); flush(stdout()) -> -> ### Name: ordistep -> ### Title: Choose a Model by Permutation Tests in Constrained Ordination -> ### Aliases: ordistep ordiR2step -> ### Keywords: multivariate models -> -> ### ** Examples -> -> ## See add1.cca for another example -> -> ### Dune data -> data(dune) -> data(dune.env) -> mod0 <- rda(dune ~ 1, dune.env) # Model with intercept only -> mod1 <- rda(dune ~ ., dune.env) # Model with all explanatory variables -> -> ## With scope present, the default direction is "both" -> mod <- ordistep(mod0, scope = formula(mod1)) - -Start: dune ~ 1 - - Df AIC F Pr(>F) -+ Moisture 3 87.707 2.5883 0.005 ** -+ Manure 4 89.232 1.9539 0.005 ** -+ Management 3 87.082 2.8400 0.010 ** -+ A1 1 89.591 1.9217 0.030 * -+ Use 2 91.032 1.1741 0.205 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Step: dune ~ Moisture - - Df AIC F Pr(>F) -- Moisture 3 89.62 2.5883 0.005 ** ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - - Df AIC F Pr(>F) -+ Management 3 85.567 2.1769 0.010 ** -+ Manure 4 86.060 1.8598 0.020 * -+ Use 2 88.003 1.4245 0.135 -+ A1 1 88.886 0.6286 0.835 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Step: dune ~ Moisture + Management - - Df AIC F Pr(>F) -- Moisture 3 87.082 1.9764 0.015 * -- Management 3 87.707 2.1769 0.005 ** ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - - Df AIC F Pr(>F) -+ Manure 3 85.762 1.1225 0.300 -+ A1 1 86.220 0.8359 0.685 -+ Use 2 86.842 0.8027 0.710 - -> mod -Call: rda(formula = dune ~ Moisture + Management, data = dune.env) - - Inertia Proportion Rank -Total 84.1237 1.0000 -Constrained 46.4249 0.5519 6 -Unconstrained 37.6988 0.4481 13 -Inertia is variance - -Eigenvalues for constrained axes: - RDA1 RDA2 RDA3 RDA4 RDA5 RDA6 -21.588 14.075 4.123 3.163 2.369 1.107 - -Eigenvalues for unconstrained axes: - PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11 PC12 PC13 -8.241 7.138 5.355 4.409 3.143 2.770 1.878 1.741 0.952 0.909 0.627 0.311 0.227 - -> ## summary table of steps -> mod$anova - Df AIC F Pr(>F) -+ Moisture 3 87.707 2.5883 0.005 ** -+ Management 3 85.567 2.1769 0.010 ** ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> ## Example of ordistep, forward -> ordistep(mod0, scope = formula(mod1), direction="forward") - -Start: dune ~ 1 - - Df AIC F Pr(>F) -+ Management 3 87.082 2.8400 0.005 ** -+ Moisture 3 87.707 2.5883 0.005 ** -+ Manure 4 89.232 1.9539 0.015 * -+ A1 1 89.591 1.9217 0.045 * -+ Use 2 91.032 1.1741 0.250 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Step: dune ~ Management - - Df AIC F Pr(>F) -+ Moisture 3 85.567 1.9764 0.005 ** -+ Manure 3 87.517 1.3902 0.095 . -+ A1 1 87.424 1.2965 0.175 -+ Use 2 88.284 1.0510 0.365 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Step: dune ~ Management + Moisture - - Df AIC F Pr(>F) -+ Manure 3 85.762 1.1225 0.315 -+ A1 1 86.220 0.8359 0.605 -+ Use 2 86.842 0.8027 0.695 - -Call: rda(formula = dune ~ Management + Moisture, data = dune.env) - - Inertia Proportion Rank -Total 84.1237 1.0000 -Constrained 46.4249 0.5519 6 -Unconstrained 37.6988 0.4481 13 -Inertia is variance - -Eigenvalues for constrained axes: - RDA1 RDA2 RDA3 RDA4 RDA5 RDA6 -21.588 14.075 4.123 3.163 2.369 1.107 - -Eigenvalues for unconstrained axes: - PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11 PC12 PC13 -8.241 7.138 5.355 4.409 3.143 2.770 1.878 1.741 0.952 0.909 0.627 0.311 0.227 - -> -> ## Example of ordiR2step (always forward) -> ## stops because R2 of 'mod1' exceeded -> ordiR2step(mod0, mod1) -Step: R2.adj= 0 -Call: dune ~ 1 - - R2.adjusted - 0.32508817 -+ Management 0.22512409 -+ Moisture 0.20050225 -+ Manure 0.16723149 -+ A1 0.04626579 -+ Use 0.01799755 - 0.00000000 - - Df AIC F Pr(>F) -+ Management 3 87.082 2.84 0.002 ** ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Step: R2.adj= 0.2251241 -Call: dune ~ Management - - R2.adjusted -+ Moisture 0.3450334 - 0.3250882 -+ Manure 0.2779515 -+ A1 0.2392216 -+ Use 0.2300349 - 0.2251241 - -Call: rda(formula = dune ~ Management, data = dune.env) - - Inertia Proportion Rank -Total 84.1237 1.0000 -Constrained 29.2307 0.3475 3 -Unconstrained 54.8930 0.6525 16 -Inertia is variance - -Eigenvalues for constrained axes: - RDA1 RDA2 RDA3 -14.865 10.690 3.675 - -Eigenvalues for unconstrained axes: - PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11 -15.270 8.428 6.899 5.675 3.988 3.121 2.588 2.380 1.818 1.376 0.995 - PC12 PC13 PC14 PC15 PC16 - 0.785 0.661 0.467 0.283 0.159 - -> -> -> -> cleanEx() -> nameEx("ordisurf") -> ### * ordisurf -> -> flush(stderr()); flush(stdout()) -> -> ### Name: ordisurf -> ### Title: Fit and Plot Smooth Surfaces of Variables on Ordination. -> ### Aliases: ordisurf ordisurf.default ordisurf.formula calibrate.ordisurf -> ### plot.ordisurf -> ### Keywords: multivariate aplot -> -> ### ** Examples -> -> data(varespec) -> data(varechem) -> vare.dist <- vegdist(varespec) -> vare.mds <- monoMDS(vare.dist) -> ## IGNORE_RDIFF_BEGIN -> ordisurf(vare.mds ~ Baresoil, varechem, bubble = 5) - -Family: gaussian -Link function: identity - -Formula: -y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE) - -Estimated degrees of freedom: -5.64 total = 6.64 - -REML score: 92.95904 -> -> ## as above but without the extra penalties on smooth terms, -> ## and using GCV smoothness selection (old behaviour of `ordisurf()`): -> ordisurf(vare.mds ~ Baresoil, varechem, col = "blue", add = TRUE, -+ select = FALSE, method = "GCV.Cp") - -Family: gaussian -Link function: identity - -Formula: -y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE) - -Estimated degrees of freedom: -6.49 total = 7.49 - -GCV score: 143.7761 -> -> ## Cover of Cladina arbuscula -> fit <- ordisurf(vare.mds ~ Cladarbu, varespec, family=quasipoisson) -> ## Get fitted values -> calibrate(fit) - 18 15 24 27 23 19 22 16 -21.260676 5.673306 3.677152 3.889980 9.618594 7.665831 7.763242 9.773191 - 28 13 14 20 25 7 5 6 - 2.699161 29.765355 12.007288 8.286220 5.417317 24.914272 11.045769 25.390480 - 3 4 2 9 12 10 11 21 - 6.510626 9.424401 4.492914 4.051451 11.563182 4.286884 11.683416 14.189292 -> ## Variable selection via additional shrinkage penalties -> ## This allows non-significant smooths to be selected out -> ## of the model not just to a linear surface. There are 2 -> ## options available: -> ## - option 1: `select = TRUE` --- the *default* -> ordisurf(vare.mds ~ Baresoil, varechem, method = "REML", select = TRUE) - -Family: gaussian -Link function: identity - -Formula: -y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE) - -Estimated degrees of freedom: -5.64 total = 6.64 - -REML score: 92.95904 -> ## - option 2: use a basis with shrinkage -> ordisurf(vare.mds ~ Baresoil, varechem, method = "REML", bs = "ts") - -Family: gaussian -Link function: identity - -Formula: -y ~ s(x1, x2, k = 10, bs = "ts", fx = FALSE) - -Estimated degrees of freedom: -4.41 total = 5.41 - -REML score: 96.22088 -> ## or bs = "cs" with `isotropic = FALSE` -> ## IGNORE_RDIFF_END -> ## Plot method -> plot(fit, what = "contour") -> -> ## Plotting the "gam" object -> plot(fit, what = "gam") ## 'col' and 'cex' not passed on -> ## or via plot.gam directly -> library(mgcv) -Loading required package: nlme -This is mgcv 1.8-40. For overview type 'help("mgcv-package")'. -> plot.gam(fit, cex = 2, pch = 1, col = "blue") -> ## 'col' effects all objects drawn... -> -> ### controlling the basis functions used -> ## Use Duchon splines -> ordisurf(vare.mds ~ Baresoil, varechem, bs = "ds") - -Family: gaussian -Link function: identity - -Formula: -y ~ s(x1, x2, k = 10, bs = "ds", fx = FALSE) - -Estimated degrees of freedom: -5.65 total = 6.65 - -REML score: 93.16148 -> -> ## A fixed degrees of freedom smooth, must use 'select = FALSE' -> ordisurf(vare.mds ~ Baresoil, varechem, knots = 4, -+ fx = TRUE, select = FALSE) - -Family: gaussian -Link function: identity - -Formula: -y ~ s(x1, x2, k = 4, bs = "tp", fx = TRUE) - -Estimated degrees of freedom: -3 total = 4 - -REML score: 81.86252 -> -> ## An anisotropic smoother with cubic regression spline bases -> ordisurf(vare.mds ~ Baresoil, varechem, isotropic = FALSE, -+ bs = "cr", knots = 4) - -Family: gaussian -Link function: identity - -Formula: -y ~ te(x1, x2, k = c(4, 4), bs = c("cr", "cr"), fx = c(FALSE, - FALSE)) - -Estimated degrees of freedom: -3 total = 4 - -REML score: 90.83453 -> -> ## An anisotropic smoother with cubic regression spline with -> ## shrinkage bases & different degrees of freedom in each dimension -> ordisurf(vare.mds ~ Baresoil, varechem, isotropic = FALSE, -+ bs = "cs", knots = c(3,4), fx = TRUE, -+ select = FALSE) - -Family: gaussian -Link function: identity - -Formula: -y ~ te(x1, x2, k = c(3, 4), bs = c("cs", "cs"), fx = c(TRUE, - TRUE)) - -Estimated degrees of freedom: -11 total = 12 - -REML score: 39.52198 -> -> -> -> cleanEx() - -detaching ‘package:mgcv’, ‘package:nlme’ - -> nameEx("orditkplot") -> ### * orditkplot -> -> flush(stderr()); flush(stdout()) -> -> ### Name: orditkplot -> ### Title: Ordination Plot with Movable Labels -> ### Aliases: orditkplot plot.orditkplot scores.orditkplot points.orditkplot -> ### text.orditkplot -> ### Keywords: iplot dynamic -> -> ### ** Examples -> -> ## The example needs user interaction and is not executed directly. -> ## It should work when pasted to the window. -> ## Not run: -> ##D data(varespec) -> ##D ord <- cca(varespec) -> ##D ## Do something with the graph and end by clicking "Dismiss" -> ##D orditkplot(ord, mar = c(4,4,1,1)+.1, font=3) -> ##D ## Use ordipointlabel to produce a plot that has both species and site -> ##D ## scores in different colors and plotting symbols -> ##D pl <- ordipointlabel(ord) -> ##D orditkplot(pl) -> ## End(Not run) -> -> -> -> cleanEx() -> nameEx("orditorp") -> ### * orditorp -> -> flush(stderr()); flush(stdout()) -> -> ### Name: orditorp -> ### Title: Add Text or Points to Ordination Plots -> ### Aliases: orditorp -> ### Keywords: aplot hplot -> -> ### ** Examples -> -> ## A cluttered ordination plot : -> data(BCI) -> mod <- cca(BCI) -> plot(mod, dis="sp", type="t") -> # Now with orditorp and abbreviated species names -> cnam <- make.cepnames(names(BCI)) -> plot(mod, dis="sp", type="n") -> stems <- colSums(BCI) -> orditorp(mod, "sp", label = cnam, priority=stems, pch="+", pcol="grey") -> -> ## show select in action -> set.seed(1) -> take <- sample(ncol(BCI), 50) -> plot(mod, dis="sp", type="n") -> stems <- colSums(BCI) -> orditorp(mod, "sp", label = cnam, priority=stems, select = take, -+ pch="+", pcol="grey") -> ## Don't show: -> ## example(orditorp) should not set random seed in the user session -> rm(.Random.seed) -> ## End(Don't show) -> -> -> -> cleanEx() -> nameEx("ordixyplot") -> ### * ordixyplot -> -> flush(stderr()); flush(stdout()) -> -> ### Name: ordixyplot -> ### Title: Trellis (Lattice) Plots for Ordination -> ### Aliases: ordixyplot ordisplom ordicloud panel.ordi panel.ordiarrows -> ### panel.ordi3d prepanel.ordi3d ordilattice.getEnvfit -> ### Keywords: hplot -> -> ### ** Examples -> -> data(dune, dune.env) -> ord <- cca(dune) -> ## Pairs plots -> ordisplom(ord) -> ordisplom(ord, data=dune.env, choices=1:2) -> ordisplom(ord, data=dune.env, form = ~ . | Management, groups=Manure) -> ## Scatter plot with polygons -> ordixyplot(ord, data=dune.env, form = CA1 ~ CA2 | Management, -+ groups=Manure, type = c("p","polygon")) -> ## Choose a different scaling -> ordixyplot(ord, scaling = "symmetric") -> ## ... Slices of third axis -> ordixyplot(ord, form = CA1 ~ CA2 | equal.count(CA3, 4), -+ type = c("g","p", "polygon")) -> ## Display environmental variables -> ordixyplot(ord, envfit = envfit(ord ~ Management + A1, dune.env, choices=1:3)) -> ## 3D Scatter plots -> ordicloud(ord, form = CA2 ~ CA3*CA1, groups = Manure, data = dune.env) -> ordicloud(ord, form = CA2 ~ CA3*CA1 | Management, groups = Manure, -+ data = dune.env, auto.key = TRUE, type = c("p","h")) -> -> -> -> cleanEx() -> nameEx("pcnm") -> ### * pcnm -> -> flush(stderr()); flush(stdout()) -> -> ### Name: pcnm -> ### Title: Principal Coordinates of Neighbourhood Matrix -> ### Aliases: pcnm scores.pcnm -> ### Keywords: spatial multivariate -> -> ### ** Examples -> -> ## Example from Borcard & Legendre (2002) -> data(mite.xy) -> pcnm1 <- pcnm(dist(mite.xy)) -> op <- par(mfrow=c(1,3)) -> ## Map of PCNMs in the sample plot -> ordisurf(mite.xy, scores(pcnm1, choi=1), bubble = 4, main = "PCNM 1") - -Family: gaussian -Link function: identity - -Formula: -y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE) - -Estimated degrees of freedom: -8.71 total = 9.71 - -REML score: -120.7705 -> ordisurf(mite.xy, scores(pcnm1, choi=2), bubble = 4, main = "PCNM 2") - -Family: gaussian -Link function: identity - -Formula: -y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE) - -Estimated degrees of freedom: -7.18 total = 8.18 - -REML score: -103.4662 -> ordisurf(mite.xy, scores(pcnm1, choi=3), bubble = 4, main = "PCNM 3") - -Family: gaussian -Link function: identity - -Formula: -y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE) - -Estimated degrees of freedom: -8.32 total = 9.32 - -REML score: -94.19053 -> par(op) -> ## Plot first PCNMs against each other -> ordisplom(pcnm1, choices=1:4) -> ## Weighted PCNM for CCA -> data(mite) -> rs <- rowSums(mite)/sum(mite) -> pcnmw <- pcnm(dist(mite.xy), w = rs) -> ord <- cca(mite ~ scores(pcnmw)) -> ## Multiscale ordination: residual variance should have no distance -> ## trend -> msoplot(mso(ord, mite.xy)) -> -> -> -> graphics::par(get("par.postscript", pos = 'CheckExEnv')) -> cleanEx() -> nameEx("permatfull") -> ### * permatfull -> -> flush(stderr()); flush(stdout()) -> -> ### Name: permat -> ### Title: Matrix Permutation Algorithms for Presence-Absence and Count -> ### Data -> ### Aliases: permatfull permatswap summary.permat print.summary.permat -> ### print.permat plot.permat lines.permat as.ts.permat toCoda.permat -> ### Keywords: multivariate datagen -> -> ### ** Examples -> -> ## A simple artificial community data matrix. -> m <- matrix(c( -+ 1,3,2,0,3,1, -+ 0,2,1,0,2,1, -+ 0,0,1,2,0,3, -+ 0,0,0,1,4,3 -+ ), 4, 6, byrow=TRUE) -> ## Using the quasiswap algorithm to create a -> ## list of permuted matrices, where -> ## row/columns sums and matrix fill are preserved: -> x1 <- permatswap(m, "quasiswap") -> summary(x1) -Summary of object of class 'permat' - -Call: permatswap(m = m, method = "quasiswap") - -Matrix type: count -Permutation type: swap -Method: quasiswap_count, burnin: 0, thin: 1 -Restricted: FALSE -Fixed margins: both - -Matrix dimensions: 4 rows, 6 columns -Sum of original matrix: 30 -Fill of original matrix: 0.62 -Number of permuted matrices: 99 - -Matrix sums retained: 100 % -Matrix fill retained: 100 % -Row sums retained: 100 % -Column sums retained: 100 % -Row incidences retained: 5.05 % -Column incidences retained: 3.03 % - -Bray-Curtis dissimilarities among original and permuted matrices: - Min. 1st Qu. Median Mean 3rd Qu. Max. - 0.1333 0.3667 0.4333 0.4152 0.4667 0.6000 - -Chi-squared for original matrix: 18.55 -Chi-squared values among expected and permuted matrices: - Min. 1st Qu. Median Mean 3rd Qu. Max. - 16.30 19.55 20.66 21.29 23.25 30.38 -> ## Unrestricted permutation retaining -> ## row/columns sums but not matrix fill: -> x2 <- permatfull(m) -> summary(x2) -Summary of object of class 'permat' - -Call: permatfull(m = m) - -Matrix type: count -Permutation type: full -Method: r2dtable -Restricted: FALSE -Fixed margins: both - -Matrix dimensions: 4 rows, 6 columns -Sum of original matrix: 30 -Fill of original matrix: 0.62 -Number of permuted matrices: 99 - -Matrix sums retained: 100 % -Matrix fill retained: 14.14 % -Row sums retained: 100 % -Column sums retained: 100 % -Row incidences retained: 1.01 % -Column incidences retained: 1.01 % - -Bray-Curtis dissimilarities among original and permuted matrices: - Min. 1st Qu. Median Mean 3rd Qu. Max. - 0.1667 0.3333 0.3667 0.3798 0.4333 0.5667 - -Chi-squared for original matrix: 18.55 -Chi-squared values among expected and permuted matrices: - Min. 1st Qu. Median Mean 3rd Qu. Max. - 7.076 12.497 15.159 16.025 18.648 33.716 -> ## Unrestricted permutation of presence-absence type -> ## not retaining row/columns sums: -> x3 <- permatfull(m, "none", mtype="prab") -> x3$orig ## note: original matrix is binarized! - [,1] [,2] [,3] [,4] [,5] [,6] -[1,] 1 1 1 0 1 1 -[2,] 0 1 1 0 1 1 -[3,] 0 0 1 1 0 1 -[4,] 0 0 0 1 1 1 -> summary(x3) -Summary of object of class 'permat' - -Call: permatfull(m = m, fixedmar = "none", mtype = "prab") - -Matrix type: prab -Permutation type: full -Method: r00 -Restricted: FALSE -Fixed margins: none -Individuals and samples are shuffled - -Matrix dimensions: 4 rows, 6 columns -Sum of original matrix: 15 -Fill of original matrix: 0.62 -Number of permuted matrices: 99 - -Matrix sums retained: 100 % -Matrix fill retained: 100 % -Row sums retained: 1.01 % -Column sums retained: 0 % -Row incidences retained: 1.01 % -Column incidences retained: 0 % - -Bray-Curtis dissimilarities among original and permuted matrices: - Min. 1st Qu. Median Mean 3rd Qu. Max. - 0.2000 0.3333 0.4000 0.3764 0.4000 0.6000 - -Chi-squared for original matrix: 8.4 -Chi-squared values among expected and permuted matrices: - Min. 1st Qu. Median Mean 3rd Qu. Max. - 9.583 14.219 15.688 15.747 17.510 20.771 -> ## Restricted permutation, -> ## check sums within strata: -> x4 <- permatfull(m, strata=c(1,1,2,2)) -> summary(x4) -Summary of object of class 'permat' - -Call: permatfull(m = m, strata = c(1, 1, 2, 2)) - -Matrix type: count -Permutation type: full -Method: r2dtable -Restricted: TRUE -Fixed margins: both - -Matrix dimensions: 4 rows, 6 columns -Sum of original matrix: 30 -Fill of original matrix: 0.62 -Number of permuted matrices: 99 - -Matrix sums retained: 100 % -Matrix fill retained: 37.37 % -Row sums retained: 100 % -Column sums retained: 100 % -Row incidences retained: 0 % -Column incidences retained: 3.03 % -Sums within strata retained: 100 % - -Bray-Curtis dissimilarities among original and permuted matrices: - Min. 1st Qu. Median Mean 3rd Qu. Max. -0.06667 0.20000 0.20000 0.22424 0.26667 0.33333 - -Chi-squared for original matrix: 18.55 -Chi-squared values among expected and permuted matrices: - Min. 1st Qu. Median Mean 3rd Qu. Max. - 14.21 18.40 21.05 21.39 24.44 31.19 -> -> ## NOTE: 'times' argument usually needs to be >= 99 -> ## here much lower value is used for demonstration -> -> ## Not sequential algorithm -> data(BCI) -> a <- permatswap(BCI, "quasiswap", times=19) -> ## Sequential algorithm -> b <- permatswap(BCI, "abuswap", fixedmar="col", -+ burnin=0, thin=100, times=19) -> opar <- par(mfrow=c(2,2)) -> plot(a, main="Not sequential") -> plot(b, main="Sequential") -> plot(a, "chisq") -> plot(b, "chisq") -> par(opar) -> ## Extract Bray-Curtis dissimilarities -> ## as time series -> bc <- as.ts(b) -> ## Lag plot -> lag.plot(bc) -> ## First order autoregressive model -> mar <- arima(bc, c(1,0,0)) -> mar - -Call: -arima(x = bc, order = c(1, 0, 0)) - -Coefficients: - ar1 intercept - 0.9918 0.1877 -s.e. 0.0116 0.1443 - -sigma^2 estimated as 0.0003659: log likelihood = 46.16, aic = -86.32 -> ## Ljung-Box test of residuals -> Box.test(residuals(mar)) - - Box-Pierce test - -data: residuals(mar) -X-squared = 0.40156, df = 1, p-value = 0.5263 - -> ## Graphical diagnostics -> tsdiag(mar) -> -> -> -> graphics::par(get("par.postscript", pos = 'CheckExEnv')) -> cleanEx() -> nameEx("permustats") -> ### * permustats -> -> flush(stderr()); flush(stdout()) -> -> ### Name: permustats -> ### Title: Extract, Analyse and Display Permutation Results -> ### Aliases: permustats permustats.anosim permustats.anova.cca -> ### permustats.CCorA permustats.envfit permustats.factorfit -> ### permustats.mantel permustats.mrpp permustats.mso permustats.oecosimu -> ### permustats.ordiareatest permustats.permutest.betadisper -> ### permustats.permutest.cca permustats.protest permustats.vectorfit -> ### summary.permustats c.permustats densityplot.permustats -> ### density.permustats qqnorm.permustats qqmath.permustats -> ### boxplot.permustats pairs.permustats -> ### Keywords: distribution smooth -> -> ### ** Examples -> -> data(dune, dune.env) -> mod <- adonis2(dune ~ Management + A1, data = dune.env) -> ## use permustats -> perm <- permustats(mod) -> summary(perm) - - statistic SES mean lower median upper Pr(perm) -Management 3.0730 4.9011 1.0124 0.9446 1.7788 0.002 ** -A1 2.7676 2.8132 1.0364 0.9039 2.2849 0.021 * ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -(Interval (Upper - Lower) = 0.95) -> densityplot(perm) -> qqmath(perm) -> boxplot(perm, scale=TRUE, lty=1, pch=16, cex=0.6, col="hotpink", ylab="SES") -> abline(h=0, col="skyblue") -> ## example of multiple types of statistic -> mod <- with(dune.env, betadisper(vegdist(dune), Management)) -> pmod <- permutest(mod, nperm = 99, pairwise = TRUE) -> perm <- permustats(pmod) -> summary(perm, interval = 0.90) - - statistic SES mean lower median upper Pr(perm) -Overall (F) 1.9506 0.7790 1.1108 0.7617 2.4904 0.168 -BF-HF (t) -0.5634 -0.4990 -0.0020 -1.7690 -0.0382 1.8192 0.573 -BF-NM (t) -2.2387 -1.8876 0.0153 -1.8120 -0.0146 2.0067 0.061 . -BF-SF (t) -1.1675 -0.9769 -0.0117 -1.9015 -0.0534 1.8619 0.251 -HF-NM (t) -2.1017 -1.8404 0.0186 -1.9587 0.0631 1.8701 0.077 . -HF-SF (t) -0.8789 -0.7233 -0.0232 -1.8836 0.0540 1.7446 0.423 -NM-SF (t) 0.9485 0.8665 -0.0381 -1.8811 -0.0455 1.9683 0.325 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -(Interval (Upper - Lower) = 0.9) -> -> -> -> cleanEx() -> nameEx("permutest.betadisper") -> ### * permutest.betadisper -> -> flush(stderr()); flush(stdout()) -> -> ### Name: permutest.betadisper -> ### Title: Permutation test of multivariate homogeneity of groups -> ### dispersions (variances) -> ### Aliases: permutest.betadisper -> ### Keywords: methods multivariate -> -> ### ** Examples -> -> data(varespec) -> -> ## Bray-Curtis distances between samples -> dis <- vegdist(varespec) -> -> ## First 16 sites grazed, remaining 8 sites ungrazed -> groups <- factor(c(rep(1,16), rep(2,8)), labels = c("grazed","ungrazed")) -> -> ## Calculate multivariate dispersions -> mod <- betadisper(dis, groups) -> mod - - Homogeneity of multivariate dispersions - -Call: betadisper(d = dis, group = groups) - -No. of Positive Eigenvalues: 15 -No. of Negative Eigenvalues: 8 - -Average distance to median: - grazed ungrazed - 0.3926 0.2706 - -Eigenvalues for PCoA axes: -(Showing 8 of 23 eigenvalues) - PCoA1 PCoA2 PCoA3 PCoA4 PCoA5 PCoA6 PCoA7 PCoA8 -1.7552 1.1334 0.4429 0.3698 0.2454 0.1961 0.1751 0.1284 -> -> ## Perform test -> anova(mod) -Analysis of Variance Table - -Response: Distances - Df Sum Sq Mean Sq F value Pr(>F) -Groups 1 0.07931 0.079306 4.6156 0.04295 * -Residuals 22 0.37801 0.017182 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> ## Permutation test for F -> pmod <- permutest(mod, permutations = 99, pairwise = TRUE) -> -> ## Tukey's Honest Significant Differences -> (mod.HSD <- TukeyHSD(mod)) - Tukey multiple comparisons of means - 95% family-wise confidence level - -Fit: aov(formula = distances ~ group, data = df) - -$group - diff lwr upr p adj -ungrazed-grazed -0.1219422 -0.2396552 -0.004229243 0.0429502 - -> plot(mod.HSD) -> -> ## Has permustats() method -> pstat <- permustats(pmod) -> densityplot(pstat, scales = list(x = list(relation = "free"))) -> qqmath(pstat, scales = list(relation = "free")) -> -> -> -> cleanEx() -> nameEx("plot.cca") -> ### * plot.cca -> -> flush(stderr()); flush(stdout()) -> -> ### Name: plot.cca -> ### Title: Plot or Extract Results of Constrained Correspondence Analysis -> ### or Redundancy Analysis -> ### Aliases: plot.cca text.cca points.cca scores.cca scores.rda summary.cca -> ### print.summary.cca head.summary.cca tail.summary.cca labels.cca -> ### Keywords: hplot aplot -> -> ### ** Examples -> -> data(dune) -> data(dune.env) -> mod <- cca(dune ~ A1 + Moisture + Management, dune.env) -> ## better control -- remember to set scaling etc identically -> plot(mod, type="n", scaling="sites") -> text(mod, dis="cn", scaling="sites") -> points(mod, pch=21, col="red", bg="yellow", cex=1.2, scaling="sites") -> text(mod, "species", col="blue", cex=0.8, scaling="sites") -> ## catch the invisible result and use ordiplot support - the example -> ## will make a biplot with arrows for species and correlation scaling -> pca <- rda(dune) -> pl <- plot(pca, type="n", scaling="sites", correlation=TRUE) -> with(dune.env, points(pl, "site", pch=21, col=1, bg=Management)) -> text(pl, "sp", arrow=TRUE, length=0.05, col=4, cex=0.6, xpd=TRUE) -> with(dune.env, legend("bottomleft", levels(Management), pch=21, pt.bg=1:4, bty="n")) -> ## Limited output of 'summary' (NB. Signs of axes are arbitrary and can change -> ## when the command is run repeatedly). -> ## IGNORE_RDIFF_BEGIN -> head(summary(mod), tail=2) - -Call: -cca(formula = dune ~ A1 + Moisture + Management, data = dune.env) - -Partitioning of scaled Chi-square: - Inertia Proportion -Total 2.1153 1.0000 -Constrained 1.1392 0.5385 -Unconstrained 0.9761 0.4615 - -Eigenvalues, and their contribution to the scaled Chi-square - -Importance of components: - CCA1 CCA2 CCA3 CCA4 CCA5 CCA6 CCA7 -Eigenvalue 0.4483 0.3001 0.14995 0.10733 0.05668 0.04335 0.03345 -Proportion Explained 0.2119 0.1419 0.07089 0.05074 0.02680 0.02050 0.01581 -Cumulative Proportion 0.2119 0.3538 0.42470 0.47544 0.50223 0.52273 0.53855 - CA1 CA2 CA3 CA4 CA5 CA6 CA7 -Eigenvalue 0.3064 0.13191 0.11516 0.10947 0.07724 0.07575 0.04871 -Proportion Explained 0.1448 0.06236 0.05444 0.05175 0.03652 0.03581 0.02303 -Cumulative Proportion 0.6834 0.74574 0.80018 0.85194 0.88845 0.92427 0.94730 - CA8 CA9 CA10 CA11 CA12 -Eigenvalue 0.03758 0.03106 0.021024 0.012542 0.009277 -Proportion Explained 0.01777 0.01468 0.009939 0.005929 0.004386 -Cumulative Proportion 0.96506 0.97975 0.989685 0.995614 1.000000 - -Accumulated constrained eigenvalues -Importance of components: - CCA1 CCA2 CCA3 CCA4 CCA5 CCA6 CCA7 -Eigenvalue 0.4483 0.3001 0.1499 0.10733 0.05668 0.04335 0.03345 -Proportion Explained 0.3935 0.2635 0.1316 0.09422 0.04976 0.03806 0.02937 -Cumulative Proportion 0.3935 0.6570 0.7886 0.88282 0.93258 0.97063 1.00000 - -Scaling 2 for species and site scores -* Species are scaled proportional to eigenvalues -* Sites are unscaled: weighted dispersion equal on all dimensions - - -Species scores - - CCA1 CCA2 CCA3 CCA4 CCA5 CCA6 -Achimill 0.8150 0.4375 -0.11236 0.35595 -0.114763 -0.01972 -Agrostol -0.7488 -0.4783 0.03561 0.17039 0.187389 0.23471 -Airaprae -0.8186 1.7469 1.04506 -0.28593 0.191836 0.73077 -Alopgeni -0.3442 -1.0216 0.37620 0.02296 -0.004041 0.04789 -Anthodor 0.3367 0.7694 -0.07602 -0.05421 0.136354 0.42463 -Bellpere 0.6535 0.2200 0.03438 0.60436 -0.090469 0.28138 -.... -Bracruta -0.1309 0.2009 -0.03708 -0.17421 -0.109657 0.04381 -Callcusp -1.5181 0.3834 -0.23255 0.15246 0.104239 -0.11424 - - -Site scores (weighted averages of species scores) - - CCA1 CCA2 CCA3 CCA4 CCA5 CCA6 -1 1.2468 -0.4017 0.91955 0.7292 1.5785 -1.0196 -2 0.8622 -0.1641 0.25789 1.7240 -0.7592 -0.6479 -3 0.3165 -0.9785 0.82952 0.7451 0.6556 0.3256 -4 0.2405 -0.8699 1.07861 1.4103 1.1164 2.4714 -5 1.1362 0.2621 -1.10847 -0.9417 0.5630 1.1495 -6 1.0575 0.4041 -1.65035 -1.8483 1.0287 -0.1690 -.... -19 -0.7913 2.7451 2.93017 -1.3851 -0.3932 1.7277 -20 -2.0770 1.0113 -0.02581 -0.8949 1.6406 -1.7917 - - -Site constraints (linear combinations of constraining variables) - - CCA1 CCA2 CCA3 CCA4 CCA5 CCA6 -1 0.7245 -0.3695 1.25652 -0.3678 0.9827 -0.60590 -2 0.9033 0.4250 0.03901 1.0557 -1.0860 -1.61234 -3 0.4493 -0.6694 0.67765 0.8695 0.9609 1.52307 -4 0.4550 -0.6532 0.72768 0.8529 0.9795 1.50218 -5 0.9671 -0.2010 -1.93972 -0.5807 0.2582 0.31905 -6 1.0805 0.1235 -0.93911 -0.9126 0.6307 -0.09863 -.... -19 -1.4581 1.6074 1.16812 -0.5305 0.3178 -0.40336 -20 -1.4468 1.6399 1.26818 -0.5637 0.3551 -0.44513 - - -Biplot scores for constraining variables - - CCA1 CCA2 CCA3 CCA4 CCA5 CCA6 -A1 -0.5554 -0.1617 -0.67982 0.10708 -0.17998 0.30507 -Moisture.L -0.9437 -0.1638 0.07974 -0.02238 0.03067 -0.02368 -Moisture.Q -0.1876 0.3571 -0.45352 -0.17237 0.28350 -0.63025 -Moisture.C -0.2069 0.1732 0.10635 0.68203 0.50123 0.35887 -ManagementHF 0.3645 -0.1171 -0.42202 -0.67746 0.17212 -0.12317 -ManagementNM -0.5855 0.7267 -0.01115 -0.09642 -0.11445 0.27037 -ManagementSF -0.1511 -0.6957 0.38543 0.24770 0.29469 0.23829 - - -Centroids for factor constraints - - CCA1 CCA2 CCA3 CCA4 CCA5 CCA6 -Moisture1 0.9119 0.35388 -0.40013 -0.26218 0.02084 -0.4708 -Moisture2 0.5015 -0.06706 0.60222 1.12478 0.33942 1.2024 -Moisture4 -0.1522 -1.35873 0.76544 -1.37289 -1.80794 0.3849 -Moisture5 -1.3394 0.11972 -0.20942 0.04843 0.39751 -0.3902 -ManagementBF 0.8376 0.41614 0.13885 1.40679 -0.97766 -0.9604 -ManagementHF 0.5426 -0.17426 -0.62822 -1.00848 0.25622 -0.1834 -ManagementNM -1.1010 1.36665 -0.02097 -0.18131 -0.21523 0.5084 -ManagementSF -0.2320 -1.06831 0.59183 0.38035 0.45250 0.3659 - -> ## IGNORE_RDIFF_END -> ## Scaling can be numeric or more user-friendly names -> ## e.g. Hill's scaling for (C)CA -> scrs <- scores(mod, scaling = "sites", hill = TRUE) -> ## or correlation-based scores in PCA/RDA -> scrs <- scores(rda(dune ~ A1 + Moisture + Management, dune.env), -+ scaling = "sites", correlation = TRUE) -> -> -> -> cleanEx() -> nameEx("prc") -> ### * prc -> -> flush(stderr()); flush(stdout()) -> -> ### Name: prc -> ### Title: Principal Response Curves for Treatments with Repeated -> ### Observations -> ### Aliases: prc summary.prc plot.prc -> ### Keywords: multivariate -> -> ### ** Examples -> -> ## Chlorpyrifos experiment and experimental design: Pesticide -> ## treatment in ditches (replicated) and followed over from 4 weeks -> ## before to 24 weeks after exposure -> data(pyrifos) -> week <- gl(11, 12, labels=c(-4, -1, 0.1, 1, 2, 4, 8, 12, 15, 19, 24)) -> dose <- factor(rep(c(0.1, 0, 0, 0.9, 0, 44, 6, 0.1, 44, 0.9, 0, 6), 11)) -> ditch <- gl(12, 1, length=132) -> -> ## IGNORE_RDIFF_BEGIN -> ## PRC -> mod <- prc(pyrifos, dose, week) -> mod # RDA -Call: prc(response = pyrifos, treatment = dose, time = week) - - Inertia Proportion Rank -Total 288.9920 1.0000 -Conditional 63.3493 0.2192 10 -Constrained 96.6837 0.3346 44 -Unconstrained 128.9589 0.4462 77 -Inertia is variance - -Eigenvalues for constrained axes: - RDA1 RDA2 RDA3 RDA4 RDA5 RDA6 RDA7 RDA8 RDA9 RDA10 RDA11 -25.282 8.297 6.044 4.766 4.148 3.857 3.587 3.334 3.087 2.551 2.466 - RDA12 RDA13 RDA14 RDA15 RDA16 RDA17 RDA18 RDA19 RDA20 RDA21 RDA22 - 2.209 2.129 1.941 1.799 1.622 1.579 1.440 1.398 1.284 1.211 1.133 - RDA23 RDA24 RDA25 RDA26 RDA27 RDA28 RDA29 RDA30 RDA31 RDA32 RDA33 - 1.001 0.923 0.862 0.788 0.750 0.712 0.685 0.611 0.584 0.537 0.516 - RDA34 RDA35 RDA36 RDA37 RDA38 RDA39 RDA40 RDA41 RDA42 RDA43 RDA44 - 0.442 0.417 0.404 0.368 0.340 0.339 0.306 0.279 0.271 0.205 0.179 - -Eigenvalues for unconstrained axes: - PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 -17.156 9.189 7.585 6.064 5.730 4.843 4.518 4.105 -(Showing 8 of 77 unconstrained eigenvalues) - -> summary(mod) # PRC - -Call: -prc(response = pyrifos, treatment = dose, time = week) -Species scores: - Simve Daplo Cerpu Alogu Aloco Alore Aloaf Copsp --1.461934 -0.796510 -0.295171 -0.152301 -0.096273 -0.171335 -0.231967 -0.635966 - Ostsp Slyla Acrha Aloex Chysp Alona Plead Oxyte --1.257492 0.302872 -0.057396 -0.124049 -0.051689 -0.034638 -0.075268 -0.013815 - Grate Copdi NauLa CilHa Strvi amosp Ascmo Synsp --0.052667 -0.777088 -2.636100 -0.486881 -1.669474 0.738371 -0.037926 0.014409 - Squro Squmu Polar Kerqu Anufi Mytve Mytvi Mytmu --0.143790 0.246185 -0.251255 -0.269397 -0.235362 -0.040448 -0.049452 -0.057589 - Lepsp Leppa Colob Colbi Colun Lecsp Lecqu Lecco --0.542922 -0.046123 0.393234 0.075905 0.450495 -0.257170 0.048327 0.158007 - Leclu Lecfl Tripo Cepsp Monlo Monae Scalo Trilo --0.027077 0.221912 -0.117056 0.440303 0.287108 0.048918 0.041981 0.021257 - Tripo.1 Tricy Trisp Tepat Rotne Notla Filsp Lopox --0.134025 -0.182409 -0.042651 -0.004198 -0.078168 0.062163 0.091561 0.016854 - hydrspec bothrosp olchaeta erpoocto glsicomp alglhete hebdstag sphidae - 0.026485 -0.216815 0.633674 0.490029 0.078527 0.039728 -0.490678 -0.796015 - ansuvote armicris bathcont binitent gyraalbu hippcomp lymnstag lymnaes7 --0.076512 -0.913681 -0.039855 1.060788 -0.017975 -0.219974 0.143403 -0.073502 - physfont plbacorn popyanti radiovat radipere valvcris valvpisc hycarina - 0.014349 -0.046098 -0.691904 0.010777 0.340163 -0.005753 0.145523 -0.567803 - gammpule aselaqua proameri collembo caenhora caenluct caenrobu cloedipt --0.830166 -0.858606 -0.063401 -0.016264 -3.136867 -1.292300 -0.068624 -2.574625 - cloesimi aeshniae libellae conagrae corident coripanz coripunc cymabons --0.675580 -0.115677 0.044524 -0.886795 -0.007484 -0.065501 0.096124 -0.025213 - hesplinn hespsahl notoglau notomacu notoobli notoviri pacoconc pleaminu - 0.037779 -0.018078 -0.301948 -0.027226 -0.044790 -0.117398 -0.009087 -0.038705 - sigadist sigafall sigastri sigarasp colyfusc donacis6 gyrimari haliconf --0.041594 0.009987 -0.032743 0.150817 -0.019847 0.042751 -0.005753 -0.243054 - haliflav haligruf haliobli herubrev hya_herm hyglpusi hyhyovat hypoplan --0.024222 -0.244814 -0.071501 0.069877 0.175327 0.006404 -0.013159 -0.008145 - hyporusp hytuinae hytuvers laphminu noteclav rhantusp sialluta ablalong --0.126197 -1.259664 -0.963901 -0.344204 -0.004303 -0.036774 -0.603320 -0.008145 - ablaphmo cltanerv malopisp mopetenu prdiussp pstavari chironsp crchirsp --1.627590 -0.041132 -0.025919 -0.004740 -0.301790 -0.045054 -1.027839 -0.009087 - crclglat ditendsp mitegchl pachgarc pachgvit popegnub popedisp acriluce --0.015746 -0.045402 -0.125429 0.006628 0.016265 -0.121971 0.037879 0.004324 - chclpige conescut cricotsp liesspec psclbarb psclgsli psclobvi psclplat - 0.004756 -0.446524 -0.066095 -0.058403 0.015576 -0.327165 0.197081 0.028310 - psclpsil pscladsp cladotsp laa_spec patanysp tatarssp zaa_spec anopmacu --0.003991 -0.003086 -0.293623 -0.018548 -0.079841 -0.364072 -0.027165 0.089046 - cepogoae chaoobsc cucidae4 tabanusp agdasphr athrater cyrncren holodubi --1.389767 -1.328261 -0.018078 0.006309 -0.147828 -0.036774 -0.038705 -0.051532 - holopici leceriae lilurhom monaangu mystazur mystloni oecefurv oecelacu --0.332631 -0.162413 -0.004929 -0.350402 -0.018078 -1.630725 -0.291847 -0.140893 - triabico paponysp --0.048357 -0.053182 - -Coefficients for dose + week:dose interaction -which are contrasts to dose 0 -rows are dose, columns are week - -4 -1 0.1 1 2 4 8 12 15 -0.1 0.01335 0.02543 0.01887 0.007525 0.03886 0.02524 0.01494 0.02841 0.02077 -0.9 0.01500 0.03580 0.03582 0.088245 0.09207 0.07966 0.02503 0.06563 0.04455 -6 0.03074 0.02280 0.08397 0.213933 0.20045 0.21296 0.10381 0.08691 0.05695 -44 0.02586 0.03623 0.13520 0.233266 0.24009 0.27059 0.23891 0.18650 0.14465 - 19 24 -0.1 0.04002 0.01449 -0.9 0.03249 0.02857 -6 0.06091 0.03372 -44 0.10672 0.05739 -> logabu <- colSums(pyrifos) -> plot(mod, select = logabu > 100) -> ## IGNORE_RDIFF_END -> ## Ditches are randomized, we have a time series, and are only -> ## interested in the first axis -> ctrl <- how(plots = Plots(strata = ditch,type = "free"), -+ within = Within(type = "series"), nperm = 99) -> anova(mod, permutations = ctrl, first=TRUE) -Permutation test for rda under reduced model -Plots: ditch, plot permutation: free -Permutation: series -Number of permutations: 99 - -Model: prc(response = pyrifos, treatment = dose, time = week) - Df Variance F Pr(>F) -RDA1 1 25.282 15.096 0.01 ** -Residual 77 128.959 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> -> -> cleanEx() -> nameEx("predict.cca") -> ### * predict.cca -> -> flush(stderr()); flush(stdout()) -> -> ### Name: predict.cca -> ### Title: Prediction Tools for [Constrained] Ordination (CCA, RDA, DCA, -> ### CA, PCA) -> ### Aliases: fitted.cca fitted.rda fitted.capscale fitted.dbrda -> ### residuals.cca predict.cca predict.rda predict.decorana coef.cca -> ### coef.rda calibrate.cca calibrate -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(dune) -> data(dune.env) -> mod <- cca(dune ~ A1 + Management + Condition(Moisture), data=dune.env) -> # Definition of the concepts 'fitted' and 'residuals' -> mod -Call: cca(formula = dune ~ A1 + Management + Condition(Moisture), data -= dune.env) - - Inertia Proportion Rank -Total 2.1153 1.0000 -Conditional 0.6283 0.2970 3 -Constrained 0.5109 0.2415 4 -Unconstrained 0.9761 0.4615 12 -Inertia is scaled Chi-square - -Eigenvalues for constrained axes: - CCA1 CCA2 CCA3 CCA4 -0.24932 0.12090 0.08160 0.05904 - -Eigenvalues for unconstrained axes: - CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8 CA9 CA10 -0.30637 0.13191 0.11516 0.10947 0.07724 0.07575 0.04871 0.03758 0.03106 0.02102 - CA11 CA12 -0.01254 0.00928 - -> cca(fitted(mod)) -Call: cca(X = fitted(mod)) - - Inertia Rank -Total 0.5109 -Unconstrained 0.5109 4 -Inertia is scaled Chi-square - -Eigenvalues for unconstrained axes: - CA1 CA2 CA3 CA4 -0.24932 0.12090 0.08160 0.05904 - -> cca(residuals(mod)) -Call: cca(X = residuals(mod)) - - Inertia Rank -Total 0.9761 -Unconstrained 0.9761 12 -Inertia is scaled Chi-square - -Eigenvalues for unconstrained axes: - CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8 CA9 CA10 -0.30637 0.13191 0.11516 0.10947 0.07724 0.07575 0.04871 0.03758 0.03106 0.02102 - CA11 CA12 -0.01254 0.00928 - -> # Remove rare species (freq==1) from 'cca' and find their scores -> # 'passively'. -> freq <- specnumber(dune, MARGIN=2) -> freq -Achimill Agrostol Airaprae Alopgeni Anthodor Bellpere Bromhord Chenalbu - 7 10 2 8 6 6 5 1 -Cirsarve Comapalu Eleopalu Elymrepe Empenigr Hyporadi Juncarti Juncbufo - 1 2 5 6 1 3 5 4 -Lolipere Planlanc Poaprat Poatriv Ranuflam Rumeacet Sagiproc Salirepe - 12 7 14 13 6 5 7 3 -Scorautu Trifprat Trifrepe Vicilath Bracruta Callcusp - 18 3 16 3 15 3 -> mod <- cca(dune[, freq>1] ~ A1 + Management + Condition(Moisture), dune.env) -> ## IGNORE_RDIFF_BEGIN -> predict(mod, type="sp", newdata=dune[, freq==1], scaling="species") - CCA1 CCA2 CCA3 CCA4 -Chenalbu 1.5737337 -0.7842538 0.5503660 0.35108333 -Cirsarve 0.5945146 -0.3714228 -0.2862647 0.88373727 -Empenigr -1.8771953 -0.9904299 -0.2446222 0.04858656 -> # New sites -> predict(mod, type="lc", new=data.frame(A1 = 3, Management="NM", Moisture="2"), scal=2) - CCA1 CCA2 CCA3 CCA4 -1 -2.38829 -1.230652 -0.2363485 -0.3338258 -> # Calibration and residual plot -> mod <- cca(dune ~ A1 + Moisture, dune.env) -> pred <- calibrate(mod) -> pred - A1 Moisture.L Moisture.Q Moisture.C -1 2.2630533 -0.62633470 -0.20456759 0.220761764 -2 4.0510042 -0.47341146 -0.36986691 0.474939409 -3 4.2752294 -0.07214500 -0.60797514 0.303213289 -4 4.5398659 0.03192745 -1.12417368 0.932223234 -5 5.0409406 -0.84235946 0.43000738 -0.291599200 -6 5.1962100 -0.91316862 1.11354235 -0.804453944 -7 4.2452549 -0.76452556 0.60464291 -0.484842066 -8 5.0208369 0.43886340 0.08169514 0.132995916 -9 4.2663219 0.10720486 -0.34067849 -0.675151598 -10 4.0411356 -0.65472729 0.02832164 0.558402684 -11 2.8280051 -0.45762457 0.63079135 -0.089977975 -12 5.1204137 0.36328912 -0.69118581 -0.665622948 -13 4.9034218 0.47069541 -0.54378271 -0.118643453 -14 11.6455841 0.60920550 0.78341426 0.532852308 -15 10.7829689 0.69208513 0.82190786 0.237311062 -16 7.9892176 0.96421599 0.46793089 0.373647014 -17 0.9218684 -0.15822891 0.14593271 1.189161582 -18 3.1680733 -0.41737900 1.03352732 -0.236938282 -19 -1.2003506 0.57033354 0.72777285 0.509955590 -20 4.7876770 1.00324330 1.49898460 0.009202396 -> ## IGNORE_RDIFF_END -> with(dune.env, plot(A1, pred[,"A1"] - A1, ylab="Prediction Error")) -> abline(h=0) -> -> -> -> cleanEx() -> nameEx("procrustes") -> ### * procrustes -> -> flush(stderr()); flush(stdout()) -> -> ### Name: procrustes -> ### Title: Procrustes Rotation of Two Configurations and PROTEST -> ### Aliases: procrustes summary.procrustes plot.procrustes -> ### points.procrustes text.procrustes lines.procrustes -> ### residuals.procrustes fitted.procrustes predict.procrustes protest -> ### Keywords: multivariate htest -> -> ### ** Examples -> -> ## IGNORE_RDIFF_BEGIN -> data(varespec) -> vare.dist <- vegdist(wisconsin(varespec)) -> mds.null <- monoMDS(vare.dist, y = cmdscale(vare.dist)) -> mds.alt <- monoMDS(vare.dist) -> vare.proc <- procrustes(mds.alt, mds.null) -> vare.proc - -Call: -procrustes(X = mds.alt, Y = mds.null) - -Procrustes sum of squares: -13.14 - -> summary(vare.proc) - -Call: -procrustes(X = mds.alt, Y = mds.null) - -Number of objects: 24 Number of dimensions: 2 - -Procrustes sum of squares: - 13.14345 -Procrustes root mean squared error: - 0.7400296 -Quantiles of Procrustes errors: - Min 1Q Median 3Q Max -0.02066503 0.27659692 0.34159096 0.64205431 2.23604561 - -Rotation matrix: - [,1] [,2] -[1,] 0.9932435 -0.1160491 -[2,] 0.1160491 0.9932435 - -Translation of averages: - [,1] [,2] -[1,] -4.387224e-17 -1.687662e-17 - -Scaling of target: -[1] 0.6725743 - -> plot(vare.proc) -> plot(vare.proc, kind=2) -> residuals(vare.proc) - 18 15 24 27 23 19 22 -0.27976944 0.13140857 1.72924370 0.63751873 0.37264807 0.11879191 0.38594796 - 16 28 13 14 20 25 7 -0.28015244 1.22896982 0.65566108 0.26707936 0.02066503 0.35786951 0.28641010 - 5 6 3 4 2 9 12 -0.69626453 0.20211928 0.29701948 0.50148157 2.23604561 0.31896394 0.21769838 - 10 11 21 -0.32531240 0.56478951 0.78068916 -> ## IGNORE_RDIFF_END -> -> -> -> cleanEx() -> nameEx("pyrifos") -> ### * pyrifos -> -> flush(stderr()); flush(stdout()) -> -> ### Name: pyrifos -> ### Title: Response of Aquatic Invertebrates to Insecticide Treatment -> ### Aliases: pyrifos -> ### Keywords: datasets -> -> ### ** Examples -> -> data(pyrifos) -> ditch <- gl(12, 1, length=132) -> week <- gl(11, 12, labels=c(-4, -1, 0.1, 1, 2, 4, 8, 12, 15, 19, 24)) -> dose <- factor(rep(c(0.1, 0, 0, 0.9, 0, 44, 6, 0.1, 44, 0.9, 0, 6), 11)) -> -> -> -> cleanEx() -> nameEx("radfit") -> ### * radfit -> -> flush(stderr()); flush(stdout()) -> -> ### Name: radfit -> ### Title: Rank - Abundance or Dominance / Diversity Models -> ### Aliases: radfit radfit.default radfit.data.frame AIC.radfit -> ### AIC.radfit.frame as.rad coef.radfit coef.radfit.frame deviance.radfit -> ### deviance.radfit.frame 'logLik, radfit' 'logLik, radfit.frame' -> ### fitted.radfit fitted.radfit.frame lines.radline lines.radfit -> ### plot.radfit.frame plot.radfit plot.radline plot.rad radlattice -> ### points.radline points.radfit summary.radfit.frame rad.preempt -> ### rad.lognormal rad.zipf rad.zipfbrot rad.null predict.radline -> ### predict.radfit predict.radfit.frame -> ### Keywords: univar distribution -> -> ### ** Examples -> -> data(BCI) -> mod <- rad.lognormal(BCI[5,]) -> mod - -RAD model: Log-Normal -Family: poisson -No. of species: 101 -Total abundance: 505 - - log.mu log.sigma Deviance AIC BIC - 0.951926 1.165929 17.077549 317.656487 322.886728 -> plot(mod) -> mod <- radfit(BCI[1,]) -> ## Standard plot overlaid for all models -> ## Preemption model is a line -> plot(mod) -> ## log for both axes: Zipf model is a line -> plot(mod, log = "xy") -> ## Lattice graphics separately for each model -> radlattice(mod) -> # Take a subset of BCI to save time and nerves -> mod <- radfit(BCI[3:5,]) -> mod - -Deviance for RAD models: - - 3 4 5 -Null 86.1127 49.8111 80.855 -Preemption 58.9295 39.7817 76.311 -Lognormal 29.2719 16.6588 17.078 -Zipf 50.1262 47.9108 30.936 -Mandelbrot 5.7342 5.5665 10.573 -> plot(mod, pch=".") -> -> -> -> cleanEx() -> nameEx("rankindex") -> ### * rankindex -> -> flush(stderr()); flush(stdout()) -> -> ### Name: rankindex -> ### Title: Compares Dissimilarity Indices for Gradient Detection -> ### Aliases: rankindex -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(varespec) -> data(varechem) -> ## The variables are automatically scaled -> rankindex(varechem, varespec) - euc man gow bra kul -0.2396330 0.2735087 0.2288358 0.2837910 0.2839834 -> rankindex(varechem, wisconsin(varespec)) - euc man gow bra kul -0.4200990 0.4215642 0.3708606 0.4215642 0.4215642 -> ## Using non vegdist indices as functions -> funs <- list(Manhattan=function(x) dist(x, "manhattan"), -+ Gower=function(x) cluster:::daisy(x, "gower"), -+ Ochiai=function(x) designdist(x, "1-J/sqrt(A*B)")) -> rankindex(scale(varechem), varespec, funs) -Manhattan Gower Ochiai -0.2735087 0.2288358 0.1696862 -> -> -> -> cleanEx() -> nameEx("rarefy") -> ### * rarefy -> -> flush(stderr()); flush(stdout()) -> -> ### Name: rarefy -> ### Title: Rarefaction Species Richness -> ### Aliases: rarefy rrarefy drarefy rarecurve rareslope -> ### Keywords: univar -> -> ### ** Examples -> -> data(BCI) -> S <- specnumber(BCI) # observed number of species -> (raremax <- min(rowSums(BCI))) -[1] 340 -> Srare <- rarefy(BCI, raremax) -> plot(S, Srare, xlab = "Observed No. of Species", ylab = "Rarefied No. of Species") -> abline(0, 1) -> rarecurve(BCI, step = 20, sample = raremax, col = "blue", cex = 0.6) -> -> -> -> cleanEx() -> nameEx("raupcrick") -> ### * raupcrick -> -> flush(stderr()); flush(stdout()) -> -> ### Name: raupcrick -> ### Title: Raup-Crick Dissimilarity with Unequal Sampling Densities of -> ### Species -> ### Aliases: raupcrick -> ### Keywords: multivariate -> -> ### ** Examples -> -> ## data set with variable species richness -> data(sipoo) -> ## default raupcrick -> dr1 <- raupcrick(sipoo) -> ## use null model "r0" of oecosimu -> dr0 <- raupcrick(sipoo, null = "r0") -> ## vegdist(..., method = "raup") corresponds to 'null = "r0"' -> d <- vegdist(sipoo, "raup") -> op <- par(mfrow=c(2,1), mar=c(4,4,1,1)+.1) -> plot(dr1 ~ d, xlab = "Raup-Crick with Null R1", ylab="vegdist") -> plot(dr0 ~ d, xlab = "Raup-Crick with Null R0", ylab="vegdist") -> par(op) -> -> ## The calculation is essentially as in the following oecosimu() call, -> ## except that designdist() is replaced with faster code -> ## Not run: ##D -> ##D oecosimu(sipoo, function(x) designdist(x, "J", "binary"), method = "r1") -> ## End(Not run) -> -> -> -> graphics::par(get("par.postscript", pos = 'CheckExEnv')) -> cleanEx() -> nameEx("read.cep") -> ### * read.cep -> -> flush(stderr()); flush(stdout()) -> -> ### Name: read.cep -> ### Title: Reads a CEP (Canoco) data file -> ### Aliases: read.cep -> ### Keywords: IO file -> -> ### ** Examples -> -> ## Provided that you have the file "dune.spe" -> ## Not run: -> ##D theclassic <- read.cep("dune.spe") -> ## End(Not run) -> -> -> -> cleanEx() -> nameEx("renyi") -> ### * renyi -> -> flush(stderr()); flush(stdout()) -> -> ### Name: renyi -> ### Title: Renyi and Hill Diversities and Corresponding Accumulation Curves -> ### Aliases: renyi plot.renyi renyiaccum plot.renyiaccum persp.renyiaccum -> ### Keywords: univar -> -> ### ** Examples -> -> data(BCI) -> i <- sample(nrow(BCI), 12) -> mod <- renyi(BCI[i,]) -> plot(mod) -> mod <- renyiaccum(BCI[i,]) -> plot(mod, as.table=TRUE, col = c(1, 2, 2)) -> persp(mod) -> -> -> -> cleanEx() -> nameEx("reorder.hclust") -> ### * reorder.hclust -> -> flush(stderr()); flush(stdout()) -> -> ### Name: reorder.hclust -> ### Title: Reorder a Hierarchical Clustering Tree -> ### Aliases: reorder.hclust rev.hclust cutreeord scores.hclust -> ### Keywords: multivariate -> -> ### ** Examples -> -> ## reorder by water content of soil -> data(mite, mite.env) -> hc <- hclust(vegdist(wisconsin(sqrt(mite)))) -> ohc <- with(mite.env, reorder(hc, WatrCont)) -> plot(hc) -> plot(ohc) -> -> ## label leaves by the observed value, and each branching point -> ## (internal node) by the cluster mean -> with(mite.env, plot(ohc, labels=round(WatrCont), cex=0.7)) -> ordilabel(scores(ohc), label=round(ohc$value), cex=0.7) -> -> ## Slightly different from reordered 'dendrogram' which ignores group -> ## sizes in assessing means. -> den <- as.dendrogram(hc) -> den <- with(mite.env, reorder(den, WatrCont, agglo.FUN = mean)) -> plot(den) -> -> -> -> cleanEx() -> nameEx("scores") -> ### * scores -> -> flush(stderr()); flush(stdout()) -> -> ### Name: scores -> ### Title: Get Species or Site Scores from an Ordination -> ### Aliases: scores scores.default scores.lda -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(varespec) -> vare.pca <- prcomp(varespec) -> scores(vare.pca, choices=c(1,2)) - PC1 PC2 -18 -10.7847878 18.7094315 -15 -27.8036826 -11.7414745 -24 -25.6919559 -14.5399684 -27 -31.7820166 -31.2216800 -23 -19.6315869 -2.5541193 -19 -0.2413294 -11.4974077 -22 -26.6771373 -12.3140897 -16 -21.9230366 0.4449159 -28 -39.6083051 -41.8877392 -13 -4.0664328 20.4191153 -14 -18.4416245 5.4406988 -20 -17.3999191 2.3653380 -25 -25.1673547 -13.2508067 -7 -11.4065430 41.7356300 -5 -8.4243752 45.3805255 -6 -2.0759474 36.9311222 -3 39.8617580 8.0590041 -4 13.1065901 12.8377217 -2 57.6827011 -4.8983565 -9 63.3138332 -22.4481549 -12 44.1073111 -10.1653935 -10 64.9418975 -16.7633564 -11 11.5313633 3.9720890 -21 -3.4194194 -3.0130455 -> -> -> -> cleanEx() -> nameEx("screeplot.cca") -> ### * screeplot.cca -> -> flush(stderr()); flush(stdout()) -> -> ### Name: screeplot.cca -> ### Title: Screeplots for Ordination Results and Broken Stick Distributions -> ### Aliases: screeplot.cca screeplot.princomp screeplot.prcomp -> ### screeplot.decorana bstick bstick.default bstick.cca bstick.prcomp -> ### bstick.princomp bstick.decorana -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(varespec) -> vare.pca <- rda(varespec, scale = TRUE) -> bstick(vare.pca) - PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 -7.1438620 5.2308185 4.2742968 3.6366156 3.1583548 2.7757461 2.4569055 2.1836136 - PC9 PC10 PC11 PC12 PC13 PC14 PC15 PC16 -1.9444831 1.7319228 1.5406184 1.3667054 1.2072851 1.0601279 0.9234819 0.7959457 - PC17 PC18 PC19 PC20 PC21 PC22 PC23 -0.6763805 0.5638485 0.4575683 0.3568818 0.2612296 0.1701323 0.0831758 -> screeplot(vare.pca, bstick = TRUE, type = "lines") -> -> -> -> cleanEx() -> nameEx("simper") -> ### * simper -> -> flush(stderr()); flush(stdout()) -> -> ### Name: simper -> ### Title: Similarity Percentages -> ### Aliases: simper summary.simper -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(dune) -> data(dune.env) -> (sim <- with(dune.env, simper(dune, Management, permutations = 99))) -cumulative contributions of most influential species: - -$SF_BF - Agrostol Alopgeni Lolipere Trifrepe Poatriv Scorautu Bromhord -0.09824271 0.18254830 0.25956958 0.33367870 0.40734444 0.47729205 0.53120026 - Achimill Planlanc Elymrepe Bracruta -0.57946526 0.62522255 0.67016196 0.71098133 - -$SF_HF - Agrostol Alopgeni Lolipere Planlanc Rumeacet Elymrepe Poatriv -0.08350879 0.16534834 0.23934930 0.30843624 0.37716139 0.43334492 0.48351753 - Bracruta Eleopalu Poaprat Anthodor Sagiproc Trifprat -0.52804045 0.57205850 0.61423981 0.65549838 0.69628951 0.73696831 - -$SF_NM - Poatriv Alopgeni Agrostol Lolipere Eleopalu Poaprat Bracruta Elymrepe -0.1013601 0.1935731 0.2667383 0.3377578 0.3999419 0.4526707 0.5044725 0.5505643 - Scorautu Trifrepe Sagiproc Salirepe -0.5926117 0.6320111 0.6712478 0.7091528 - -$BF_HF - Rumeacet Poatriv Planlanc Bromhord Lolipere Elymrepe Trifrepe -0.08163219 0.15193797 0.21918333 0.27967181 0.33969561 0.39843338 0.45298204 - Anthodor Achimill Bracruta Alopgeni Trifprat Juncarti -0.50276849 0.55222648 0.60021994 0.64584333 0.69126471 0.73366621 - -$BF_NM - Lolipere Poatriv Poaprat Trifrepe Bromhord Bracruta Eleopalu Agrostol -0.1242718 0.1992126 0.2711756 0.3414609 0.3958520 0.4448077 0.4910724 0.5369083 - Achimill Scorautu Anthodor Planlanc -0.5823926 0.6253645 0.6638182 0.7012577 - -$HF_NM - Poatriv Lolipere Rumeacet Poaprat Planlanc Bracruta Eleopalu -0.09913221 0.17468460 0.23917190 0.29701331 0.35469313 0.40365488 0.44804851 - Agrostol Trifrepe Elymrepe Anthodor Juncarti Trifprat Salirepe -0.49226546 0.53434466 0.57564661 0.61543243 0.65341300 0.68921695 0.72432408 - -> ## IGNORE_RDIFF_BEGIN -> summary(sim) - -Contrast: SF_BF - - average sd ratio ava avb cumsum p -Agrostol 0.06137 0.03419 1.79490 4.66700 0.00000 0.098 0.04 * -Alopgeni 0.05267 0.03648 1.44390 4.33300 0.66700 0.182 0.20 -Lolipere 0.04812 0.03945 1.21980 3.00000 6.00000 0.260 0.47 -Trifrepe 0.04630 0.02553 1.81380 1.33300 4.66700 0.334 0.08 . -Poatriv 0.04602 0.03380 1.36150 4.66700 3.66700 0.407 0.59 -Scorautu 0.04370 0.02492 1.75340 1.33300 4.33300 0.477 0.03 * -Bromhord 0.03368 0.02586 1.30230 0.50000 2.66700 0.531 0.02 * -Achimill 0.03015 0.02082 1.44820 0.16700 2.33300 0.580 0.01 ** -Planlanc 0.02859 0.02155 1.32650 0.00000 2.00000 0.625 0.48 -Elymrepe 0.02807 0.02978 0.94280 2.00000 1.33300 0.670 0.52 -Bracruta 0.02550 0.02390 1.06690 2.00000 2.00000 0.711 0.88 -Poaprat 0.02513 0.02397 1.04850 2.50000 4.00000 0.751 0.89 -Sagiproc 0.02433 0.02215 1.09830 1.83300 0.66700 0.790 0.42 -Bellpere 0.01986 0.01709 1.16220 0.66700 1.66700 0.822 0.13 -Eleopalu 0.01861 0.04296 0.43330 1.33300 0.00000 0.852 0.84 -Anthodor 0.01754 0.02580 0.67980 0.00000 1.33300 0.880 0.79 -Juncbufo 0.01603 0.02371 0.67620 1.16700 0.00000 0.905 0.53 -Vicilath 0.01467 0.01331 1.10260 0.00000 1.00000 0.929 0.05 * -Hyporadi 0.01029 0.01520 0.67680 0.00000 0.66700 0.945 0.62 -Ranuflam 0.00931 0.01360 0.68450 0.66700 0.00000 0.960 0.91 -Juncarti 0.00698 0.01611 0.43330 0.50000 0.00000 0.972 0.96 -Callcusp 0.00698 0.01611 0.43330 0.50000 0.00000 0.983 0.85 -Rumeacet 0.00453 0.01044 0.43330 0.33300 0.00000 0.990 0.96 -Cirsarve 0.00398 0.00918 0.43360 0.33300 0.00000 0.996 0.41 -Chenalbu 0.00233 0.00537 0.43330 0.16700 0.00000 1.000 0.40 -Airaprae 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.73 -Comapalu 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.68 -Empenigr 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.46 -Salirepe 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.85 -Trifprat 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.85 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Contrast: SF_HF - - average sd ratio ava avb cumsum p -Agrostol 0.04738 0.03127 1.51510 4.66700 1.40000 0.084 0.34 -Alopgeni 0.04643 0.03290 1.41150 4.33300 1.60000 0.165 0.23 -Lolipere 0.04199 0.02701 1.55460 3.00000 4.00000 0.239 0.84 -Planlanc 0.03920 0.03321 1.18040 0.00000 3.00000 0.308 0.06 . -Rumeacet 0.03899 0.02737 1.42470 0.33300 3.20000 0.377 0.01 ** -Elymrepe 0.03188 0.02955 1.07870 2.00000 2.00000 0.433 0.33 -Poatriv 0.02847 0.02152 1.32270 4.66700 4.80000 0.484 0.99 -Bracruta 0.02526 0.02104 1.20040 2.00000 2.80000 0.528 0.96 -Eleopalu 0.02497 0.03888 0.64240 1.33300 0.80000 0.572 0.71 -Poaprat 0.02393 0.01918 1.24780 2.50000 3.40000 0.614 0.96 -Anthodor 0.02341 0.02143 1.09230 0.00000 1.80000 0.655 0.59 -Sagiproc 0.02314 0.02048 1.13010 1.83300 0.80000 0.696 0.51 -Trifprat 0.02308 0.02343 0.98500 0.00000 1.80000 0.737 0.02 * -Juncarti 0.02285 0.02568 0.88990 0.50000 1.60000 0.777 0.38 -Trifrepe 0.02238 0.01949 1.14860 1.33300 2.80000 0.817 0.97 -Juncbufo 0.02164 0.02224 0.97330 1.16700 1.20000 0.855 0.19 -Scorautu 0.02051 0.01642 1.24890 1.33300 2.80000 0.891 0.80 -Achimill 0.01518 0.01139 1.33260 0.16700 1.20000 0.918 0.69 -Bromhord 0.01338 0.01450 0.92220 0.50000 0.80000 0.941 0.78 -Ranuflam 0.01066 0.01339 0.79640 0.66700 0.40000 0.960 0.87 -Bellpere 0.00999 0.01257 0.79480 0.66700 0.40000 0.978 0.92 -Callcusp 0.00662 0.01508 0.43930 0.50000 0.00000 0.989 0.94 -Cirsarve 0.00381 0.00867 0.43940 0.33300 0.00000 0.996 0.61 -Chenalbu 0.00221 0.00503 0.43930 0.16700 0.00000 1.000 0.58 -Airaprae 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.75 -Comapalu 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.83 -Empenigr 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.52 -Hyporadi 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.92 -Salirepe 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.91 -Vicilath 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.92 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Contrast: SF_NM - - average sd ratio ava avb cumsum p -Poatriv 0.07828 0.04095 1.91180 4.66700 0.00000 0.101 0.01 ** -Alopgeni 0.07122 0.04696 1.51670 4.33300 0.00000 0.194 0.01 ** -Agrostol 0.05651 0.04418 1.27920 4.66700 2.16700 0.267 0.04 * -Lolipere 0.05485 0.05991 0.91550 3.00000 0.33300 0.338 0.15 -Eleopalu 0.04803 0.04717 1.01820 1.33300 2.16700 0.400 0.04 * -Poaprat 0.04072 0.03179 1.28100 2.50000 0.66700 0.453 0.04 * -Bracruta 0.04001 0.03440 1.16310 2.00000 2.83300 0.504 0.12 -Elymrepe 0.03560 0.03852 0.92430 2.00000 0.00000 0.551 0.13 -Scorautu 0.03247 0.03481 0.93280 1.33300 3.16700 0.593 0.12 -Trifrepe 0.03043 0.03163 0.96190 1.33300 1.83300 0.632 0.70 -Sagiproc 0.03030 0.03048 0.99430 1.83300 0.50000 0.671 0.01 ** -Salirepe 0.02928 0.03201 0.91440 0.00000 1.83300 0.709 0.01 ** -Anthodor 0.02454 0.03669 0.66880 0.00000 1.33300 0.741 0.54 -Callcusp 0.02276 0.02944 0.77310 0.50000 1.16700 0.770 0.04 * -Ranuflam 0.02257 0.02282 0.98890 0.66700 1.33300 0.800 0.08 . -Juncarti 0.02254 0.02860 0.78830 0.50000 1.16700 0.829 0.47 -Hyporadi 0.02011 0.03129 0.64260 0.00000 1.16700 0.855 0.18 -Juncbufo 0.01986 0.02903 0.68400 1.16700 0.00000 0.881 0.30 -Planlanc 0.01542 0.02277 0.67720 0.00000 0.83300 0.900 1.00 -Airaprae 0.01488 0.02188 0.68020 0.00000 0.83300 0.920 0.06 . -Bellpere 0.01232 0.01592 0.77370 0.66700 0.33300 0.936 0.81 -Comapalu 0.01188 0.01741 0.68260 0.00000 0.66700 0.951 0.04 * -Achimill 0.00929 0.01493 0.62240 0.16700 0.33300 0.963 0.96 -Bromhord 0.00717 0.01633 0.43910 0.50000 0.00000 0.972 0.98 -Rumeacet 0.00559 0.01275 0.43840 0.33300 0.00000 0.980 0.99 -Empenigr 0.00523 0.01200 0.43540 0.00000 0.33300 0.986 0.28 -Cirsarve 0.00478 0.01089 0.43910 0.33300 0.00000 0.993 0.01 ** -Chenalbu 0.00289 0.00660 0.43820 0.16700 0.00000 0.996 0.01 ** -Vicilath 0.00279 0.00642 0.43450 0.00000 0.16700 1.000 0.72 -Trifprat 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.97 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Contrast: BF_HF - - average sd ratio ava avb cumsum p -Rumeacet 0.03867 0.02606 1.48380 0.00000 3.20000 0.082 0.06 . -Poatriv 0.03330 0.02579 1.29110 3.66700 4.80000 0.152 0.97 -Planlanc 0.03185 0.01830 1.74010 2.00000 3.00000 0.219 0.31 -Bromhord 0.02865 0.01799 1.59260 2.66700 0.80000 0.280 0.08 . -Lolipere 0.02843 0.02215 1.28340 6.00000 4.00000 0.340 1.00 -Elymrepe 0.02782 0.02959 0.94040 1.33300 2.00000 0.398 0.55 -Trifrepe 0.02584 0.01656 1.56030 4.66700 2.80000 0.453 0.70 -Anthodor 0.02358 0.02042 1.15470 1.33300 1.80000 0.503 0.50 -Achimill 0.02343 0.01474 1.58930 2.33300 1.20000 0.552 0.13 -Bracruta 0.02273 0.01802 1.26170 2.00000 2.80000 0.600 0.90 -Alopgeni 0.02161 0.02308 0.93630 0.66700 1.60000 0.646 0.87 -Trifprat 0.02151 0.02207 0.97470 0.00000 1.80000 0.691 0.11 -Juncarti 0.02008 0.02555 0.78600 0.00000 1.60000 0.734 0.73 -Scorautu 0.01932 0.01357 1.42410 4.33300 2.80000 0.774 0.66 -Bellpere 0.01829 0.01486 1.23050 1.66700 0.40000 0.813 0.14 -Agrostol 0.01761 0.02284 0.77080 0.00000 1.40000 0.850 1.00 -Juncbufo 0.01500 0.02066 0.72600 0.00000 1.20000 0.882 0.52 -Vicilath 0.01285 0.01140 1.12740 1.00000 0.00000 0.909 0.04 * -Sagiproc 0.01168 0.01297 0.90080 0.66700 0.80000 0.934 0.89 -Eleopalu 0.01017 0.02111 0.48170 0.00000 0.80000 0.955 0.97 -Hyporadi 0.00895 0.01312 0.68240 0.66700 0.00000 0.974 0.54 -Poaprat 0.00720 0.01010 0.71330 4.00000 3.40000 0.989 1.00 -Ranuflam 0.00508 0.01055 0.48170 0.00000 0.40000 1.000 0.99 -Airaprae 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.54 -Chenalbu 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.37 -Cirsarve 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.44 -Comapalu 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.74 -Empenigr 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.33 -Salirepe 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.80 -Callcusp 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.77 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Contrast: BF_NM - - average sd ratio ava avb cumsum p -Lolipere 0.09068 0.02644 3.42900 6.00000 0.33300 0.124 0.01 ** -Poatriv 0.05468 0.04465 1.22500 3.66700 0.00000 0.199 0.29 -Poaprat 0.05251 0.01813 2.89700 4.00000 0.66700 0.271 0.02 * -Trifrepe 0.05129 0.02756 1.86100 4.66700 1.83300 0.342 0.04 * -Bromhord 0.03969 0.02920 1.35900 2.66700 0.00000 0.396 0.01 ** -Bracruta 0.03572 0.02869 1.24500 2.00000 2.83300 0.445 0.29 -Eleopalu 0.03376 0.03573 0.94500 0.00000 2.16700 0.491 0.53 -Agrostol 0.03345 0.03473 0.96300 0.00000 2.16700 0.537 0.87 -Achimill 0.03319 0.02338 1.42000 2.33300 0.33300 0.582 0.02 * -Scorautu 0.03136 0.02026 1.54800 4.33300 3.16700 0.625 0.22 -Anthodor 0.02806 0.03295 0.85200 1.33300 1.33300 0.664 0.37 -Planlanc 0.02732 0.02193 1.24600 2.00000 0.83300 0.701 0.51 -Salirepe 0.02677 0.02927 0.91400 0.00000 1.83300 0.738 0.12 -Bellpere 0.02353 0.01909 1.23200 1.66700 0.33300 0.770 0.01 ** -Hyporadi 0.02172 0.02450 0.88600 0.66700 1.16700 0.800 0.28 -Ranuflam 0.02031 0.02275 0.89300 0.00000 1.33300 0.828 0.29 -Elymrepe 0.01999 0.02926 0.68300 1.33300 0.00000 0.855 0.87 -Callcusp 0.01783 0.02681 0.66500 0.00000 1.16700 0.880 0.40 -Juncarti 0.01769 0.02600 0.68100 0.00000 1.16700 0.904 0.73 -Vicilath 0.01577 0.01447 1.09000 1.00000 0.16700 0.925 0.01 ** -Sagiproc 0.01543 0.01857 0.83100 0.66700 0.50000 0.947 0.87 -Airaprae 0.01341 0.01969 0.68100 0.00000 0.83300 0.965 0.34 -Comapalu 0.01074 0.01571 0.68400 0.00000 0.66700 0.980 0.46 -Alopgeni 0.01000 0.01463 0.68300 0.66700 0.00000 0.993 0.99 -Empenigr 0.00479 0.01105 0.43300 0.00000 0.33300 1.000 0.37 -Chenalbu 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.38 -Cirsarve 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.49 -Juncbufo 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.95 -Rumeacet 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.94 -Trifprat 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.83 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Contrast: HF_NM - - average sd ratio ava avb cumsum p -Poatriv 0.07155 0.01368 5.23000 4.80000 0.00000 0.099 0.01 ** -Lolipere 0.05453 0.02962 1.84100 4.00000 0.33300 0.175 0.25 -Rumeacet 0.04655 0.03081 1.51100 3.20000 0.00000 0.239 0.01 ** -Poaprat 0.04175 0.01885 2.21500 3.40000 0.66700 0.297 0.06 . -Planlanc 0.04163 0.02956 1.40800 3.00000 0.83300 0.355 0.04 * -Bracruta 0.03534 0.02010 1.75800 2.80000 2.83300 0.404 0.38 -Eleopalu 0.03204 0.03231 0.99200 0.80000 2.16700 0.448 0.41 -Agrostol 0.03192 0.02889 1.10500 1.40000 2.16700 0.492 0.93 -Trifrepe 0.03037 0.02287 1.32800 2.80000 1.83300 0.534 0.52 -Elymrepe 0.02981 0.03868 0.77100 2.00000 0.00000 0.576 0.47 -Anthodor 0.02872 0.02480 1.15800 1.80000 1.33300 0.615 0.34 -Juncarti 0.02741 0.02854 0.96100 1.60000 1.16700 0.653 0.19 -Trifprat 0.02584 0.02597 0.99500 1.80000 0.00000 0.689 0.01 ** -Salirepe 0.02534 0.02729 0.92900 0.00000 1.83300 0.724 0.12 -Alopgeni 0.02446 0.03240 0.75500 1.60000 0.00000 0.758 0.93 -Scorautu 0.02070 0.01412 1.46600 2.80000 3.16700 0.787 0.84 -Ranuflam 0.01928 0.01994 0.96700 0.40000 1.33300 0.814 0.33 -Juncbufo 0.01818 0.02465 0.73800 1.20000 0.00000 0.839 0.43 -Hyporadi 0.01714 0.02655 0.64600 0.00000 1.16700 0.863 0.47 -Callcusp 0.01683 0.02490 0.67600 0.00000 1.16700 0.886 0.46 -Achimill 0.01656 0.01490 1.11100 1.20000 0.33300 0.909 0.61 -Sagiproc 0.01528 0.01653 0.92400 0.80000 0.50000 0.930 0.89 -Airaprae 0.01261 0.01824 0.69100 0.00000 0.83300 0.947 0.39 -Bromhord 0.01209 0.01517 0.79700 0.80000 0.00000 0.964 0.78 -Comapalu 0.01011 0.01456 0.69400 0.00000 0.66700 0.978 0.26 -Bellpere 0.00880 0.01373 0.64100 0.40000 0.33300 0.990 0.93 -Empenigr 0.00454 0.01033 0.43900 0.00000 0.33300 0.997 0.59 -Vicilath 0.00240 0.00546 0.43900 0.00000 0.16700 1.000 0.85 -Chenalbu 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.54 -Cirsarve 0.00000 0.00000 NaN 0.00000 0.00000 1.000 0.53 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -Permutation: free -Number of permutations: 99 -> ## IGNORE_RDIFF_END -> -> -> -> cleanEx() -> nameEx("simulate.rda") -> ### * simulate.rda -> -> flush(stderr()); flush(stdout()) -> -> ### Name: simulate.rda -> ### Title: Simulate Responses with Gaussian Error or Permuted Residuals for -> ### Constrained Ordination -> ### Aliases: simulate.rda simulate.cca simulate.capscale -> ### Keywords: models datagen multivariate -> -> ### ** Examples -> -> data(dune) -> data(dune.env) -> mod <- rda(dune ~ Moisture + Management, dune.env) -> ## One simulation -> update(mod, simulate(mod) ~ .) -Call: rda(formula = simulate(mod) ~ Moisture + Management, data = -dune.env) - - Inertia Proportion Rank -Total 82.8232 1.0000 -Constrained 52.6966 0.6363 6 -Unconstrained 30.1266 0.3637 13 -Inertia is variance - -Eigenvalues for constrained axes: - RDA1 RDA2 RDA3 RDA4 RDA5 RDA6 -22.011 15.693 6.034 4.165 3.265 1.529 - -Eigenvalues for unconstrained axes: - PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11 PC12 PC13 -6.524 4.747 3.703 3.119 2.963 2.279 1.782 1.440 1.251 0.858 0.613 0.477 0.369 - -> ## An impression of confidence regions of site scores -> plot(mod, display="sites") -> for (i in 1:5) lines(procrustes(mod, update(mod, simulate(mod) ~ .)), col="blue") -> ## Simulate a set of null communities with permutation of residuals -> simulate(mod, indx = shuffleSet(nrow(dune), 99)) -An object of class “simulate.rda” -‘simulate index’ method (abundance, non-sequential) -20 x 30 matrix -Number of permuted matrices = 99 - -> -> -> -> cleanEx() -> nameEx("sipoo") -> ### * sipoo -> -> flush(stderr()); flush(stdout()) -> -> ### Name: sipoo -> ### Title: Birds in the Archipelago of Sipoo (Sibbo and Borg) -> ### Aliases: sipoo sipoo.map -> ### Keywords: datasets -> -> ### ** Examples -> -> data(sipoo) -> data(sipoo.map) -> plot(N ~ E, data=sipoo.map, asp = 1) -> -> -> -> cleanEx() -> nameEx("spantree") -> ### * spantree -> -> flush(stderr()); flush(stdout()) -> -> ### Name: spantree -> ### Title: Minimum Spanning Tree -> ### Aliases: spantree cophenetic.spantree as.hclust.spantree plot.spantree -> ### lines.spantree spandepth -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(dune) -> dis <- vegdist(dune) -> tr <- spantree(dis) -> ## Add tree to a metric scaling -> plot(tr, cmdscale(dis), type = "t") -> ## Find a configuration to display the tree neatly -> plot(tr, type = "t") -Initial stress : 0.03111 -stress after 10 iters: 0.01302, magic = 0.500 -stress after 20 iters: 0.01139, magic = 0.500 -stress after 30 iters: 0.01118, magic = 0.500 -stress after 40 iters: 0.01114, magic = 0.500 -> ## Depths of nodes -> depths <- spandepth(tr) -> plot(tr, type = "t", label = depths) -Initial stress : 0.03111 -stress after 10 iters: 0.01302, magic = 0.500 -stress after 20 iters: 0.01139, magic = 0.500 -stress after 30 iters: 0.01118, magic = 0.500 -stress after 40 iters: 0.01114, magic = 0.500 -> ## Plot as a dendrogram -> cl <- as.hclust(tr) -> plot(cl) -> ## cut hclust tree to classes and show in colours in spantree -> plot(tr, col = cutree(cl, 5), pch=16) -Initial stress : 0.03111 -stress after 10 iters: 0.01302, magic = 0.500 -stress after 20 iters: 0.01139, magic = 0.500 -stress after 30 iters: 0.01118, magic = 0.500 -stress after 40 iters: 0.01114, magic = 0.500 -> -> -> -> cleanEx() -> nameEx("specaccum") -> ### * specaccum -> -> flush(stderr()); flush(stdout()) -> -> ### Name: specaccum -> ### Title: Species Accumulation Curves -> ### Aliases: specaccum print.specaccum summary.specaccum plot.specaccum -> ### lines.specaccum boxplot.specaccum fitspecaccum plot.fitspecaccum -> ### lines.fitspecaccum predict.specaccum predict.fitspecaccum -> ### AIC.fitspecaccum deviance.fitspecaccum logLik.fitspecaccum -> ### nobs.fitspecaccum specslope -> ### Keywords: univar models -> -> ### ** Examples -> -> data(BCI) -> sp1 <- specaccum(BCI) -Warning in cor(x > 0) : the standard deviation is zero -> sp2 <- specaccum(BCI, "random") -> sp2 -Species Accumulation Curve -Accumulation method: random, with 100 permutations -Call: specaccum(comm = BCI, method = "random") - - -Sites 1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000 -Richness 90.64000 121.05000 139.56000 151.18000 159.79000 166.21000 171.94000 -sd 7.17673 8.17285 6.71847 6.44225 5.95996 5.79497 5.36886 - -Sites 8.0000 9.00000 10.00000 11.00000 12.00000 13.0000 14.00000 -Richness 176.0900 179.49000 182.93000 185.97000 188.52000 190.7000 192.96000 -sd 4.8055 4.31697 3.80126 3.66654 3.80717 3.8363 3.51884 - -Sites 15.00000 16.00000 17.0000 18.00000 19.00000 20.00000 21.00000 -Richness 194.62000 196.61000 198.2200 199.79000 201.08000 202.43000 203.67000 -sd 3.44298 3.50438 3.3832 3.61617 3.59764 3.31892 3.47009 - -Sites 22.0000 23.00000 24.00000 25.00000 26.00000 27.00000 28.000 -Richness 204.8900 206.07000 207.15000 208.14000 209.31000 210.33000 211.200 -sd 3.4638 3.42084 3.30098 3.10106 3.30807 3.44965 3.114 - -Sites 29.00000 30.00000 31.00000 32.00000 33.00000 34.00000 35.00000 -Richness 212.12000 213.04000 213.70000 214.62000 215.55000 216.21000 216.90000 -sd 3.11815 3.05479 3.15428 3.01102 2.83333 2.79717 2.73215 - -Sites 36.00000 37.00000 38.00000 39.00000 40.00000 41.00000 42.00000 -Richness 217.58000 218.21000 218.81000 219.30000 219.92000 220.43000 221.02000 -sd 2.57093 2.40074 2.33418 2.35488 2.24139 2.23948 2.21556 - -Sites 43.00000 44.00000 45.00000 46.00000 47.00000 48.00000 49.00000 -Richness 221.63000 222.20000 222.69000 223.22000 223.56000 224.04000 224.59000 -sd 2.03333 1.86407 1.75058 1.48106 1.36567 1.10937 0.71202 - -Sites 50 -Richness 225 -sd 0 -> summary(sp2) - 1 sites 2 sites 3 sites 4 sites - Min. : 77.00 Min. :105.0 Min. :121.0 Min. :131.0 - 1st Qu.: 84.00 1st Qu.:114.8 1st Qu.:135.0 1st Qu.:146.0 - Median : 91.00 Median :121.0 Median :140.0 Median :151.5 - Mean : 90.64 Mean :121.0 Mean :139.6 Mean :151.2 - 3rd Qu.: 95.00 3rd Qu.:127.0 3rd Qu.:144.2 3rd Qu.:156.0 - Max. :109.00 Max. :139.0 Max. :154.0 Max. :163.0 - 5 sites 6 sites 7 sites 8 sites - Min. :146.0 Min. :154.0 Min. :159.0 Min. :164.0 - 1st Qu.:155.0 1st Qu.:163.0 1st Qu.:168.8 1st Qu.:173.0 - Median :160.0 Median :167.0 Median :172.0 Median :176.0 - Mean :159.8 Mean :166.2 Mean :171.9 Mean :176.1 - 3rd Qu.:164.0 3rd Qu.:170.2 3rd Qu.:176.0 3rd Qu.:179.0 - Max. :173.0 Max. :178.0 Max. :184.0 Max. :185.0 - 9 sites 10 sites 11 sites 12 sites - Min. :166.0 Min. :174.0 Min. :177.0 Min. :179.0 - 1st Qu.:177.0 1st Qu.:180.0 1st Qu.:183.8 1st Qu.:186.0 - Median :179.0 Median :183.0 Median :186.0 Median :188.5 - Mean :179.5 Mean :182.9 Mean :186.0 Mean :188.5 - 3rd Qu.:182.0 3rd Qu.:185.0 3rd Qu.:189.0 3rd Qu.:192.0 - Max. :188.0 Max. :192.0 Max. :194.0 Max. :197.0 - 13 sites 14 sites 15 sites 16 sites - Min. :182.0 Min. :184.0 Min. :186.0 Min. :187.0 - 1st Qu.:188.0 1st Qu.:190.8 1st Qu.:192.0 1st Qu.:194.0 - Median :191.0 Median :193.0 Median :194.5 Median :196.0 - Mean :190.7 Mean :193.0 Mean :194.6 Mean :196.6 - 3rd Qu.:194.0 3rd Qu.:196.0 3rd Qu.:197.0 3rd Qu.:199.0 - Max. :199.0 Max. :201.0 Max. :203.0 Max. :204.0 - 17 sites 18 sites 19 sites 20 sites - Min. :189.0 Min. :190.0 Min. :192.0 Min. :195.0 - 1st Qu.:196.0 1st Qu.:197.0 1st Qu.:198.8 1st Qu.:200.0 - Median :198.0 Median :200.0 Median :202.0 Median :203.0 - Mean :198.2 Mean :199.8 Mean :201.1 Mean :202.4 - 3rd Qu.:201.0 3rd Qu.:202.0 3rd Qu.:203.0 3rd Qu.:205.0 - Max. :207.0 Max. :209.0 Max. :211.0 Max. :211.0 - 21 sites 22 sites 23 sites 24 sites - Min. :196.0 Min. :196.0 Min. :197.0 Min. :199.0 - 1st Qu.:201.0 1st Qu.:202.0 1st Qu.:204.0 1st Qu.:205.0 - Median :204.0 Median :205.0 Median :206.5 Median :208.0 - Mean :203.7 Mean :204.9 Mean :206.1 Mean :207.2 - 3rd Qu.:206.0 3rd Qu.:207.0 3rd Qu.:208.0 3rd Qu.:209.0 - Max. :213.0 Max. :214.0 Max. :215.0 Max. :216.0 - 25 sites 26 sites 27 sites 28 sites - Min. :202.0 Min. :203.0 Min. :204.0 Min. :205.0 - 1st Qu.:206.0 1st Qu.:207.0 1st Qu.:208.0 1st Qu.:209.0 - Median :208.0 Median :209.0 Median :210.0 Median :211.0 - Mean :208.1 Mean :209.3 Mean :210.3 Mean :211.2 - 3rd Qu.:210.0 3rd Qu.:212.0 3rd Qu.:213.0 3rd Qu.:213.0 - Max. :216.0 Max. :217.0 Max. :219.0 Max. :219.0 - 29 sites 30 sites 31 sites 32 sites 33 sites - Min. :205.0 Min. :206 Min. :206.0 Min. :206.0 Min. :209.0 - 1st Qu.:210.0 1st Qu.:211 1st Qu.:212.0 1st Qu.:213.0 1st Qu.:214.0 - Median :212.0 Median :213 Median :214.0 Median :215.0 Median :216.0 - Mean :212.1 Mean :213 Mean :213.7 Mean :214.6 Mean :215.6 - 3rd Qu.:214.0 3rd Qu.:215 3rd Qu.:216.0 3rd Qu.:216.2 3rd Qu.:217.2 - Max. :220.0 Max. :221 Max. :222.0 Max. :223.0 Max. :223.0 - 34 sites 35 sites 36 sites 37 sites - Min. :210.0 Min. :210.0 Min. :211.0 Min. :213.0 - 1st Qu.:214.8 1st Qu.:215.8 1st Qu.:216.0 1st Qu.:217.0 - Median :216.0 Median :217.0 Median :218.0 Median :218.0 - Mean :216.2 Mean :216.9 Mean :217.6 Mean :218.2 - 3rd Qu.:218.0 3rd Qu.:219.0 3rd Qu.:219.0 3rd Qu.:220.0 - Max. :224.0 Max. :224.0 Max. :224.0 Max. :224.0 - 38 sites 39 sites 40 sites 41 sites 42 sites - Min. :214.0 Min. :214.0 Min. :214.0 Min. :214.0 Min. :215 - 1st Qu.:217.0 1st Qu.:218.0 1st Qu.:218.0 1st Qu.:219.0 1st Qu.:219 - Median :219.0 Median :219.0 Median :220.0 Median :221.0 Median :221 - Mean :218.8 Mean :219.3 Mean :219.9 Mean :220.4 Mean :221 - 3rd Qu.:220.2 3rd Qu.:221.0 3rd Qu.:221.0 3rd Qu.:222.0 3rd Qu.:223 - Max. :224.0 Max. :224.0 Max. :224.0 Max. :225.0 Max. :225 - 43 sites 44 sites 45 sites 46 sites - Min. :215.0 Min. :216.0 Min. :218.0 Min. :218.0 - 1st Qu.:221.0 1st Qu.:221.0 1st Qu.:222.0 1st Qu.:222.8 - Median :222.0 Median :222.0 Median :223.0 Median :223.5 - Mean :221.6 Mean :222.2 Mean :222.7 Mean :223.2 - 3rd Qu.:223.0 3rd Qu.:223.0 3rd Qu.:224.0 3rd Qu.:224.0 - Max. :225.0 Max. :225.0 Max. :225.0 Max. :225.0 - 47 sites 48 sites 49 sites 50 sites - Min. :219.0 Min. :221.0 Min. :222.0 Min. :225 - 1st Qu.:223.0 1st Qu.:223.8 1st Qu.:224.0 1st Qu.:225 - Median :224.0 Median :224.0 Median :225.0 Median :225 - Mean :223.6 Mean :224.0 Mean :224.6 Mean :225 - 3rd Qu.:225.0 3rd Qu.:225.0 3rd Qu.:225.0 3rd Qu.:225 - Max. :225.0 Max. :225.0 Max. :225.0 Max. :225 -> plot(sp1, ci.type="poly", col="blue", lwd=2, ci.lty=0, ci.col="lightblue") -> boxplot(sp2, col="yellow", add=TRUE, pch="+") -> ## Fit Lomolino model to the exact accumulation -> mod1 <- fitspecaccum(sp1, "lomolino") -> coef(mod1) - Asym xmid slope -258.440682 2.442061 1.858694 -> fitted(mod1) - [1] 94.34749 121.23271 137.45031 148.83053 157.45735 164.31866 169.95946 - [8] 174.71115 178.78954 182.34254 185.47566 188.26658 190.77402 193.04337 -[15] 195.11033 197.00350 198.74606 200.35705 201.85227 203.24499 204.54643 -[22] 205.76612 206.91229 207.99203 209.01150 209.97609 210.89054 211.75903 -[29] 212.58527 213.37256 214.12386 214.84180 215.52877 216.18692 216.81820 -[36] 217.42437 218.00703 218.56767 219.10762 219.62811 220.13027 220.61514 -[43] 221.08369 221.53679 221.97528 222.39991 222.81138 223.21037 223.59747 -[50] 223.97327 -> plot(sp1) -> ## Add Lomolino model using argument 'add' -> plot(mod1, add = TRUE, col=2, lwd=2) -> ## Fit Arrhenius models to all random accumulations -> mods <- fitspecaccum(sp2, "arrh") -> plot(mods, col="hotpink") -> boxplot(sp2, col = "yellow", border = "blue", lty=1, cex=0.3, add= TRUE) -> ## Use nls() methods to the list of models -> sapply(mods$models, AIC) - [1] 356.5715 334.2659 356.8702 337.1956 322.4565 337.2563 345.7345 336.2684 - [9] 337.6066 348.3777 307.2890 305.2747 319.9204 371.4843 366.7792 334.0841 - [17] 311.3170 353.9911 338.7509 359.2898 364.7568 332.8366 348.0223 301.7971 - [25] 345.8258 331.2144 329.5874 350.5533 345.4044 356.4001 324.1702 343.2369 - [33] 315.4014 352.6658 302.4976 353.6356 332.2139 330.0446 310.1712 343.6355 - [41] 310.2347 298.5118 355.7126 343.2572 305.2200 358.5132 330.4127 364.0129 - [49] 313.2175 333.0343 358.0340 353.1583 359.6541 285.4664 315.3099 318.8782 - [57] 349.2470 322.9555 366.4519 324.0335 357.0880 335.7206 349.5461 302.8776 - [65] 300.1772 333.6603 341.6951 351.7681 332.1474 353.9150 333.4678 332.9716 - [73] 342.6504 317.3593 288.1467 333.3316 321.7582 336.8158 348.7769 321.3693 - [81] 306.7789 344.1743 300.3916 345.3415 311.8541 329.8506 316.5989 294.0664 - [89] 352.9520 333.8061 338.8167 351.6371 337.7145 327.6678 338.8059 359.6553 - [97] 339.5312 329.1578 312.7306 335.7065 -> -> -> -> cleanEx() -> nameEx("specpool") -> ### * specpool -> -> flush(stderr()); flush(stdout()) -> -> ### Name: specpool -> ### Title: Extrapolated Species Richness in a Species Pool -> ### Aliases: specpool specpool2vect poolaccum summary.poolaccum -> ### plot.poolaccum estimateR estimateR.default estimateR.matrix -> ### estimateR.data.frame estaccumR -> ### Keywords: univar -> -> ### ** Examples -> -> data(dune) -> data(dune.env) -> pool <- with(dune.env, specpool(dune, Management)) -> pool - Species chao chao.se jack1 jack1.se jack2 boot boot.se n -BF 16 17.19048 1.5895675 19.33333 2.211083 19.83333 17.74074 1.646379 3 -HF 21 21.51429 0.9511693 23.40000 1.876166 22.05000 22.56864 1.821518 5 -NM 21 22.87500 2.1582871 26.00000 3.291403 25.73333 23.77696 2.300982 6 -SF 21 29.88889 8.6447967 27.66667 3.496029 31.40000 23.99496 1.850288 6 -> op <- par(mfrow=c(1,2)) -> boxplot(specnumber(dune) ~ Management, data = dune.env, -+ col = "hotpink", border = "cyan3") -> boxplot(specnumber(dune)/specpool2vect(pool) ~ Management, -+ data = dune.env, col = "hotpink", border = "cyan3") -> par(op) -> data(BCI) -> ## Accumulation model -> pool <- poolaccum(BCI) -> summary(pool, display = "chao") -$chao - N Chao 2.5% 97.5% Std.Dev - [1,] 3 164.2701 143.3295 184.6709 11.637131 - [2,] 4 176.6696 152.4681 199.7041 12.031950 - [3,] 5 184.8283 164.2414 206.7533 11.316453 - [4,] 6 190.6852 169.9759 218.4163 12.535825 - [5,] 7 196.6106 177.7111 218.3870 11.523820 - [6,] 8 199.0785 181.4218 218.1041 9.691313 - [7,] 9 202.3895 186.7036 221.7717 9.325751 - [8,] 10 206.3114 190.9051 225.9810 9.819298 - [9,] 11 210.1065 194.9661 232.5071 10.371517 -[10,] 12 211.8595 196.7360 231.3563 9.650657 -[11,] 13 214.9130 197.5524 242.2375 11.909381 -[12,] 14 217.7375 199.4871 244.3435 13.096174 -[13,] 15 219.0323 200.3238 241.1367 11.171016 -[14,] 16 221.1480 203.7536 239.3769 10.626800 -[15,] 17 223.8961 205.6141 251.2977 12.664515 -[16,] 18 226.0019 206.7344 257.6239 13.811809 -[17,] 19 227.4841 206.6613 262.9380 14.646202 -[18,] 20 228.2217 207.5356 253.9396 13.002540 -[19,] 21 229.5793 207.1068 260.6821 14.628777 -[20,] 22 229.6333 209.0110 255.0578 13.492995 -[21,] 23 230.3963 208.9376 261.6196 12.975685 -[22,] 24 231.2131 211.2828 255.0443 12.399438 -[23,] 25 231.6823 212.2972 261.3470 12.530439 -[24,] 26 232.5863 213.3965 255.0405 11.196481 -[25,] 27 234.0768 214.1898 258.4757 12.391916 -[26,] 28 234.5461 215.5270 260.4036 11.917695 -[27,] 29 234.7047 216.1639 260.1984 11.220902 -[28,] 30 235.5689 217.5250 261.2160 11.168038 -[29,] 31 235.7826 217.9641 263.6669 11.646793 -[30,] 32 236.4786 218.8365 263.5830 10.906488 -[31,] 33 237.4549 220.1863 264.9627 11.166706 -[32,] 34 237.2213 221.8686 259.2015 10.010269 -[33,] 35 237.0454 221.1909 256.8270 9.361661 -[34,] 36 237.1228 222.2823 260.1380 9.125933 -[35,] 37 237.1881 224.6270 256.1533 10.191486 -[36,] 38 236.9675 225.7358 255.7012 8.574735 -[37,] 39 236.7547 225.7541 254.9934 8.042298 -[38,] 40 236.7747 225.7896 250.4920 7.655103 -[39,] 41 236.7007 226.1312 253.0163 7.335838 -[40,] 42 236.3669 225.6942 252.0634 6.435379 -[41,] 43 236.6716 225.4157 253.6911 6.958012 -[42,] 44 237.0030 226.2610 249.4237 6.126328 -[43,] 45 236.9152 226.8000 249.1260 5.731338 -[44,] 46 236.7370 227.6179 247.4603 4.908380 -[45,] 47 236.3676 228.0633 248.3102 4.549805 -[46,] 48 236.4966 228.9313 246.4903 3.829092 -[47,] 49 236.3248 231.3403 240.2413 2.201414 -[48,] 50 236.3732 236.3732 236.3732 0.000000 - -attr(,"class") -[1] "summary.poolaccum" -> plot(pool) -> ## Quantitative model -> estimateR(BCI[1:5,]) - 1 2 3 4 5 -S.obs 93.000000 84.000000 90.000000 94.000000 101.000000 -S.chao1 117.473684 117.214286 141.230769 111.550000 136.000000 -se.chao1 11.583785 15.918953 23.001405 8.919663 15.467344 -S.ACE 122.848959 117.317307 134.669844 118.729941 137.114088 -se.ACE 5.736054 5.571998 6.191618 5.367571 5.848474 -> -> -> -> graphics::par(get("par.postscript", pos = 'CheckExEnv')) -> cleanEx() -> nameEx("sppscores") -> ### * sppscores -> -> flush(stderr()); flush(stdout()) -> -> ### Name: sppscores -> ### Title: Add or Replace Species Scores in Distance-Based Ordination -> ### Aliases: sppscores sppscores<- sppscores<-.dbrda sppscores<-.capscale -> ### sppscores<-.metaMDS -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(BCI, BCI.env) -> mod <- dbrda(vegdist(BCI) ~ Habitat, BCI.env) -> ## add species scores -> sppscores(mod) <- BCI -> ## Euclidean distances of BCI differ from used dissimilarity -> plot(vegdist(BCI), dist(BCI)) -> ## more linear relationship -> plot(vegdist(BCI), dist(sqrt(decostand(BCI, "total")))) -> ## better species scores -> sppscores(mod) <- sqrt(decostand(BCI, "total")) -> -> -> -> cleanEx() -> nameEx("stepacross") -> ### * stepacross -> -> flush(stderr()); flush(stdout()) -> -> ### Name: stepacross -> ### Title: Stepacross as Flexible Shortest Paths or Extended -> ### Dissimilarities -> ### Aliases: stepacross -> ### Keywords: multivariate -> -> ### ** Examples -> -> # There are no data sets with high beta diversity in vegan, but this -> # should give an idea. -> data(dune) -> dis <- vegdist(dune) -> edis <- stepacross(dis) -Too long or NA distances: 5 out of 190 (2.6%) -Stepping across 190 dissimilarities... -> plot(edis, dis, xlab = "Shortest path", ylab = "Original") -> ## Manhattan distance have no fixed upper limit. -> dis <- vegdist(dune, "manhattan") -> is.na(dis) <- no.shared(dune) -> dis <- stepacross(dis, toolong=0) -Too long or NA distances: 5 out of 190 (2.6%) -Stepping across 190 dissimilarities... -> -> -> -> cleanEx() -> nameEx("stressplot.wcmdscale") -> ### * stressplot.wcmdscale -> -> flush(stderr()); flush(stdout()) -> -> ### Name: stressplot.wcmdscale -> ### Title: Display Ordination Distances Against Observed Distances in -> ### Eigenvector Ordinations -> ### Aliases: stressplot.wcmdscale stressplot.cca stressplot.rda -> ### stressplot.capscale stressplot.dbrda stressplot.prcomp -> ### stressplot.princomp -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(dune, dune.env) -> mod <- rda(dune) -> stressplot(mod) -> mod <- rda(dune ~ Management, dune.env) -> stressplot(mod, k=3) -> -> -> -> cleanEx() -> nameEx("taxondive") -> ### * taxondive -> -> flush(stderr()); flush(stdout()) -> -> ### Name: taxondive -> ### Title: Indices of Taxonomic Diversity and Distinctness -> ### Aliases: taxondive summary.taxondive plot.taxondive taxa2dist -> ### Keywords: univar -> -> ### ** Examples -> -> ## Preliminary: needs better data and some support functions -> data(dune) -> data(dune.taxon) -> # Taxonomic distances from a classification table with variable step lengths. -> taxdis <- taxa2dist(dune.taxon, varstep=TRUE) -> plot(hclust(taxdis), hang = -1) -> # Indices -> mod <- taxondive(dune, taxdis) -> mod - Species Delta Delta* Lambda+ Delta+ S Delta+ -1 5.000 22.736 29.232 900.298 43.364 216.82 -2 10.000 51.046 55.988 822.191 56.232 562.32 -3 10.000 41.633 46.194 1025.471 62.869 628.69 -4 13.000 50.795 55.140 888.244 64.837 842.88 -5 14.000 63.498 67.856 715.393 69.211 968.95 -6 11.000 70.201 76.361 628.743 73.281 806.09 -7 13.000 61.605 66.187 679.337 69.918 908.94 -8 12.000 52.544 56.374 756.375 66.729 800.74 -9 13.000 50.526 54.108 849.448 63.205 821.67 -10 12.000 60.068 64.960 730.736 69.291 831.49 -11 9.000 69.589 77.740 404.609 77.803 700.23 -12 9.000 62.405 69.795 552.129 74.470 670.23 -13 10.000 47.316 53.842 536.429 66.657 666.57 -14 7.000 71.383 82.091 239.543 82.013 574.09 -15 8.000 68.564 77.097 334.889 79.010 632.08 -16 8.000 55.984 64.400 978.014 69.708 557.66 -17 7.000 53.913 60.222 632.990 59.286 415.00 -18 9.000 73.235 81.865 438.355 76.288 686.59 -19 9.000 68.727 76.091 336.364 78.636 707.73 -20 8.000 72.343 80.670 444.915 82.078 656.62 -Expected 65.330 62.560 71.031 -> summary(mod) - Delta Delta* Delta+ sd(Delta+) z(Delta+) Pr(>|z|) -1 22.7362 29.2322 43.3636 10.0499 -2.7530 0.005905 ** -2 51.0458 55.9878 56.2323 5.7727 -2.5636 0.010359 * -3 41.6334 46.1936 62.8687 5.7727 -1.4140 0.157360 -4 50.7952 55.1396 64.8368 4.5677 -1.3562 0.175047 -5 63.4979 67.8564 69.2108 4.2482 -0.4285 0.668251 -6 70.2011 76.3614 73.2810 5.3189 0.4229 0.672332 -7 61.6049 66.1871 69.9184 4.5677 -0.2437 0.807499 -8 52.5437 56.3743 66.7287 4.9215 -0.8743 0.381975 -9 50.5258 54.1079 63.2051 4.5677 -1.7134 0.086640 . -10 60.0680 64.9597 69.2906 4.9215 -0.3537 0.723567 -11 69.5894 77.7396 77.8030 6.3011 1.0747 0.282517 -12 62.4049 69.7949 74.4697 6.3011 0.5457 0.585290 -13 47.3158 53.8421 66.6566 5.7727 -0.7578 0.448548 -14 71.3834 82.0909 82.0130 7.7069 1.4249 0.154186 -15 68.5645 77.0970 79.0097 6.9314 1.1510 0.249714 -16 55.9840 64.3999 69.7078 6.9314 -0.1909 0.848565 -17 53.9134 60.2224 59.2857 7.7069 -1.5240 0.127501 -18 73.2349 81.8645 76.2879 6.3011 0.8342 0.404155 -19 68.7273 76.0909 78.6364 6.3011 1.2069 0.227457 -20 72.3431 80.6704 82.0779 6.9314 1.5937 0.111005 -Expected 65.3302 62.5603 71.0313 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> plot(mod) -> -> -> -> cleanEx() -> nameEx("tolerance") -> ### * tolerance -> -> flush(stderr()); flush(stdout()) -> -> ### Name: tolerance -> ### Title: Species tolerances and sample heterogeneities -> ### Aliases: tolerance tolerance.cca tolerance.decorana -> -> ### ** Examples -> -> data(dune) -> data(dune.env) -> mod <- cca(dune ~ ., data = dune.env) -> -> ## defaults to species tolerances -> tolerance(mod) - -Species Tolerance - -Scaling: 2 - - CCA1 CCA2 -Achimill 0.32968099 0.9241988 -Agrostol 0.93670069 0.9238455 -Airaprae 1.04694096 0.5889849 -Alopgeni 0.72227472 0.3760138 -Anthodor 1.00596787 0.8338212 -Bellpere 0.32891011 0.9962790 -Bromhord 0.27740999 0.6236199 -Chenalbu 0.00000000 0.0000000 -Cirsarve 0.00000000 0.0000000 -Comapalu 0.47185632 0.8029414 -Eleopalu 0.50344134 0.9384960 -Elymrepe 0.35119963 0.5642491 -Empenigr 0.00000000 0.0000000 -Hyporadi 1.05840696 0.7523003 -Juncarti 0.78397702 1.0686743 -Juncbufo 0.69275956 0.6180830 -Lolipere 0.51006235 0.8278177 -Planlanc 0.36040676 0.6962294 -Poaprat 0.58184277 0.9547104 -Poatriv 0.78695928 0.7433503 -Ranuflam 0.56576326 1.1725628 -Rumeacet 0.58715663 0.8751491 -Sagiproc 0.70922180 1.1153129 -Salirepe 0.98530179 0.1077917 -Scorautu 1.04355761 1.0724439 -Trifprat 0.03045846 0.3651949 -Trifrepe 1.21543364 0.9115613 -Vicilath 0.24853962 0.6194084 -Bracruta 1.03787313 1.0958331 -Callcusp 0.57882025 1.0418623 - -> -> ## sample heterogeneities for CCA axes 1:6 -> tolerance(mod, which = "sites", choices = 1:6) - -Sample Heterogeneity - -Scaling: 2 - - CCA1 CCA2 CCA3 CCA4 CCA5 CCA6 -1 0.2350112 0.8611530 1.7964571 0.4445499 2.4235732 0.5496289 -2 0.7100754 0.4136311 0.8151643 0.6311751 1.0467901 0.2514646 -3 0.5076492 0.7279717 0.8306874 0.5590739 0.3904998 0.9162012 -4 0.5955037 0.6901907 0.7931255 0.4873638 0.3966068 0.8700581 -5 0.6001048 0.5614830 1.1481560 0.3569604 0.4423909 1.9420043 -6 0.7272637 0.6867342 1.6068628 0.7778498 0.9187843 0.4938865 -7 0.6478967 0.4993262 0.7207318 0.3817131 0.4130713 0.7228173 -8 0.8563491 0.5498552 0.4217718 0.3370226 0.3013276 0.9535190 -9 0.5599722 0.7399384 0.4170304 1.0535541 1.4612437 0.7626183 -10 0.5210280 0.5806978 0.5856634 0.4174860 1.8559344 0.8890262 -11 0.4489323 0.6016877 0.3317371 1.8780211 1.2965939 2.1953737 -12 0.4948094 1.1084494 0.5226746 1.5064446 0.5703077 1.1561020 -13 0.6998985 0.8859365 0.4215474 0.8582272 0.5673698 0.5186678 -14 1.5925779 0.6747926 0.8927360 1.6798300 0.3480218 0.1575892 -15 1.0107648 0.5294221 1.0975629 1.7632888 0.2240900 0.3727240 -16 0.8031479 0.6058313 0.4871527 0.4227451 0.5341256 0.6990815 -17 0.5936276 1.5142792 0.5137979 1.0224938 1.7931775 0.6261853 -18 0.5689409 1.4067575 0.6398557 0.4983399 0.4364791 0.6590394 -19 1.1330387 0.9816332 1.1242398 0.7238920 0.5577662 0.7036044 -20 0.6737757 1.4458326 1.4380928 1.0959027 0.4142423 0.5332460 - -> ## average should be 1 with scaling = "sites", hill = TRUE -> tol <- tolerance(mod, which = "sites", scaling = "sites", hill = TRUE, -+ choices = 1:4) -> colMeans(tol) - CCA1 CCA2 CCA3 CCA4 -1.059199 1.048823 1.000551 1.077612 -> apply(tol, 2, sd) - CCA1 CCA2 CCA3 CCA4 -0.3174462 0.2793521 0.3714540 0.2681931 -> ## Rescaling tries to set all tolerances to 1 -> tol <- tolerance(decorana(dune)) -> colMeans(tol) - DCA1 DCA2 DCA3 DCA4 -0.9817657 0.9249544 0.9444811 0.9821666 -> apply(tol, 2, sd) - DCA1 DCA2 DCA3 DCA4 -0.1977777 0.3204058 0.2646872 0.1210543 -> -> -> -> cleanEx() -> nameEx("treedive") -> ### * treedive -> -> flush(stderr()); flush(stdout()) -> -> ### Name: treedive -> ### Title: Functional Diversity and Community Distances from Species Trees -> ### Aliases: treedive treeheight treedist -> ### Keywords: univar -> -> ### ** Examples -> -> -> ## There is no data set on species properties yet, and we demonstrate -> ## the methods using phylogenetic trees -> data(dune) -> data(dune.phylodis) -> cl <- hclust(dune.phylodis) -> treedive(dune, cl) -forced matching of 'tree' labels and 'comm' names - 1 2 3 4 5 6 7 8 - 384.0913 568.8791 1172.9455 1327.9317 1426.9067 1391.1628 1479.5062 1523.0792 - 9 10 11 12 13 14 15 16 -1460.0423 1316.4832 1366.9960 1423.5582 895.1120 1457.2705 1505.9501 1187.5165 - 17 18 19 20 - 517.6920 1394.5162 1470.4671 1439.5571 -> ## Significance test using Null model communities. -> ## The current choice fixes numbers of species and picks species -> ## proportionally to their overall frequency -> oecosimu(dune, treedive, "r1", tree = cl, verbose = FALSE) -Warning in oecosimu(dune, treedive, "r1", tree = cl, verbose = FALSE) : - nullmodel transformed 'comm' to binary data -oecosimu object - -Call: oecosimu(comm = dune, nestfun = treedive, method = "r1", tree = -cl, verbose = FALSE) - -nullmodel method ‘r1’ with 99 simulations - -alternative hypothesis: statistic is less or greater than simulated values - - statistic SES mean 2.5% 50% 97.5% Pr(sim.) -1 384.09 -1.28273 781.41 382.13 664.87 1244.3 0.09 . -2 568.88 -2.29048 1245.21 648.63 1342.75 1602.9 0.01 ** -3 1172.95 -0.28386 1251.47 668.89 1353.45 1594.1 0.57 -4 1327.93 -0.18989 1376.56 850.14 1462.61 1689.9 0.63 -5 1426.91 -0.24932 1484.65 892.50 1544.84 1755.4 0.55 -6 1391.16 0.40503 1285.89 721.15 1364.47 1596.7 0.83 -7 1479.51 0.26497 1416.16 789.44 1480.89 1712.1 0.99 -8 1523.08 0.56404 1366.20 742.42 1453.77 1730.5 0.63 -9 1460.04 0.11145 1433.00 879.43 1498.68 1747.1 0.77 -10 1316.48 -0.11917 1348.17 798.65 1428.77 1684.6 0.57 -11 1367.00 0.73635 1164.21 630.76 1249.70 1516.6 0.51 -12 1423.56 0.90574 1147.15 565.62 1260.84 1508.1 0.35 -13 895.11 -1.04265 1207.29 628.21 1328.30 1580.5 0.51 -14 1457.27 1.52076 1005.04 533.57 1133.14 1382.6 0.03 * -15 1505.95 1.34359 1109.43 504.18 1218.43 1511.6 0.07 . -16 1187.52 0.47862 1040.61 585.02 1175.42 1474.2 0.99 -17 517.69 -1.44887 960.72 521.92 1120.30 1374.2 0.03 * -18 1394.52 0.88939 1138.12 652.91 1251.28 1505.1 0.39 -19 1470.47 1.03008 1179.52 554.33 1275.38 1476.5 0.09 . -20 1439.56 1.22599 1085.02 553.27 1235.70 1441.9 0.09 . ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## Phylogenetically ordered community table -> dtree <- treedist(dune, cl) -> tabasco(dune, hclust(dtree), cl) -> ## Use tree distances in capscale -> capscale(dtree ~ 1, comm=dune) -Call: capscale(formula = dtree ~ 1, comm = dune) - - Inertia Rank -Total 2.1834 -Unconstrained 2.3439 10 -Imaginary -0.1605 9 -Inertia is squared Treedist distance -Species scores projected from ‘dune’ - -Eigenvalues for unconstrained axes: - MDS1 MDS2 MDS3 MDS4 MDS5 MDS6 MDS7 MDS8 MDS9 MDS10 -1.1971 0.4546 0.2967 0.1346 0.1067 0.0912 0.0391 0.0190 0.0045 0.0004 - -> -> -> -> cleanEx() -> nameEx("tsallis") -> ### * tsallis -> -> flush(stderr()); flush(stdout()) -> -> ### Name: tsallis -> ### Title: Tsallis Diversity and Corresponding Accumulation Curves -> ### Aliases: tsallis tsallisaccum persp.tsallisaccum -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(BCI) -> i <- sample(nrow(BCI), 12) -> x1 <- tsallis(BCI[i,]) -> x1 - 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 -4 93 41.96845 20.49096 10.893385 6.315044 3.976563 2.697452 1.950144 1.486011 -39 83 37.13183 17.98063 9.524369 5.542801 3.530494 2.435169 1.793695 1.391532 -1 92 41.86190 20.57075 10.982654 6.380074 4.018412 2.723011 1.965359 1.494945 -34 91 40.76643 19.76149 10.454108 6.053163 3.821669 2.606302 1.896645 1.454634 -23 98 44.40473 21.59625 11.375711 6.520517 4.062575 2.732882 1.964464 1.491646 -43 85 38.38228 18.77974 10.035449 5.867927 3.736254 2.565004 1.875593 1.443295 -14 97 43.58438 21.14034 11.153293 6.418569 4.017494 2.713442 1.956269 1.488283 -18 88 40.68467 20.15164 10.784931 6.264583 3.944985 2.675802 1.935407 1.476270 -33 85 38.33236 18.75302 10.027610 5.869003 3.740392 2.569560 1.879580 1.446458 -21 98 43.64355 21.01620 11.036849 6.340108 3.969925 2.685700 1.940242 1.478977 -41 101 45.01956 21.66615 11.353495 6.499317 4.052495 2.729799 1.964435 1.492566 -10 93 41.50369 20.10059 10.639881 6.164157 3.889803 2.648176 1.922207 1.470121 - 1.8 2 -4 1.181429 0.9716117 -39 1.123737 0.9360204 -1 1.186634 0.9746293 -34 1.163015 0.9607876 -23 1.183553 0.9723529 -43 1.156578 0.9569632 -14 1.182226 0.9718626 -18 1.175165 0.9676685 -33 1.158957 0.9586946 -21 1.176759 0.9686058 -41 1.184546 0.9731442 -10 1.172341 0.9663808 -> diversity(BCI[i,],"simpson") == x1[["2"]] - 4 39 1 34 23 43 14 18 33 21 41 10 -TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE -> plot(x1) -> x2 <- tsallis(BCI[i,],norm=TRUE) -> x2 - 0 0.2 0.4 0.6 0.8 1 1.2 1.4 -4 1 0.9101799 0.8614882 0.8452139 0.8528120 0.8752597 0.9037665 0.9313684 -39 1 0.8833633 0.8127010 0.7799621 0.7774979 0.7968043 0.8286189 0.8643658 -1 1 0.9158836 0.8708030 0.8565058 0.8646892 0.8865579 0.9136511 0.9394163 -34 1 0.8998773 0.8423760 0.8195118 0.8233665 0.8451677 0.8757762 0.9073385 -23 1 0.9228895 0.8782744 0.8611017 0.8654544 0.8841064 0.9093061 0.9344888 -43 1 0.8955869 0.8360372 0.8125579 0.8165505 0.8387881 0.8699334 0.9021018 -14 1 0.9134203 0.8653450 0.8483542 0.8548076 0.8762317 0.9040571 0.9313075 -18 1 0.9228941 0.8775173 0.8589786 0.8616917 0.8788828 0.9032164 0.9283108 -33 1 0.8944221 0.8348478 0.8119231 0.8167002 0.8397172 0.8714789 0.9040191 -21 1 0.9070695 0.8546849 0.8354510 0.8415091 0.8639438 0.8936072 0.9229664 -41 1 0.9130269 0.8644349 0.8473152 0.8541311 0.8762204 0.9047063 0.9323803 -10 1 0.9001004 0.8450759 0.8255446 0.8324355 0.8561634 0.8872568 0.9180261 - 1.6 1.8 2 -4 0.9540821 0.9707655 0.9820591 -39 0.8978144 0.9257229 0.9472977 -1 0.9602511 0.9752690 0.9852231 -34 0.9347873 0.9560842 0.9713457 -23 0.9556498 0.9714412 0.9822749 -43 0.9302296 0.9522490 0.9682216 -14 0.9538903 0.9705576 0.9818818 -18 0.9500471 0.9667897 0.9786648 -33 0.9322682 0.9542083 0.9699733 -21 0.9475331 0.9658643 0.9784896 -41 0.9550896 0.9716606 0.9827793 -10 0.9438798 0.9632975 0.9767719 -> plot(x2) -> mod1 <- tsallisaccum(BCI[i,]) -> plot(mod1, as.table=TRUE, col = c(1, 2, 2)) -> persp(mod1) -> mod2 <- tsallisaccum(BCI[i,], norm=TRUE) -> persp(mod2,theta=100,phi=30) -> -> -> -> cleanEx() -> nameEx("varechem") -> ### * varechem -> -> flush(stderr()); flush(stdout()) -> -> ### Name: varespec -> ### Title: Vegetation and environment in lichen pastures -> ### Aliases: varechem varespec -> ### Keywords: datasets -> -> ### ** Examples -> -> data(varespec) -> data(varechem) -> -> -> -> cleanEx() -> nameEx("varpart") -> ### * varpart -> -> flush(stderr()); flush(stdout()) -> -> ### Name: varpart -> ### Title: Partition the Variation of Community Matrix by 2, 3, or 4 -> ### Explanatory Matrices -> ### Aliases: varpart varpart2 varpart3 varpart4 showvarparts -> ### summary.varpart plot.varpart plot.varpart234 simpleRDA2 simpleDBRDA -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(mite) -> data(mite.env) -> data(mite.pcnm) -> -> # Two explanatory data frames -- Hellinger-transform Y -> mod <- varpart(mite, mite.env, mite.pcnm, transfo="hel") -> mod - -Partition of variance in RDA - -Call: varpart(Y = mite, X = mite.env, mite.pcnm, transfo = "hel") -Species transformation: hellinger -Explanatory tables: -X1: mite.env -X2: mite.pcnm - -No. of explanatory tables: 2 -Total variation (SS): 27.205 - Variance: 0.39428 -No. of observations: 70 - -Partition table: - Df R.squared Adj.R.squared Testable -[a+c] = X1 11 0.52650 0.43670 TRUE -[b+c] = X2 22 0.62300 0.44653 TRUE -[a+b+c] = X1+X2 33 0.75893 0.53794 TRUE -Individual fractions -[a] = X1|X2 11 0.09141 TRUE -[b] = X2|X1 22 0.10124 TRUE -[c] 0 0.34530 FALSE -[d] = Residuals 0.46206 FALSE ---- -Use function ‘rda’ to test significance of fractions of interest -> summary(mod) - -Unique fractions and total with shared fractions equally allocated: - - Unique Contributed Component -X1 0.0914 0.264 mite.env -X2 0.1012 0.274 mite.pcnm - -Contributions of fractions to sets: - - X1 X2 -[a] 0.0914 -[b] 0.1012 -[c] 0.1726 0.1726 -> -> ## Use fill colours -> showvarparts(2, bg = c("hotpink","skyblue")) -> plot(mod, bg = c("hotpink","skyblue")) -> ## Test fraction [a] using partial RDA, '~ .' in formula tells to use -> ## all variables of data mite.env. -> aFrac <- rda(decostand(mite, "hel"), mite.env, mite.pcnm) -> anova(aFrac) -Permutation test for rda under reduced model -Permutation: free -Number of permutations: 999 - -Model: rda(X = decostand(mite, "hel"), Y = mite.env, Z = mite.pcnm) - Df Variance F Pr(>F) -Model 11 0.053592 1.8453 0.001 *** -Residual 36 0.095050 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## RsquareAdj gives the same result as component [a] of varpart -> RsquareAdj(aFrac) -$r.squared -[1] 0.1359251 - -$adj.r.squared -[1] 0.09140797 - -> -> ## Partition Bray-Curtis dissimilarities -> varpart(vegdist(mite), mite.env, mite.pcnm) - -Partition of squared Bray distance in dbRDA - -Call: varpart(Y = vegdist(mite), X = mite.env, mite.pcnm) - -Explanatory tables: -X1: mite.env -X2: mite.pcnm - -No. of explanatory tables: 2 -Total variation (SS): 14.696 -No. of observations: 70 - -Partition table: - Df R.squared Adj.R.squared Testable -[a+c] = X1 11 0.50512 0.41127 TRUE -[b+c] = X2 22 0.60144 0.41489 TRUE -[a+b+c] = X1+X2 33 0.74631 0.51375 TRUE -Individual fractions -[a] = X1|X2 11 0.09887 TRUE -[b] = X2|X1 22 0.10249 TRUE -[c] 0 0.31240 FALSE -[d] = Residuals 0.48625 FALSE ---- -Use function ‘dbrda’ to test significance of fractions of interest -> ## Three explanatory tables with formula interface -> mod <- varpart(mite, ~ SubsDens + WatrCont, ~ Substrate + Shrub + Topo, -+ mite.pcnm, data=mite.env, transfo="hel") -> mod - -Partition of variance in RDA - -Call: varpart(Y = mite, X = ~SubsDens + WatrCont, ~Substrate + Shrub + -Topo, mite.pcnm, data = mite.env, transfo = "hel") -Species transformation: hellinger -Explanatory tables: -X1: ~SubsDens + WatrCont -X2: ~Substrate + Shrub + Topo -X3: mite.pcnm - -No. of explanatory tables: 3 -Total variation (SS): 27.205 - Variance: 0.39428 -No. of observations: 70 - -Partition table: - Df R.square Adj.R.square Testable -[a+d+f+g] = X1 2 0.32677 0.30667 TRUE -[b+d+e+g] = X2 9 0.40395 0.31454 TRUE -[c+e+f+g] = X3 22 0.62300 0.44653 TRUE -[a+b+d+e+f+g] = X1+X2 11 0.52650 0.43670 TRUE -[a+c+d+e+f+g] = X1+X3 24 0.67372 0.49970 TRUE -[b+c+d+e+f+g] = X2+X3 31 0.72400 0.49884 TRUE -[a+b+c+d+e+f+g] = All 33 0.75893 0.53794 TRUE -Individual fractions -[a] = X1 | X2+X3 2 0.03910 TRUE -[b] = X2 | X1+X3 9 0.03824 TRUE -[c] = X3 | X1+X2 22 0.10124 TRUE -[d] 0 0.01407 FALSE -[e] 0 0.09179 FALSE -[f] 0 0.08306 FALSE -[g] 0 0.17045 FALSE -[h] = Residuals 0.46206 FALSE -Controlling 1 table X -[a+d] = X1 | X3 2 0.05317 TRUE -[a+f] = X1 | X2 2 0.12216 TRUE -[b+d] = X2 | X3 9 0.05231 TRUE -[b+e] = X2 | X1 9 0.13003 TRUE -[c+e] = X3 | X1 22 0.19303 TRUE -[c+f] = X3 | X2 22 0.18429 TRUE ---- -Use function ‘rda’ to test significance of fractions of interest -> summary(mod) - -Unique fractions and total with shared fractions equally allocated: - - Unique Contributed Component -X1 0.0391 0.144 ~SubsDens + WatrCont -X2 0.0382 0.148 ~Substrate + Shrub + Topo -X3 0.1012 0.245 mite.pcnm - -Contributions of fractions to sets: - - X1 X2 X3 -[a] 0.03910 -[b] 0.03824 -[c] 0.10124 -[d] 0.00703 0.00703 -[e] 0.04590 0.04590 -[f] 0.04153 0.04153 -[g] 0.05682 0.05682 0.05682 -> showvarparts(3, bg=2:4) -> plot(mod, bg=2:4) -> -> ## Use RDA to test fraction [a] -> ## Matrix can be an argument in formula -> rda.result <- rda(decostand(mite, "hell") ~ SubsDens + WatrCont + -+ Condition(Substrate + Shrub + Topo) + -+ Condition(as.matrix(mite.pcnm)), data = mite.env) -> anova(rda.result) -Permutation test for rda under reduced model -Permutation: free -Number of permutations: 999 - -Model: rda(formula = decostand(mite, "hell") ~ SubsDens + WatrCont + Condition(Substrate + Shrub + Topo) + Condition(as.matrix(mite.pcnm)), data = mite.env) - Df Variance F Pr(>F) -Model 2 0.013771 2.6079 0.004 ** -Residual 36 0.095050 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> ## Four explanatory tables -> mod <- varpart(mite, ~ SubsDens + WatrCont, ~Substrate + Shrub + Topo, -+ mite.pcnm[,1:11], mite.pcnm[,12:22], data=mite.env, transfo="hel") -> mod - -Partition of variance in RDA - -Call: varpart(Y = mite, X = ~SubsDens + WatrCont, ~Substrate + Shrub + -Topo, mite.pcnm[, 1:11], mite.pcnm[, 12:22], data = mite.env, transfo = -"hel") -Species transformation: hellinger -Explanatory tables: -X1: ~SubsDens + WatrCont -X2: ~Substrate + Shrub + Topo -X3: mite.pcnm[, 1:11] -X4: mite.pcnm[, 12:22] - -No. of explanatory tables: 4 -Total variation (SS): 27.205 - Variance: 0.39428 -No. of observations: 70 - -Partition table: - Df R.square Adj.R.square Testable -[aeghklno] = X1 2 0.32677 0.30667 TRUE -[befiklmo] = X2 9 0.40395 0.31454 TRUE -[cfgjlmno] = X3 11 0.53231 0.44361 TRUE -[dhijkmno] = X4 11 0.09069 -0.08176 TRUE -[abefghiklmno] = X1+X2 11 0.52650 0.43670 TRUE -[acefghjklmno] = X1+X3 13 0.59150 0.49667 TRUE -[adeghijklmno] = X1+X4 13 0.40374 0.26533 TRUE -[bcefgijklmno] = X2+X3 20 0.63650 0.48813 TRUE -[bdefhijklmno] = X2+X4 20 0.53338 0.34292 TRUE -[cdfghijklmno] = X3+X4 22 0.62300 0.44653 TRUE -[abcefghijklmno] = X1+X2+X3 22 0.67947 0.52944 TRUE -[abdefghijklmno] = X1+X2+X4 22 0.61553 0.43557 TRUE -[acdefghijklmno] = X1+X3+X4 24 0.67372 0.49970 TRUE -[bcdefghijklmno] = X2+X3+X4 31 0.72400 0.49884 TRUE -[abcdefghijklmno] = All 33 0.75893 0.53794 TRUE -Individual fractions -[a] = X1 | X2+X3+X4 2 0.03910 TRUE -[b] = X2 | X1+X3+X4 9 0.03824 TRUE -[c] = X3 | X1+X2+X4 11 0.10237 TRUE -[d] = X4 | X1+X2+X3 11 0.00850 TRUE -[e] 0 0.01407 FALSE -[f] 0 0.13200 FALSE -[g] 0 0.05355 FALSE -[h] 0 0.00220 FALSE -[i] 0 -0.00547 FALSE -[j] 0 -0.00963 FALSE -[k] 0 -0.00231 FALSE -[l] 0 0.24037 FALSE -[m] 0 -0.03474 FALSE -[n] 0 0.02730 FALSE -[o] 0 -0.06761 FALSE -[p] = Residuals 0 0.46206 FALSE -Controlling 2 tables X -[ae] = X1 | X3+X4 2 0.05317 TRUE -[ag] = X1 | X2+X4 2 0.09265 TRUE -[ah] = X1 | X2+X3 2 0.04131 TRUE -[be] = X2 | X3+X4 9 0.05231 TRUE -[bf] = X2 | X1+X4 9 0.17024 TRUE -[bi] = X2 | X1+X3 9 0.03277 TRUE -[cf] = X3 | X1+X4 11 0.23437 TRUE -[cg] = X3 | X2+X4 11 0.15592 TRUE -[cj] = X3 | X1+X2 11 0.09274 TRUE -[dh] = X4 | X2+X3 11 0.01071 TRUE -[di] = X4 | X1+X3 11 0.00303 TRUE -[dj] = X4 | X1+X2 11 -0.00113 TRUE -Controlling 1 table X -[aghn] = X1 | X2 2 0.12216 TRUE -[aehk] = X1 | X3 2 0.05306 TRUE -[aegl] = X1 | X4 2 0.34709 TRUE -[bfim] = X2 | X1 9 0.13003 TRUE -[beik] = X2 | X3 9 0.04452 TRUE -[befl] = X2 | X4 9 0.42468 TRUE -[cfjm] = X3 | X1 11 0.19000 TRUE -[cgjn] = X3 | X2 11 0.17359 TRUE -[cfgl] = X3 | X4 11 0.52830 TRUE -[dijm] = X4 | X1 11 -0.04134 TRUE -[dhjn] = X4 | X2 11 0.02837 TRUE -[dhik] = X4 | X3 11 0.00292 TRUE ---- -Use function ‘rda’ to test significance of fractions of interest -> summary(mod) - -Unique fractions and total with shared fractions equally allocated: - - Unique Contributed Component -X1 0.0391 0.1456 ~SubsDens + WatrCont -X2 0.0382 0.1594 ~Substrate + Shrub + Topo -X3 0.1024 0.2511 mite.pcnm[, 1:11] -X4 0.0085 -0.0181 mite.pcnm[, 12:22] - -Contributions of fractions to sets: - - X1 X2 X3 X4 -[a] 0.03910 -[b] 0.03824 -[c] 0.10237 -[d] 0.00850 -[e] 0.00703 0.00703 -[f] 0.06600 0.06600 -[g] 0.02678 0.02678 -[h] 0.00110 0.00110 -[i] -0.00274 -0.00274 -[j] -0.00482 -0.00482 -[k] -0.00077 -0.00077 -0.00077 -[l] 0.08012 0.08012 0.08012 -[m] -0.01158 -0.01158 -0.01158 -[n] 0.00910 0.00910 0.00910 -[o] -0.01690 -0.01690 -0.01690 -0.01690 -> plot(mod, bg=2:5) -> ## Show values for all partitions by putting 'cutoff' low enough: -> plot(mod, cutoff = -Inf, cex = 0.7, bg=2:5) -> -> -> -> cleanEx() -> nameEx("vegan-package") -> ### * vegan-package -> -> flush(stderr()); flush(stdout()) -> -> ### Name: vegan-package -> ### Title: Community Ecology Package: Ordination, Diversity and -> ### Dissimilarities -> ### Aliases: vegan-package vegan -> ### Keywords: package multivariate univar models spatial nonparametric -> ### htest regression -> -> ### ** Examples -> -> ### Example 1: Unconstrained ordination -> ## NMDS -> data(varespec) -> data(varechem) -> ord <- metaMDS(varespec) -Square root transformation -Wisconsin double standardization -Run 0 stress 0.1843196 -Run 1 stress 0.2455911 -Run 2 stress 0.2169404 -Run 3 stress 0.2313231 -Run 4 stress 0.1974406 -Run 5 stress 0.1858401 -Run 6 stress 0.1948413 -Run 7 stress 0.2265716 -Run 8 stress 0.2104573 -Run 9 stress 0.1962451 -Run 10 stress 0.2673136 -Run 11 stress 0.1976151 -Run 12 stress 0.1852397 -Run 13 stress 0.2341081 -Run 14 stress 0.1955837 -Run 15 stress 0.2137396 -Run 16 stress 0.2109613 -Run 17 stress 0.1825658 -... New best solution -... Procrustes: rmse 0.04163108 max resid 0.1518283 -Run 18 stress 0.1843196 -Run 19 stress 0.2570114 -Run 20 stress 0.3760489 -*** Best solution was not repeated -- monoMDS stopping criteria: - 20: stress ratio > sratmax -> plot(ord, type = "t") -> ## Fit environmental variables -> ef <- envfit(ord, varechem) -> ef - -***VECTORS - - NMDS1 NMDS2 r2 Pr(>r) -N -0.05727 -0.99836 0.2537 0.044 * -P 0.61968 0.78485 0.1938 0.096 . -K 0.76641 0.64235 0.1809 0.120 -Ca 0.68515 0.72840 0.4119 0.004 ** -Mg 0.63249 0.77457 0.4270 0.003 ** -S 0.19134 0.98152 0.1752 0.144 -Al -0.87163 0.49017 0.5269 0.002 ** -Fe -0.93605 0.35187 0.4451 0.004 ** -Mn 0.79872 -0.60171 0.5231 0.002 ** -Zn 0.61754 0.78654 0.1879 0.120 -Mo -0.90307 0.42949 0.0609 0.490 -Baresoil 0.92492 -0.38015 0.2508 0.053 . -Humdepth 0.93285 -0.36027 0.5200 0.001 *** -pH -0.64801 0.76163 0.2308 0.051 . ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -Permutation: free -Number of permutations: 999 - - -> plot(ef, p.max = 0.05) -> ### Example 2: Constrained ordination (RDA) -> ## The example uses formula interface to define the model -> data(dune) -> data(dune.env) -> ## No constraints: PCA -> mod0 <- rda(dune ~ 1, dune.env) -> mod0 -Call: rda(formula = dune ~ 1, data = dune.env) - - Inertia Rank -Total 84.12 -Unconstrained 84.12 19 -Inertia is variance - -Eigenvalues for unconstrained axes: - PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 -24.795 18.147 7.629 7.153 5.695 4.333 3.199 2.782 -(Showing 8 of 19 unconstrained eigenvalues) - -> plot(mod0) -> ## All environmental variables: Full model -> mod1 <- rda(dune ~ ., dune.env) -> mod1 -Call: rda(formula = dune ~ A1 + Moisture + Management + Use + Manure, -data = dune.env) - - Inertia Proportion Rank -Total 84.1237 1.0000 -Constrained 63.2062 0.7513 12 -Unconstrained 20.9175 0.2487 7 -Inertia is variance -Some constraints or conditions were aliased because they were redundant - -Eigenvalues for constrained axes: - RDA1 RDA2 RDA3 RDA4 RDA5 RDA6 RDA7 RDA8 RDA9 RDA10 RDA11 -22.396 16.208 7.039 4.038 3.760 2.609 2.167 1.803 1.404 0.917 0.582 - RDA12 - 0.284 - -Eigenvalues for unconstrained axes: - PC1 PC2 PC3 PC4 PC5 PC6 PC7 -6.627 4.309 3.549 2.546 2.340 0.934 0.612 - -> plot(mod1) -> ## Automatic selection of variables by permutation P-values -> mod <- ordistep(mod0, scope=formula(mod1)) - -Start: dune ~ 1 - - Df AIC F Pr(>F) -+ Management 3 87.082 2.8400 0.005 ** -+ Moisture 3 87.707 2.5883 0.005 ** -+ Manure 4 89.232 1.9539 0.015 * -+ A1 1 89.591 1.9217 0.055 . -+ Use 2 91.032 1.1741 0.260 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Step: dune ~ Management - - Df AIC F Pr(>F) -- Management 3 89.62 2.84 0.005 ** ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - - Df AIC F Pr(>F) -+ Moisture 3 85.567 1.9764 0.005 ** -+ Manure 3 87.517 1.3902 0.095 . -+ A1 1 87.424 1.2965 0.180 -+ Use 2 88.284 1.0510 0.345 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - -Step: dune ~ Management + Moisture - - Df AIC F Pr(>F) -- Moisture 3 87.082 1.9764 0.015 * -- Management 3 87.707 2.1769 0.010 ** ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 - - Df AIC F Pr(>F) -+ Manure 3 85.762 1.1225 0.365 -+ A1 1 86.220 0.8359 0.630 -+ Use 2 86.842 0.8027 0.690 - -> mod -Call: rda(formula = dune ~ Management + Moisture, data = dune.env) - - Inertia Proportion Rank -Total 84.1237 1.0000 -Constrained 46.4249 0.5519 6 -Unconstrained 37.6988 0.4481 13 -Inertia is variance - -Eigenvalues for constrained axes: - RDA1 RDA2 RDA3 RDA4 RDA5 RDA6 -21.588 14.075 4.123 3.163 2.369 1.107 - -Eigenvalues for unconstrained axes: - PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11 PC12 PC13 -8.241 7.138 5.355 4.409 3.143 2.770 1.878 1.741 0.952 0.909 0.627 0.311 0.227 - -> plot(mod) -> ## Permutation test for all variables -> anova(mod) -Permutation test for rda under reduced model -Permutation: free -Number of permutations: 999 - -Model: rda(formula = dune ~ Management + Moisture, data = dune.env) - Df Variance F Pr(>F) -Model 6 46.425 2.6682 0.001 *** -Residual 13 37.699 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## Permutation test of "type III" effects, or significance when a term -> ## is added to the model after all other terms -> anova(mod, by = "margin") -Permutation test for rda under reduced model -Marginal effects of terms -Permutation: free -Number of permutations: 999 - -Model: rda(formula = dune ~ Management + Moisture, data = dune.env) - Df Variance F Pr(>F) -Management 3 18.938 2.1769 0.002 ** -Moisture 3 17.194 1.9764 0.007 ** -Residual 13 37.699 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> ## Plot only sample plots, use different symbols and draw SD ellipses -> ## for Managemenet classes -> plot(mod, display = "sites", type = "n") -> with(dune.env, points(mod, disp = "si", pch = as.numeric(Management))) -> with(dune.env, legend("topleft", levels(Management), pch = 1:4, -+ title = "Management")) -> with(dune.env, ordiellipse(mod, Management, label = TRUE)) -> ## add fitted surface of diversity to the model -> ordisurf(mod, diversity(dune), add = TRUE) - -Family: gaussian -Link function: identity - -Formula: -y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE) - -Estimated degrees of freedom: -1.28 total = 2.28 - -REML score: 3.00623 -> ### Example 3: analysis of dissimilarites a.k.a. non-parametric -> ### permutational anova -> adonis2(dune ~ ., dune.env) -Permutation test for adonis under reduced model -Terms added sequentially (first to last) -Permutation: free -Number of permutations: 999 - -adonis2(formula = dune ~ ., data = dune.env) - Df SumOfSqs R2 F Pr(>F) -A1 1 0.7230 0.16817 5.2038 0.001 *** -Moisture 3 1.1871 0.27613 2.8482 0.005 ** -Management 3 0.9036 0.21019 2.1681 0.019 * -Use 2 0.0921 0.02143 0.3315 0.979 -Manure 3 0.4208 0.09787 1.0096 0.453 -Residual 7 0.9725 0.22621 -Total 19 4.2990 1.00000 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> adonis2(dune ~ Management + Moisture, dune.env) -Permutation test for adonis under reduced model -Terms added sequentially (first to last) -Permutation: free -Number of permutations: 999 - -adonis2(formula = dune ~ Management + Moisture, data = dune.env) - Df SumOfSqs R2 F Pr(>F) -Management 3 1.4686 0.34161 3.7907 0.002 ** -Moisture 3 1.1516 0.26788 2.9726 0.003 ** -Residual 13 1.6788 0.39051 -Total 19 4.2990 1.00000 ---- -Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -> -> -> -> cleanEx() -> nameEx("vegdist") -> ### * vegdist -> -> flush(stderr()); flush(stdout()) -> -> ### Encoding: UTF-8 -> -> ### Name: vegdist -> ### Title: Dissimilarity Indices for Community Ecologists -> ### Aliases: vegdist -> ### Keywords: multivariate -> -> ### ** Examples -> -> data(varespec) -> vare.dist <- vegdist(varespec) -> # Orlóci's Chord distance: range 0 .. sqrt(2) -> vare.dist <- vegdist(decostand(varespec, "norm"), "euclidean") -> # Anderson et al. (2006) version of Gower -> vare.dist <- vegdist(decostand(varespec, "log"), "altGower") -Warning: non-integer data: divided by smallest positive value -> # Range standardization with "altGower" (that excludes double-zeros) -> vare.dist <- vegdist(decostand(varespec, "range"), "altGower") -> -> -> -> cleanEx() -> nameEx("vegemite") -> ### * vegemite -> -> flush(stderr()); flush(stdout()) -> -> ### Name: vegemite -> ### Title: Display Compact Ordered Community Tables -> ### Aliases: vegemite tabasco coverscale -> ### Keywords: print manip hplot -> -> ### ** Examples -> -> data(varespec) -> ## Print only more common species -> freq <- apply(varespec > 0, 2, sum) -> vegemite(varespec, scale="Hult", sp.ind = freq > 10) - - 1122212121122 1112 - 854739268340575634292011 - Callvulg 111...11.311...1111.111. - Empenigr 211332121112211111212213 - Vaccviti 323332212113221211233234 - Pinusylv 111.111111111.11.1111111 - Dicrfusc 12.111441121211111111111 - Dicrpoly .11.11.11..1.11....1.111 - Pleuschr 144533435123411111111131 - Polyjuni 111.11.111112111.111.111 - Pohlnuta 111111111111.1..11.11111 - Ptilcili 1111111111..1..11.11..12 - Cladarbu 321122121332143423111121 - Cladrang 321221131312145443313241 - Cladstel 11111311.211.11254555542 - Cladunci 112111111131111111111111 - Cladcocc 11..11111111111111.1.11. - Cladcorn 111111111111111111111111 - Cladgrac 111111111111111111111.11 - Cladfimb 11.1111111111111111111.1 - Cladcris 111111111111111111111111 - Cladchlo ..1.111..1...1.11.11.1.1 - Cetreric 111...11.111111111.1.1.. - Cetrisla .11....1111.1....1.11111 - Stersp 111.11.1111.112111...11. - Claddefo 1111111111111111111111.1 -24 sites, 24 species -scale: Hult -> ## Order by correspondence analysis, use Hill scaling and layout: -> dca <- decorana(varespec) -> vegemite(varespec, dca, "Hill", zero="-") - - 1 1 1 11122211122222 - 203942561738913046572458 - Flavniva -1114-11-1-11-1--------- - Cladstel 5555551451425411111211-- - Cladphyl -1-1----1-------1------- - Cladcerv 1---1-----------------1- - Cladsp ---11--1--11---1-1-11-1- - Cladamau --1---1----1------------ - Cladchlo 1111---1-11-111-----11-- - Cladrang 535254555555223414332321 - Diphcomp --11-----112----------1- - Stersp -11-1-4111111-1-111--111 - Pinusylv 11-111111-111111111-1111 - Polypili ------111--11-11--1----- - Cetrisla -1-111--1-1--1--111--111 - Cladcocc -1111-1111111-11111-1-11 - Cladarbu 113142453555313343413231 - Vacculig --1-1----3-1---1---12-11 - Pohlnuta -11111--11111111111111-1 - Cladfimb 11111111-111111111111-11 - Callvulg 111-21-12-51---1221-21-- - Icmaeric ------1--1------11------ - Empenigr 342214131314344333143131 - Vaccviti 342514244334455432444443 - Cladgrac 1-1111111111111111111111 - Cetreric -1111-11-111---1111-111- - Cladcorn 111111111111111111111111 - Cladcris 111111111111111111111111 - Peltapht --------1-11--1----1--1- - Ptilcili 1-11---11-11141--1111111 - Barbhatc ----------1-121----1---- - Claddefo 11111111-111111111111111 - Cladbotr ----------1-1111---1-1-1 - Betupube -------------1------1-1- - Dicrpoly -1-1--1-11--1211-11--1-1 - Cladunci 111111122111111251212311 - Polycomm ------------11--1--1--1- - Polyjuni 11-11-1111111121111--131 - Rhodtome ----------1--2-----21--1 - Dicrfusc 111111111121112145425-41 - Pleuschr 111213114132524434555555 - Vaccmyrt ---1------1-24--12133--4 - Descflex ----1----1--11-----21-11 - Nepharct --1------1-1---1------2- - Dicrsp -----1----1--1-1-11-1541 - Hylosple ---------------1---3--13 -24 sites, 44 species -scale: Hill -> ## Show one class from cluster analysis, but retain the ordering above -> clus <- hclust(vegdist(varespec)) -> cl <- cutree(clus, 3) -> sel <- vegemite(varespec, use=dca, select = cl == 3, scale="Br") - - 1 12 - 20921 - Flavniva .++.. - Cladstel 55542 - Cladphyl .++.. - Cladcerv r.... - Cladsp ..+.. - Cladchlo r++.+ - Cladrang 22121 - Diphcomp ..+.. - Stersp .+... - Pinusylv r++1+ - Cetrisla .++++ - Cladcocc .++.. - Cladarbu +1+1+ - Pohlnuta .++++ - Cladfimb r++++ - Callvulg r+.+. - Empenigr 22122 - Vaccviti 22223 - Cladgrac r.+++ - Cetreric .++.. - Cladcorn r+++r - Cladcris r++++ - Ptilcili r.+.2 - Barbhatc ....1 - Claddefo r++++ - Cladbotr ....+ - Betupube ....+ - Dicrpoly .++.1 - Cladunci +++1+ - Polycomm ....+ - Polyjuni r++.+ - Rhodtome ....1 - Dicrfusc r++++ - Pleuschr ++121 - Vaccmyrt ..+.2 - Descflex ....+ - Dicrsp ...++ -5 sites, 37 species -scale: Braun.Blanquet -> ## Re-create previous -> vegemite(varespec, sp=sel$sp, site=sel$site, scale="Hult") - - 1 12 - 20921 - Flavniva .11.. - Cladstel 55552 - Cladphyl .11.. - Cladcerv 1.... - Cladsp ..1.. - Cladchlo 111.1 - Cladrang 32131 - Diphcomp ..1.. - Stersp .1... - Pinusylv 11111 - Cetrisla .1111 - Cladcocc .11.. - Cladarbu 11111 - Pohlnuta .1111 - Cladfimb 11111 - Callvulg 11.1. - Empenigr 22123 - Vaccviti 22334 - Cladgrac 1.111 - Cetreric .11.. - Cladcorn 11111 - Cladcris 11111 - Ptilcili 1.1.2 - Barbhatc ....1 - Claddefo 11111 - Cladbotr ....1 - Betupube ....1 - Dicrpoly .11.1 - Cladunci 11111 - Polycomm ....1 - Polyjuni 111.1 - Rhodtome ....1 - Dicrfusc 11111 - Pleuschr 11111 - Vaccmyrt ..1.3 - Descflex ....1 - Dicrsp ...11 -5 sites, 37 species -scale: Hult -> ## Re-order clusters by ordination -> clus <- as.dendrogram(clus) -> clus <- reorder(clus, scores(dca, choices=1, display="sites"), agglo.FUN = mean) -> vegemite(varespec, clus, scale = "Hult") - - 1 111 1211221212222 - 431567380922149306254578 - Flavniva 21.111.111....11........ - Cladamau .1.1...1................ - Stersp 111211111....111.1.111.1 - Polypili ..111..1......111..1.... - Diphcomp .1...111.1...........1.. - Cladphyl ..1.....11...1.......... - Cladrang 344544332133111223121121 - Cladcerv 1.........1..........1.. - Cladstel 454121215555213111111.1. - Cladarbu 322344331111132222121111 - Vacculig 11...2.1........1.1..111 - Callvulg 111.1.311.11.1..11111... - Icmaeric ...1.1.......1...1...... - Cladsp 1...1.11.1......111..11. - Cladcocc 1111111111...1111111.1.1 - Pinusylv 1.111.1111111111111111.1 - Cladchlo .1..111.111.1.11..1.1... - Cetrisla 1.1...1.11.111...1.111.1 - Cladfimb 11.11111111111111111.111 - Peltapht ..1...11.......1.....11. - Cetreric 11.1111111...1..111111.. - Cladgrac 11111111.111111111111111 - Pohlnuta 111..11111.1111111111.11 - Ptilcili .11.1.11.11.2.11.1111111 - Barbhatc ......1.....1.11......1. - Cladcorn 111111111111111111111111 - Vaccviti 113122132323412331223232 - Cladcris 111111111111111111111111 - Empenigr 111111122122312322111231 - Cladbotr ......1.....1.111...1.11 - Betupube ............1.....1..1.. - Cladunci 111111111111131111112111 - Claddefo 11.111111111111111111111 - Dicrpoly ..11.1..11..1.1111.11..1 - Polycomm ............111......11. - Rhodtome ......1.....1.....1...11 - Polyjuni 1.111111111.111111.112.1 - Dicrfusc 11111111111112111442.211 - Pleuschr 113111111111123333444455 - Vaccmyrt ......1..1..311..111..13 - Nepharct .1...1.1........1....1.. - Dicrsp ......1....11...111133.1 - Descflex 1....1......1.1...1..111 - Hylosple ................1....122 -24 sites, 44 species -scale: Hult -> -> ## Abundance values have such a wide range that they must be rescaled -> tabasco(varespec, dca, scale="Braun") -> -> ## Classification trees for species -> data(dune, dune.taxon) -> taxontree <- hclust(taxa2dist(dune.taxon)) -> plotree <- hclust(vegdist(dune), "average") -> ## Automatic reordering of clusters -> tabasco(dune, plotree, sp.ind = taxontree) -> ## No reordering of taxonomy -> tabasco(dune, plotree, sp.ind = taxontree, Colv = FALSE) -> ## Species cluster: most dissimilarity indices do a bad job when -> ## comparing rare and common species, but Raup-Crick makes sense -> sptree <- hclust(vegdist(t(dune), "raup"), "average") -> tabasco(dune, plotree, sptree) -> -> -> -> cleanEx() -> nameEx("wascores") -> ### * wascores -> -> flush(stderr()); flush(stdout()) -> -> ### Name: wascores -> ### Title: Weighted Averages Scores for Species -> ### Aliases: wascores eigengrad -> ### Keywords: multivariate univar -> -> ### ** Examples -> -> data(varespec) -> data(varechem) -> vare.dist <- vegdist(wisconsin(varespec)) -> vare.mds <- monoMDS(vare.dist) -> vare.points <- postMDS(vare.mds$points, vare.dist) -> vare.wa <- wascores(vare.points, varespec) -> plot(scores(vare.points), pch="+", asp=1) -> text(vare.wa, rownames(vare.wa), cex=0.8, col="blue") -> ## Omit rare species (frequency <= 4) -> freq <- apply(varespec>0, 2, sum) -> plot(scores(vare.points), pch="+", asp=1) -> text(vare.wa[freq > 4,], rownames(vare.wa)[freq > 4],cex=0.8,col="blue") -> ## Works for environmental variables, too. -> wascores(varechem, varespec) - N P K Ca Mg S Al -Callvulg 25.12401 41.66188 246.92383 572.3431 99.40828 49.10552 245.15751 -Empenigr 21.61371 44.17350 158.92517 580.8403 89.20628 35.75327 107.05670 -Rhodtome 22.34553 40.35530 162.31108 643.8819 95.07712 30.84303 28.83159 -Vaccmyrt 24.96352 49.80649 189.70177 656.4179 96.75529 34.55190 32.75705 -Vaccviti 21.14028 45.86984 162.12372 613.2126 94.30084 37.26975 116.14656 -Pinusylv 18.37299 44.24818 163.60195 670.9387 93.52214 37.02238 150.45523 -Descflex 22.24089 54.74804 212.20357 771.0159 114.15179 38.00000 24.64143 -Betupube 21.51034 28.86552 112.28276 513.5586 75.15172 23.55172 33.12414 -Vacculig 28.00729 33.48758 114.90230 372.9653 70.89954 29.32378 202.89008 -Diphcomp 22.34228 39.71049 127.44259 446.1565 80.16173 32.32963 122.31574 -Dicrsp 21.33007 60.03758 185.04563 828.0544 148.67509 46.75427 90.42294 -Dicrfusc 23.45681 39.14575 162.91954 578.2309 77.81648 33.48086 60.66890 -Dicrpoly 20.65446 43.87409 150.51485 665.5845 115.22112 36.17079 90.16733 -Hylosple 26.10599 67.88980 245.78681 779.6520 111.96685 42.27433 24.92738 -Pleuschr 22.60476 54.22534 199.96241 712.6278 109.23425 40.01132 70.43900 -Polypili 23.17377 43.75902 144.82623 724.9738 85.42623 30.58525 145.73115 -Polyjuni 22.89480 47.98022 154.81906 643.3864 87.27819 33.63863 53.24888 -Polycomm 21.73521 41.17042 154.91549 631.8704 101.84789 32.17324 46.80986 -Pohlnuta 19.99885 48.59198 169.68855 678.3813 104.31641 39.94427 132.05458 -Ptilcili 21.27880 33.44211 127.08522 564.5652 85.96417 27.11720 56.60692 -Barbhatc 21.17461 27.93323 113.13542 497.9138 77.50564 23.72288 42.09749 -Cladarbu 23.56127 38.04952 142.03073 454.9019 74.00779 33.81002 173.12698 -Cladrang 24.28421 38.60534 135.31177 463.2750 70.54209 32.53349 183.79979 -Cladstel 19.28049 46.71060 158.00576 540.4904 80.19153 40.29106 225.89526 -Cladunci 21.41240 45.49844 163.40402 621.9100 98.35538 40.00734 119.59481 -Cladcocc 21.72473 42.80681 156.32330 557.9007 80.95448 36.25161 149.82616 -Cladcorn 22.11640 47.06656 160.36881 623.5185 95.17781 36.75273 104.71463 -Cladgrac 22.51887 44.06576 156.50214 583.1558 94.10292 36.93930 134.13424 -Cladfimb 21.77980 41.82652 153.29444 512.4646 78.28232 35.62323 128.96061 -Cladcris 20.88795 44.12262 171.04016 574.5672 92.52169 38.24003 116.03507 -Cladchlo 19.51207 45.39655 150.93190 571.0233 95.77586 39.50862 156.81983 -Cladbotr 22.97660 38.89574 167.20000 590.8021 99.57234 34.79362 87.75957 -Cladamau 25.07143 35.84286 105.07857 395.2214 68.18571 27.11429 95.91429 -Cladsp 19.21923 47.37308 168.49231 526.7654 79.54423 45.15385 215.33846 -Cetreric 21.00944 47.76972 165.07972 579.6322 99.14944 42.25472 163.46000 -Cetrisla 18.36552 42.73695 151.78374 626.2813 89.77833 35.33498 132.68227 -Flavniva 18.56110 61.18194 207.67705 502.9203 60.91755 50.22532 396.82405 -Nepharct 23.33099 49.10019 146.84715 618.1601 64.27319 29.95760 31.72300 -Stersp 28.19743 32.84800 94.33459 389.5143 53.25377 24.22175 95.39326 -Peltapht 21.08553 54.45395 193.38816 886.5487 119.35132 37.92500 106.16447 -Icmaeric 28.88636 27.00000 87.86818 307.0500 40.48182 22.17273 89.94091 -Cladcerv 20.25000 56.79000 192.36000 519.2300 62.10000 45.18000 314.92000 -Claddefo 22.19198 45.22981 167.73069 583.7983 92.01320 38.51369 100.46139 -Cladphyl 15.73750 54.56875 180.39375 775.4500 99.65625 43.35000 208.55000 - Fe Mn Zn Mo Baresoil Humdepth pH -Callvulg 75.457843 52.38247 8.281074 0.4734635 27.241036 2.187819 2.845108 -Empenigr 38.146102 53.49357 7.159938 0.3289657 27.324317 2.367439 2.888078 -Rhodtome 5.560906 70.48260 7.444100 0.2251490 37.325030 2.689154 2.895352 -Vaccmyrt 5.589213 75.17221 7.838533 0.2666732 31.404171 2.798935 2.855216 -Vaccviti 37.586067 51.81515 7.617213 0.3680289 26.307701 2.307879 2.923128 -Pinusylv 39.121898 35.22311 7.733333 0.3485401 17.762968 1.996350 3.049148 -Descflex 6.066429 110.87232 9.526607 0.2316071 22.740179 2.834821 2.822857 -Betupube 5.417241 37.53448 5.637931 0.2068966 51.496552 2.527586 2.979310 -Vacculig 93.963929 37.73062 4.593824 0.3780552 21.410710 2.041196 3.006965 -Diphcomp 73.281173 46.88025 4.593827 0.3725309 31.836574 2.103704 2.856790 -Dicrsp 22.504617 65.35020 13.060765 0.5610370 23.182889 2.232247 2.954272 -Dicrfusc 13.922252 61.40958 6.922859 0.3218816 26.918674 2.484399 2.806431 -Dicrpoly 20.973927 33.28779 9.110561 0.3892739 37.304043 2.228713 3.015842 -Hylosple 4.729157 115.14606 9.885976 0.2851996 20.956264 2.925000 2.807594 -Pleuschr 19.113811 77.12277 9.007860 0.3405945 24.584979 2.596881 2.858446 -Polypili 51.993443 36.74754 8.045902 0.2204918 17.368852 1.493443 3.227869 -Polyjuni 12.885704 82.56274 7.945126 0.2760289 28.116303 2.615523 2.874729 -Polycomm 7.895775 68.22535 7.843662 0.2591549 38.687324 2.926761 2.860563 -Pohlnuta 33.089313 42.02290 8.452290 0.3935115 24.709351 2.147328 2.985496 -Ptilcili 14.036188 33.93547 5.906924 0.2303712 48.941884 2.502498 2.973376 -Barbhatc 8.199687 31.11379 5.550784 0.2084639 54.331975 2.514734 2.986834 -Cladarbu 65.470394 38.28429 6.387500 0.4464046 22.592997 2.048540 2.937879 -Cladrang 76.612752 34.86010 6.616452 0.3903501 17.270158 1.799128 3.022346 -Cladstel 84.639467 33.27903 7.287216 0.4054879 9.854042 1.851973 3.052167 -Cladunci 27.463504 40.10322 9.108102 0.5120114 28.312376 2.362687 2.858564 -Cladcocc 46.653763 43.53584 7.269176 0.3698925 19.972222 2.025090 2.974194 -Cladcorn 32.916238 53.38441 7.518489 0.3639871 26.620868 2.399518 2.890997 -Cladgrac 45.758366 44.63911 7.702724 0.4244163 25.546654 2.230350 2.933658 -Cladfimb 41.710354 47.83687 6.815152 0.3887626 24.763889 2.239394 2.902778 -Cladcris 34.729585 44.75984 6.933735 0.3746988 29.711352 2.400000 2.841633 -Cladchlo 42.089655 35.13276 7.908621 0.3814655 22.319655 2.075000 3.022414 -Cladbotr 23.374468 46.54255 7.263830 0.3106383 45.725532 2.580851 2.904255 -Cladamau 68.971429 41.98571 4.928571 0.3214286 27.592857 1.857143 2.914286 -Cladsp 47.913462 49.61923 8.421154 0.6173077 16.864423 2.213462 2.921154 -Cetreric 42.614167 36.96694 9.516389 0.5687500 21.452639 2.058056 2.923889 -Cetrisla 29.617734 33.24138 7.518227 0.3192118 26.417980 2.027586 3.065025 -Flavniva 94.339916 37.03232 9.116371 0.9987764 19.692312 1.799241 2.923629 -Nepharct 12.910837 115.15684 7.743536 0.2180608 23.135932 2.541065 2.918251 -Stersp 30.226998 31.97061 7.635502 0.2828767 15.844007 1.477740 3.038756 -Peltapht 37.598684 56.64079 7.652632 0.2046053 28.321053 2.286842 3.026316 -Icmaeric 24.236364 23.95909 6.618182 0.2863636 18.727273 1.568182 2.968182 -Cladcerv 111.090000 52.04000 8.530000 0.6800000 15.393000 1.870000 2.900000 -Claddefo 25.116325 48.81105 7.599609 0.4096285 33.814545 2.468133 2.823656 -Cladphyl 50.475000 35.28125 8.568750 0.2812500 7.728125 1.575000 3.231250 -> ## And the strengths of these variables are: -> eigengrad(varechem, varespec) - N P K Ca Mg S Al -0.13000842 0.18880078 0.16246365 0.15722067 0.16359171 0.13391967 0.29817406 - Fe Mn Zn Mo Baresoil Humdepth pH -0.20766831 0.27254480 0.16783834 0.09542514 0.20931501 0.25051326 0.14583161 -> -> -> -> cleanEx() -> nameEx("wcmdscale") -> ### * wcmdscale -> -> flush(stderr()); flush(stdout()) -> -> ### Name: wcmdscale -> ### Title: Weighted Classical (Metric) Multidimensional Scaling -> ### Aliases: wcmdscale scores.wcmdscale plot.wcmdscale -> ### Keywords: multivariate -> -> ### ** Examples -> -> ## Correspondence analysis as a weighted principal coordinates -> ## analysis of Euclidean distances of Chi-square transformed data -> data(dune) -> rs <- rowSums(dune)/sum(dune) -> d <- dist(decostand(dune, "chi")) -> ord <- wcmdscale(d, w = rs, eig = TRUE) -> ## Ordinary CA -> ca <- cca(dune) -> -> ## IGNORE_RDIFF_BEGIN -> ## Eigevalues are numerically similar -> ca$CA$eig - ord$eig - CA1 CA2 CA3 CA4 CA5 --6.661338e-16 9.992007e-16 -2.220446e-16 0.000000e+00 5.551115e-17 - CA6 CA7 CA8 CA9 CA10 - 2.775558e-16 -2.775558e-16 -1.110223e-16 2.775558e-17 -2.081668e-17 - CA11 CA12 CA13 CA14 CA15 - 1.110223e-16 3.469447e-17 7.632783e-17 0.000000e+00 -3.642919e-17 - CA16 CA17 CA18 CA19 - 8.673617e-18 2.602085e-17 -3.556183e-17 -2.992398e-17 -> ## Configurations are similar when site scores are scaled by -> ## eigenvalues in CA -> procrustes(ord, ca, choices=1:19, scaling = "sites") - -Call: -procrustes(X = ord, Y = ca, choices = 1:19, scaling = "sites") - -Procrustes sum of squares: --1.421e-14 - -> ## IGNORE_RDIFF_END -> -> plot(procrustes(ord, ca, choices=1:2, scaling="sites")) -> ## Reconstruction of non-Euclidean distances with negative eigenvalues -> d <- vegdist(dune) -> ord <- wcmdscale(d, eig = TRUE) -> ## Only positive eigenvalues: -> cor(d, dist(ord$points)) -[1] 0.9975185 -> ## Correction with negative eigenvalues: -> cor(d, sqrt(dist(ord$points)^2 - dist(ord$negaxes)^2)) -[1] 1 -> -> -> -> ### *