[Vegan-commits] r2416 - in pkg/vegan: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Feb 6 17:32:12 CET 2013
Author: jarioksa
Date: 2013-02-06 17:32:12 +0100 (Wed, 06 Feb 2013)
New Revision: 2416
Modified:
pkg/vegan/R/predict.cca.R
pkg/vegan/R/predict.rda.R
pkg/vegan/R/simulate.rda.R
pkg/vegan/inst/ChangeLog
pkg/vegan/man/predict.cca.Rd
Log:
revert r2412-3: there should be no pCCA component in predict type='response' or 'working'
Modified: pkg/vegan/R/predict.cca.R
===================================================================
--- pkg/vegan/R/predict.cca.R 2013-02-06 08:18:48 UTC (rev 2415)
+++ pkg/vegan/R/predict.cca.R 2013-02-06 16:32:12 UTC (rev 2416)
@@ -31,16 +31,13 @@
}
if (take > 0)
Xbar <- u %*% slam %*% t(v)
+ if (!is.null(object$pCCA))
+ warning("Conditional ('partial') component ignored")
rc <- outer(rs, cs)
- if (type == "response") {
- if (!is.null(object$pCCA))
- Xbar <- Xbar + object$pCCA$Fit / sqrt(rc)
+ if (type == "response")
out <- (Xbar + 1) * rc * gtot
- } else { # type == "working"
+ else # type == "working"
out <- Xbar * sqrt(rc)
- if (!is.null(object$pCCA))
- out <- out + object$pCCA$Fit
- }
}
else if (type == "lc") {
if (model == "CA")
Modified: pkg/vegan/R/predict.rda.R
===================================================================
--- pkg/vegan/R/predict.rda.R 2013-02-06 08:18:48 UTC (rev 2415)
+++ pkg/vegan/R/predict.rda.R 2013-02-06 16:32:12 UTC (rev 2416)
@@ -25,13 +25,13 @@
w <- u
slam <- diag(sqrt(object[[model]]$eig[1:take] * nr), nrow = take)
if (type %in% c("response", "working")) {
+ if (!is.null(object$pCCA))
+ warning("Conditional ('partial') component ignored")
if (!missing(newdata)) {
u <- predict(object, type = if(model == "CCA") "lc" else "wa",
newdata = newdata, rank = take)
}
if (inherits(object, "capscale")) {
- if (!is.null(object$pCCA))
- warning("Conditional ('partial') component ignored")
if (take > 0) {
out <- u %*% slam/object$adjust
if (type == "response") {
@@ -52,11 +52,7 @@
if (!is.null(scal))
out <- sweep(out, 2, scal, "*")
out <- sweep(out, 2, cent, "+")
- if (!is.null(object$pCCA))
- out <- out + object$pCCA$Fit
} else {
- if (!is.null(object$pCCA))
- out <- out + object$pCCA$Fit
out <- out/sqrt(nrow(out) - 1)
}
}
Modified: pkg/vegan/R/simulate.rda.R
===================================================================
--- pkg/vegan/R/simulate.rda.R 2013-02-06 08:18:48 UTC (rev 2415)
+++ pkg/vegan/R/simulate.rda.R 2013-02-06 16:32:12 UTC (rev 2416)
@@ -30,6 +30,9 @@
## an array of response matrices
ftd <- predict(object, type = "response", rank = rank)
+ ## pRDA: add partial Fit to the constrained
+ if (!is.null(object$pCCA))
+ ftd <- ftd + object$pCCA$Fit
## Generate an array
ans <- array(0, c(dim(ftd), nsim))
for (i in seq_len(nsim)) {
@@ -99,6 +102,9 @@
sq.r <- sqrt(object$rowsum)
## Fitted value
ftd <- predict(object, type = "working", rank = rank)
+ ## pCCA: add partial Fit to the constrained
+ if (!is.null(object$pCCA))
+ ftd <- ftd + object$pCCA$Fit
## Residual Xbar need weighting and back-weighting
Xbar <- sweep(object$CA$Xbar, 1, sq.r, "*")
## Simulation
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2013-02-06 08:18:48 UTC (rev 2415)
+++ pkg/vegan/inst/ChangeLog 2013-02-06 16:32:12 UTC (rev 2416)
@@ -8,13 +8,6 @@
rda, capscale & adonis, and telling how to do this
approximately. Please comment and correct.
- * predict.rda, predict.cca: The partial term is handled in
- predict(..., type = "response") and in predict(..., type =
- "working") for cca() and rda() result objects. The partial term
- was earlier handled only in corresponding simulate.rda(),
- simulate.cca() functions, but it was now moved to these more basic
- functions. The partial capscale() results are still unhandled.
-
* oecosimu: changed the structure of the oecosimu() result
object. It now returns a list of two items: "statistic" is the
observed statistic, and "oecosimu" which contains the simulation
Modified: pkg/vegan/man/predict.cca.Rd
===================================================================
--- pkg/vegan/man/predict.cca.Rd 2013-02-06 08:18:48 UTC (rev 2415)
+++ pkg/vegan/man/predict.cca.Rd 2013-02-06 16:32:12 UTC (rev 2416)
@@ -136,14 +136,13 @@
\code{\link{rda}} and \code{\link{capscale}}. This is often known as
calibration, bioindication or environmental reconstruction.
Basically, the method is similar to projecting site scores onto biplot
- arrows, but it uses regression coefficients. The function can be
- called with \code{newdata} so that cross-validation is possible. The
+ arrows, but it uses regression coefficients. The function can be called
+ with \code{newdata} so that cross-validation is possible. The
\code{newdata} may contain new sites, but species must match in the
- original and new data. The function may not work with
- \sQuote{partial} models with \code{Condition} term, or the partial
- term may be ignored with a warning. The function cannot be used with
- \code{newdata} for \code{\link{capscale}} results. The results may
- only be interpretable for continuous variables.
+ original and new data The function
+ does not work with \sQuote{partial} models with \code{Condition} term,
+ and it cannot be used with \code{newdata} for \code{\link{capscale}}
+ results. The results may only be interpretable for continuous variables.
Function \code{coef} will give the regression coefficients from centred
environmental variables (constraints and conditions) to linear
More information about the Vegan-commits
mailing list