[Vegan-commits] r2418 - in pkg/vegan: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 6 18:32:03 CET 2013


Author: jarioksa
Date: 2013-02-06 18:32:02 +0100 (Wed, 06 Feb 2013)
New Revision: 2418

Modified:
   pkg/vegan/R/fitted.capscale.R
   pkg/vegan/R/fitted.cca.R
   pkg/vegan/R/fitted.rda.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/predict.cca.Rd
Log:
fitted.rda,cca,capscale can return the pCCA component

Modified: pkg/vegan/R/fitted.capscale.R
===================================================================
--- pkg/vegan/R/fitted.capscale.R	2013-02-06 17:01:02 UTC (rev 2417)
+++ pkg/vegan/R/fitted.capscale.R	2013-02-06 17:32:02 UTC (rev 2418)
@@ -1,5 +1,5 @@
-fitted.capscale <-
-    function(object, model = c("CCA", "CA", "Imaginary"),
+`fitted.capscale` <-
+    function(object, model = c("CCA", "CA", "pCCA", "Imaginary"),
              type = c("response", "working"), ...)
 {
     model <- match.arg(model)
@@ -8,7 +8,8 @@
     U <- switch(model,
                 CCA = object$CCA$u.eig,
                 CA = object$CA$u.eig,
-                Imaginary = object$CA$imaginary.u.eig)
+                Imaginary = object$CA$imaginary.u.eig,
+                pCCA = object$pCCA$Fit/object$adjust)
     ## Distances or working scores U
     if (type == "response") {
         U <- dist(U)

Modified: pkg/vegan/R/fitted.cca.R
===================================================================
--- pkg/vegan/R/fitted.cca.R	2013-02-06 17:01:02 UTC (rev 2417)
+++ pkg/vegan/R/fitted.cca.R	2013-02-06 17:32:02 UTC (rev 2418)
@@ -1,11 +1,15 @@
-"fitted.cca" <-
-function (object, model = c("CCA","CA"), type = c("response", "working"), ...) 
+`fitted.cca` <-
+    function (object, model = c("CCA","CA","pCCA"), type = c("response", "working"),
+              ...) 
 {
     type <- match.arg(type)
     model <- match.arg(model)
     gtot <- object$grand.total
     rc <- object$rowsum %o% object$colsum
-    Xbar <- object[[model]]$Xbar
+    if (model == "pCCA")
+        Xbar <- object$pCCA$Fit
+    else
+        Xbar <- object[[model]]$Xbar
     if (model == "CCA")
         Xbar <- qr.fitted(object$CCA$QR, Xbar)
     if (type == "response")

Modified: pkg/vegan/R/fitted.rda.R
===================================================================
--- pkg/vegan/R/fitted.rda.R	2013-02-06 17:01:02 UTC (rev 2417)
+++ pkg/vegan/R/fitted.rda.R	2013-02-06 17:32:02 UTC (rev 2418)
@@ -1,9 +1,12 @@
-"fitted.rda" <-
-    function (object, model = c("CCA", "CA"), type = c("response", "working"), ...) 
+`fitted.rda` <-
+    function (object, model = c("CCA", "CA", "pCCA"), type = c("response", "working"), ...) 
 {
     type <- match.arg(type)
     model <- match.arg(model)
-    Xbar <- object[[model]]$Xbar
+    if (model == "pCCA")
+        Xbar <- object$pCCA$Fit
+    else
+        Xbar <- object[[model]]$Xbar
     if (model == "CCA") 
         Xbar <- qr.fitted(object$CCA$QR, Xbar)
     if (type == "response") {

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2013-02-06 17:01:02 UTC (rev 2417)
+++ pkg/vegan/inst/ChangeLog	2013-02-06 17:32:02 UTC (rev 2418)
@@ -28,6 +28,9 @@
 	that there is a policy decision, and an alternative policy can be
 	tracked in the repository.
 
+	* fitted.[cca,rda,capscale]: can now return partial component with
+	argument 'model = "pCCA"'.
+
 	* simulate: the simulate functions for "rda" and "cca" return
 	objects with original row and column names. Function capscale()
 	already did so, and simulate.nullmodel() was changed so in vegan

Modified: pkg/vegan/man/predict.cca.Rd
===================================================================
--- pkg/vegan/man/predict.cca.Rd	2013-02-06 17:01:02 UTC (rev 2417)
+++ pkg/vegan/man/predict.cca.Rd	2013-02-06 17:32:02 UTC (rev 2418)
@@ -21,9 +21,9 @@
   response data. 
 }
 \usage{
-\method{fitted}{cca}(object, model = c("CCA", "CA"),
+\method{fitted}{cca}(object, model = c("CCA", "CA", "pCCA"),
     type =  c("response", "working"), ...)
-\method{fitted}{capscale}(object, model = c("CCA", "CA", "Imaginary"),
+\method{fitted}{capscale}(object, model = c("CCA", "CA", "pCCA", "Imaginary"),
     type = c("response", "working"), ...)
 \method{residuals}{cca}(object, ...)
 \method{predict}{cca}(object, newdata, type = c("response", "wa", "sp", "lc", "working"),
@@ -37,10 +37,11 @@
 \arguments{
   \item{object}{A result object from \code{\link{cca}},
     \code{\link{rda}}, \code{\link{capscale}} or \code{\link{decorana}}. }
-  \item{model}{Show constrained (\code{"CCA"}) or unconstrained
-    (\code{"CA"}) results. For \code{fitted} method of
-    \code{\link{capscale}} this can also be \code{"Imaginary"} for
-    imaginary components with negative eigenvalues. }
+  \item{model}{Show constrained (\code{"CCA"}), unconstrained
+    (\code{"CA"}) or conditioned \dQuote{partial} (\code{"pCCA"})
+    results. For \code{fitted} method of \code{\link{capscale}} this
+    can also be \code{"Imaginary"} for imaginary components with
+    negative eigenvalues. }
   \item{newdata}{New data frame to be used in prediction or in
     calibration.  Usually this a new community data frame, but with
     \code{type = "lc"} and for constrained component with \code{type =



More information about the Vegan-commits mailing list