[Vegan-commits] r1766 - in pkg/vegan: R inst man tests/Examples
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Aug 28 10:59:15 CEST 2011
Author: jarioksa
Date: 2011-08-28 10:59:14 +0200 (Sun, 28 Aug 2011)
New Revision: 1766
Modified:
pkg/vegan/R/monoMDS.R
pkg/vegan/R/print.monoMDS.R
pkg/vegan/inst/ChangeLog
pkg/vegan/man/monoMDS.Rd
pkg/vegan/tests/Examples/vegan-Ex.Rout.save
Log:
monoMDS gained arg 'pc' (defaults TRUE)
Modified: pkg/vegan/R/monoMDS.R
===================================================================
--- pkg/vegan/R/monoMDS.R 2011-08-27 06:08:47 UTC (rev 1765)
+++ pkg/vegan/R/monoMDS.R 2011-08-28 08:59:14 UTC (rev 1766)
@@ -2,7 +2,7 @@
function(dist, y, k = 2,
model = c("global", "local", "linear", "hybrid"),
threshold = 0.8, maxit = 200, weakties = TRUE, stress = 1,
- scaling = TRUE, smin = 0.00001, sfgrmin = 0.00001,
+ scaling = TRUE, pc = TRUE, smin = 0.00001, sfgrmin = 0.00001,
sratmax=0.99999, ...)
{
model <- match.arg(model)
@@ -107,6 +107,9 @@
sol$call <- match.call()
sol$model <- model
sol$points <- matrix(sol$points, nobj, k)
+ if (pc)
+ sol$points <- prcomp(sol$points)$x
+ sol$pc <- pc
rownames(sol$points) <- nm
colnames(sol$points) <- paste("MDS", 1:k, sep="")
class(sol) <- "monoMDS"
Modified: pkg/vegan/R/print.monoMDS.R
===================================================================
--- pkg/vegan/R/print.monoMDS.R 2011-08-27 06:08:47 UTC (rev 1765)
+++ pkg/vegan/R/print.monoMDS.R 2011-08-28 08:59:14 UTC (rev 1766)
@@ -13,10 +13,18 @@
cat(paste(modlab, "Multidimensional Scaling\n"))
cat("Dimensions:", x$ndim, "\n")
cat("Stress: ", x$stress, "\n")
- cat("Stress type ", x$isform)
+ cat("Stress type", x$isform)
if (x$model != "linear")
cat(", ", c("weak", "strong")[x$ities], " ties", sep = "")
cat("\n")
+ cat("Scores ")
+ if (x$iscal == 1)
+ cat("scaled to unit root mean square")
+ else
+ cat("unscaled")
+ if (x$pc)
+ cat(", rotated to principal components")
+ cat("\n")
stoplab <- switch(x$icause,
"Maximum number of iteration reached",
"Stress nearly zero",
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2011-08-27 06:08:47 UTC (rev 1765)
+++ pkg/vegan/inst/ChangeLog 2011-08-28 08:59:14 UTC (rev 1766)
@@ -14,8 +14,12 @@
* anosim: warn if some dissimilarities are negative. Function can
handle negative dissimilarities because it is based on ranks, but
- probably this is a user error (but can be intentional and correct).
+ probably this is a user error (but can be intentional and
+ correct).
+ * monoMDS: gained argument 'pc' (defaults TRUE) to rotate the
+ final scores to principal components.
+
* specaccum, fitspecaccum: gained predict() methods. With
specaccum() predict(..., newdata) can estimate values for
'newdata' with linear or spline interpolation if necessary.
Modified: pkg/vegan/man/monoMDS.Rd
===================================================================
--- pkg/vegan/man/monoMDS.Rd 2011-08-27 06:08:47 UTC (rev 1765)
+++ pkg/vegan/man/monoMDS.Rd 2011-08-28 08:59:14 UTC (rev 1766)
@@ -16,7 +16,8 @@
\usage{
monoMDS(dist, y, k = 2, model = c("global", "local", "linear", "hybrid"),
threshold = 0.8, maxit = 200, weakties = TRUE, stress = 1,
- scaling = TRUE, smin = 0.00001, sfgrmin = 0.00001, sratmax=0.99999, ...)
+ scaling = TRUE, pc = TRUE, smin = 0.00001, sfgrmin = 0.00001,
+ sratmax=0.99999, ...)
\method{scores}{monoMDS}(x, ...)
\method{plot}{monoMDS}(x, choices = c(1,2), type = "t", ...)
}
@@ -48,6 +49,8 @@
\item{scaling}{Scale final scores to unit root mean squares.}
+ \item{pc}{Rotate final scores to principal components.}
+
\item{smin, sfgrmin, sratmax}{Convergence criteria: iterations stop
when stress drops below \code{smin}, scale factor of the gradient
drops below \code{sfgrmin}, or stress ratio goes over
Modified: pkg/vegan/tests/Examples/vegan-Ex.Rout.save
===================================================================
--- pkg/vegan/tests/Examples/vegan-Ex.Rout.save 2011-08-27 06:08:47 UTC (rev 1765)
+++ pkg/vegan/tests/Examples/vegan-Ex.Rout.save 2011-08-28 08:59:14 UTC (rev 1766)
@@ -2458,20 +2458,20 @@
***VECTORS
NMDS1 NMDS2 r2 Pr(>r)
-N 0.056188 0.998420 0.2542 0.046 *
-P -0.618628 -0.785684 0.1936 0.103
-K -0.765142 -0.643862 0.1809 0.143
-Ca -0.683985 -0.729496 0.4120 0.008 **
-Mg -0.631457 -0.775411 0.4273 0.004 **
-S -0.190091 -0.981767 0.1754 0.140
-Al 0.872443 -0.488715 0.5270 0.001 ***
-Fe 0.937013 -0.349294 0.4452 0.002 **
-Mn -0.799058 0.601253 0.5228 0.001 ***
-Zn -0.616932 -0.787017 0.1878 0.125
-Mo 0.903112 -0.429406 0.0609 0.539
-Baresoil -0.926090 0.377302 0.2509 0.038 *
-Humdepth -0.933540 0.358473 0.5198 0.002 **
-pH 0.648970 -0.760814 0.2306 0.060 .
+N -0.056188 -0.998420 0.2542 0.046 *
+P 0.618628 0.785684 0.1936 0.103
+K 0.765142 0.643862 0.1809 0.143
+Ca 0.683985 0.729496 0.4120 0.008 **
+Mg 0.631457 0.775411 0.4273 0.004 **
+S 0.190091 0.981767 0.1754 0.140
+Al -0.872443 0.488715 0.5270 0.001 ***
+Fe -0.937013 0.349294 0.4452 0.002 **
+Mn 0.799058 -0.601253 0.5228 0.001 ***
+Zn 0.616932 0.787017 0.1878 0.125
+Mo -0.903112 0.429406 0.0609 0.539
+Baresoil 0.926090 -0.377302 0.2509 0.038 *
+Humdepth 0.933540 -0.358473 0.5198 0.002 **
+pH -0.648970 0.760814 0.2306 0.060 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
P values based on 999 permutations.
@@ -2479,20 +2479,20 @@
> scores(fit, "vectors")
NMDS1 NMDS2
-N 0.02832824 0.5033758
-P -0.27221584 -0.3457258
-K -0.32540799 -0.2738285
-Ca -0.43903747 -0.4682499
-Mg -0.41279593 -0.5069011
-S -0.07961737 -0.4112023
-Al 0.63333130 -0.3547724
-Fe 0.62521305 -0.2330634
-Mn -0.57778128 0.4347530
-Zn -0.26732049 -0.3410194
-Mo 0.22283870 -0.1059540
-Baresoil -0.46384359 0.1889764
-Humdepth -0.67308687 0.2584611
-pH 0.31165145 -0.3653619
+N -0.02832824 -0.5033758
+P 0.27221584 0.3457258
+K 0.32540799 0.2738285
+Ca 0.43903747 0.4682499
+Mg 0.41279593 0.5069011
+S 0.07961737 0.4112023
+Al -0.63333130 0.3547724
+Fe -0.62521305 0.2330634
+Mn 0.57778128 -0.4347530
+Zn 0.26732049 0.3410194
+Mo -0.22283870 0.1059540
+Baresoil 0.46384359 -0.1889764
+Humdepth 0.67308687 -0.2584611
+pH -0.31165145 0.3653619
> plot(ord)
> plot(fit)
> plot(fit, p.max = 0.05, col = "red")
@@ -3425,7 +3425,7 @@
Dimensions: 2
Stress: 0.1192691
-Stress type 1, weak ties
+Stress type 1, weak ties
Two convergent solutions found after 5 tries
Scaling: centring, PC rotation, halfchange scaling
Species: expanded scores based on ‘dune’
@@ -3460,7 +3460,7 @@
Dimensions: 2
Stress: 0.1928489
-Stress type 2, weak ties
+Stress type 2, weak ties
Two convergent solutions found after 1 tries
Scaling: centring, PC rotation, halfchange scaling
Species: expanded scores based on ‘dune’
@@ -3484,7 +3484,7 @@
Dimensions: 2
Stress: 0.106717
-Stress type 1, weak ties
+Stress type 1, weak ties
Two convergent solutions found after 1 tries
Scaling: centring, PC rotation, halfchange scaling
Species: expanded scores based on ‘dune’
@@ -3620,6 +3620,7 @@
Dimensions: 2
Stress: 0.07596768
Stress type 1, weak ties
+Scores scaled to unit root mean square, rotated to principal components
Stopped after 72 iterations: Stress nearly unchanged
> plot(m)
>
@@ -4687,7 +4688,7 @@
Formula:
y ~ s(x1, x2, k = knots)
-<environment: 0x1039d4b48>
+<environment: 0x10399f0d8>
Estimated degrees of freedom:
6.4351 total = 7.435071
@@ -4703,25 +4704,25 @@
Formula:
y ~ s(x1, x2, k = knots)
-<environment: 0x1045cae68>
+<environment: 0x104fecd18>
Estimated degrees of freedom:
-6.0761 total = 7.076141
+6.1039 total = 7.103853
-GCV score: 140.2187
+GCV score: 140.0949
>
> ## Cover of Cladina arbuscula
> fit <- with(varespec, ordisurf(vare.mds, Cla.arb, family=quasipoisson))
> ## Get fitted values
> calibrate(fit)
1 2 3 4 5 6 7
-22.0644704 6.0132156 3.6350565 4.1019775 9.0031309 5.9203047 8.6398803
+22.0644614 6.0132251 3.6350483 4.1019742 9.0030989 5.9202601 8.6399184
8 9 10 11 12 13 14
-11.0718916 0.6562064 35.2281050 10.4346237 7.2900391 5.5710523 24.6503175
+11.0719303 0.6561781 35.2282118 10.4346331 7.2900018 5.5710617 24.6503110
15 16 17 18 19 20 21
-18.8754108 29.7285810 5.6159070 9.5869408 3.2876591 2.7112108 10.7832711
+18.8754521 29.7286543 5.6158934 9.5869716 3.2876267 2.7111721 10.7832857
22 23 24
- 3.0020769 9.8129184 7.3657528
+ 3.0020413 9.8128952 7.3656932
>
> ## Plot method
> plot(fit, what = "contour")
@@ -4859,7 +4860,7 @@
Formula:
y ~ s(x1, x2, k = knots)
-<environment: 0x105f2d9f0>
+<environment: 0x106763ed0>
Estimated degrees of freedom:
8.9275 total = 9.927492
@@ -4872,7 +4873,7 @@
Formula:
y ~ s(x1, x2, k = knots)
-<environment: 0x1065a98e0>
+<environment: 0x1066d1940>
Estimated degrees of freedom:
7.7529 total = 8.75294
@@ -4885,7 +4886,7 @@
Formula:
y ~ s(x1, x2, k = knots)
-<environment: 0x106bbb980>
+<environment: 0x106ba20b0>
Estimated degrees of freedom:
8.8962 total = 9.89616
@@ -5643,13 +5644,13 @@
0.02322413 0.27259237 0.34146895 0.64121655 2.23350654
Rotation matrix:
- [,1] [,2]
-[1,] -0.2427790 -0.9700816
-[2,] 0.9700816 -0.2427790
+ [,1] [,2]
+[1,] 0.9931369 -0.1169579
+[2,] 0.1169579 0.9931369
Translation of averages:
- [,1] [,2]
-[1,] -9.65583e-18 7.915471e-19
+ [,1] [,2]
+[1,] 3.893131e-18 -9.725997e-18
Scaling of target:
[1] 0.6736868
@@ -6942,20 +6943,20 @@
***VECTORS
NMDS1 NMDS2 r2 Pr(>r)
-N 0.056188 0.998420 0.2542 0.046 *
-P -0.618628 -0.785684 0.1936 0.103
-K -0.765142 -0.643862 0.1809 0.143
-Ca -0.683985 -0.729496 0.4120 0.008 **
-Mg -0.631457 -0.775411 0.4273 0.004 **
-S -0.190091 -0.981767 0.1754 0.140
-Al 0.872443 -0.488715 0.5270 0.001 ***
-Fe 0.937013 -0.349294 0.4452 0.002 **
-Mn -0.799058 0.601253 0.5228 0.001 ***
-Zn -0.616932 -0.787017 0.1878 0.125
-Mo 0.903112 -0.429406 0.0609 0.539
-Baresoil -0.926090 0.377302 0.2509 0.038 *
-Humdepth -0.933540 0.358473 0.5198 0.002 **
-pH 0.648970 -0.760814 0.2306 0.060 .
+N -0.056188 -0.998420 0.2542 0.046 *
+P 0.618628 0.785684 0.1936 0.103
+K 0.765142 0.643862 0.1809 0.143
+Ca 0.683985 0.729496 0.4120 0.008 **
+Mg 0.631457 0.775411 0.4273 0.004 **
+S 0.190091 0.981767 0.1754 0.140
+Al -0.872443 0.488715 0.5270 0.001 ***
+Fe -0.937013 0.349294 0.4452 0.002 **
+Mn 0.799058 -0.601253 0.5228 0.001 ***
+Zn 0.616932 0.787017 0.1878 0.125
+Mo -0.903112 0.429406 0.0609 0.539
+Baresoil 0.926090 -0.377302 0.2509 0.038 *
+Humdepth 0.933540 -0.358473 0.5198 0.002 **
+pH -0.648970 0.760814 0.2306 0.060 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
P values based on 999 permutations.
@@ -7108,7 +7109,7 @@
Formula:
y ~ s(x1, x2, k = knots)
-<environment: 0x107af8040>
+<environment: 0x107530ce0>
Estimated degrees of freedom:
2 total = 3
@@ -7573,7 +7574,7 @@
> ### * <FOOTER>
> ###
> cat("Time elapsed: ", proc.time() - get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed: 122.3 1.391 125.699 0 0
+Time elapsed: 103.993 1.147 107.236 0 0
> grDevices::dev.off()
null device
1
More information about the Vegan-commits
mailing list