[Vegan-commits] r1381 - in pkg/vegan: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Dec 1 11:28:05 CET 2010
Author: jarioksa
Date: 2010-12-01 11:28:04 +0100 (Wed, 01 Dec 2010)
New Revision: 1381
Modified:
pkg/vegan/R/fitted.procrustes.R
pkg/vegan/inst/ChangeLog
pkg/vegan/man/procrustes.Rd
Log:
predict.procrustes can do truemean = FALSE
Modified: pkg/vegan/R/fitted.procrustes.R
===================================================================
--- pkg/vegan/R/fitted.procrustes.R 2010-11-23 15:58:39 UTC (rev 1380)
+++ pkg/vegan/R/fitted.procrustes.R 2010-12-01 10:28:04 UTC (rev 1381)
@@ -10,15 +10,18 @@
## Like above, except when takes 'newata'
`predict.procrustes` <-
- function(object, newdata, ...)
+ function(object, newdata, truemean = TRUE, ...)
{
if (missing(newdata))
- return(fitted(object, truemean = TRUE))
+ return(fitted(object, truemean = truemean))
if (object$symmetric)
stop(gettextf("'predict' not available for symmetric procrustes analysis with 'newdata'"))
Y <- as.matrix(newdata)
## scaling and rotation
Y <- object$scale * Y %*% object$rotation
## translation: always
- sweep(Y, 2, object$translation, "+")
+ Y <- sweep(Y, 2, object$translation, "+")
+ if (!truemean)
+ Y <- sweep(Y, 2, object$xmean*object$scale, "-")
+ Y
}
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2010-11-23 15:58:39 UTC (rev 1380)
+++ pkg/vegan/inst/ChangeLog 2010-12-01 10:28:04 UTC (rev 1381)
@@ -4,6 +4,9 @@
Version 1.18-17 (opened November 17, 2010)
+ * predict.procrustes: gained 'truemean' so that new points can be
+ added to the plot.procrustes() graph.
+
* alpha release version: preparing release (1.17-5) of
vegan. Mainly clean up and checking of functions intended for the
release.
Modified: pkg/vegan/man/procrustes.Rd
===================================================================
--- pkg/vegan/man/procrustes.Rd 2010-11-23 15:58:39 UTC (rev 1380)
+++ pkg/vegan/man/procrustes.Rd 2010-12-01 10:28:04 UTC (rev 1381)
@@ -29,7 +29,7 @@
\method{lines}{procrustes}(x, type = c("segments", "arrows"), choices = c(1, 2), ...)
\method{residuals}{procrustes}(object, ...)
\method{fitted}{procrustes}(object, truemean = TRUE, ...)
-\method{predict}{procrustes}(object, newdata, ...)
+\method{predict}{procrustes}(object, newdata, truemean = TRUE, ...)
protest(X, Y, scores = "sites", permutations = 999, strata, ...)
}
@@ -57,7 +57,8 @@
\item{type}{Combine \code{target} and \code{rotated} points with line
segments or arrows.}
\item{truemean}{Use the original range of target matrix instead of
- centring the fitted values.}
+ centring the fitted values. Function \code{plot.procrustes} needs
+ \code{truemean = FALSE}.}
\item{newdata}{Matrix of coordinates to be rotated and translated to
the target.}
\item{permutations}{Number of permutation to assess the significance
More information about the Vegan-commits
mailing list