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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Feb 9 17:30:29 CET 2010


Author: jarioksa
Date: 2010-02-09 17:30:29 +0100 (Tue, 09 Feb 2010)
New Revision: 1120

Modified:
   pkg/vegan/R/simulate.rda.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/simulate.rda.Rd
Log:
simulate.rda/cca gained argument 'rank' passed to predict.rda/cca

Modified: pkg/vegan/R/simulate.rda.R
===================================================================
--- pkg/vegan/R/simulate.rda.R	2010-02-09 16:19:39 UTC (rev 1119)
+++ pkg/vegan/R/simulate.rda.R	2010-02-09 16:30:29 UTC (rev 1120)
@@ -1,5 +1,5 @@
 `simulate.rda` <-
-    function(object, nsim = 1, seed = NULL, indx = NULL, ...) 
+    function(object, nsim = 1, seed = NULL, indx = NULL, rank = "full", ...) 
 {
     ## Handle RNG: code directly from stats::simulate.lm
     if (!exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE)) 
@@ -16,7 +16,7 @@
     ## response matrix.
     if (nsim > 1)
         .NotYetUsed("nsim")
-    ftd <- fitted(object)
+    ftd <- predict(object, type = "response", rank = rank)
     ## pRDA: add partial Fit to the constrained
     if (!is.null(object$pCCA))
         ftd <- ftd + object$pCCA$Fit
@@ -39,7 +39,7 @@
 ### still guarantee that all marginal totals are positive.
 
 `simulate.cca` <-
-    function(object, nsim = 1, seed = NULL, indx = NULL, ...)
+    function(object, nsim = 1, seed = NULL, indx = NULL, rank = "full", ...)
 {
     ## Handle RNG: code directly from stats::simulate.lm
     if (!exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE)) 
@@ -59,7 +59,7 @@
     ## Need sqrt of rowsums for weighting
     sq.r <- sqrt(object$rowsum)
     ## Fitted value
-    ftd <- fitted(object, type = "working")
+    ftd <- predict(object, type = "working", rank = rank)
     ## pCCA: add partial Fit to the constrained
     if (!is.null(object$pCCA))
         ftd <- ftd + object$pCCA$Fit

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-02-09 16:19:39 UTC (rev 1119)
+++ pkg/vegan/inst/ChangeLog	2010-02-09 16:30:29 UTC (rev 1120)
@@ -9,6 +9,10 @@
 	predict.prcomp/princomp. Gained choice type = "working" for
 	working residuals (as fitted.cca/rda). 
 
+	* simulate.rda, simulate.cca: gained argument rank passed to
+	predict.rda() or predict.rda(). This also allows simulation under
+	null model by setting rank = 0.
+
 Version 1.18-0 (closeed January 11, 2010 with release 1.17-0)
 
 	* Documented na.action in cca.object.

Modified: pkg/vegan/man/simulate.rda.Rd
===================================================================
--- pkg/vegan/man/simulate.rda.Rd	2010-02-09 16:19:39 UTC (rev 1119)
+++ pkg/vegan/man/simulate.rda.Rd	2010-02-09 16:30:29 UTC (rev 1120)
@@ -11,7 +11,7 @@
 }
 
 \usage{
-\method{simulate}{rda}(object, nsim = 1, seed = NULL, indx = NULL, ...)
+\method{simulate}{rda}(object, nsim = 1, seed = NULL, indx = NULL, rank = "full", ...)
 }
 \arguments{
   \item{object}{an object representing a fitted \code{\link{rda}} model.}
@@ -26,6 +26,8 @@
     have duplicate entries so that bootstrapping is allowed. If null,
     parametric simulation is used and Gaussian error is added to the
     fitted values.}
+  \item{rank}{The rank of the constrained component: passed to
+    \code{\link{predict.rda}} or \code{\link{predict.cca}}. }
   \item{\dots}{additional optional arguments (ignored). }
 }
 



More information about the Vegan-commits mailing list