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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 2 16:04:10 CET 2010


Author: jarioksa
Date: 2010-11-02 16:04:10 +0100 (Tue, 02 Nov 2010)
New Revision: 1345

Modified:
   pkg/vegan/R/prc.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/prc.Rd
Log:
prc does not warn against using other than treatment contrasts, but just uses them ignoring user wishes

Modified: pkg/vegan/R/prc.R
===================================================================
--- pkg/vegan/R/prc.R	2010-11-02 14:30:14 UTC (rev 1344)
+++ pkg/vegan/R/prc.R	2010-11-02 15:04:10 UTC (rev 1345)
@@ -1,5 +1,5 @@
 "prc" <-
-    function (response, treatment, time, ...) 
+    function (response, treatment, time, reference, ...) 
 {
     extras <- match.call(expand.dots=FALSE)$...
     if (is.null(extras$data))
@@ -9,6 +9,8 @@
     y <- deparse(substitute(response))
     x <- deparse(substitute(treatment))
     z <- deparse(substitute(time))
+    oldcon <- options(contrasts = c("contr.treatment", "contr.poly"))
+    on.exit(options(oldcon))
     fla <- as.formula(paste("~", x, "+", z))
     mf <- model.frame(fla, data)
     if (!all(sapply(mf, is.factor)))

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-11-02 14:30:14 UTC (rev 1344)
+++ pkg/vegan/inst/ChangeLog	2010-11-02 15:04:10 UTC (rev 1345)
@@ -16,8 +16,9 @@
 	* prc: coefficients folded in a wrong way. Diagnosed, reported and
 	fixed by Cajo ter Braak. CtB also fixed the scaling of species
 	scores and coefficients to be more consistent with Canoco and
-	common standards. Cajo ter Braak is now recognized as a co-author
-	of the function.
+	common standards. The function now ignores user settings of
+	contrasts and will always use treatment contrasts. Cajo ter Braak
+	is now recognized as a co-author of the function.
 
 	* nestednodf: breaks ties in column and row totals by row sums and
 	column sums in quantitative data ('weighted = TRUE'). Version

Modified: pkg/vegan/man/prc.Rd
===================================================================
--- pkg/vegan/man/prc.Rd	2010-11-02 14:30:14 UTC (rev 1344)
+++ pkg/vegan/man/prc.Rd	2010-11-02 15:04:10 UTC (rev 1345)
@@ -66,7 +66,10 @@
   \code{\link{rda}} results in the PRC fashion. The current version only
   works with default contrasts (\code{\link{contr.treatment}}) in which
   the coefficients are contrasts against the first level, and the levels
-  must be arranged so that the first level is the control (or a baseline).
+  must be arranged so that the first level is the control (or a
+  baseline). If necessary, you must change the baseline level with
+  function \code{\link{relevel}}.  
+  
 
   Function \code{summary} prints the species scores and the
   coefficients. Function \code{plot} plots coefficients against
@@ -99,12 +102,11 @@
 \author{ Jari Oksanen and Cajo ter Braak}
 
 \section{Warning }{The first level of \code{treatment} must be the
-  control, and the treatment contrasts must be used (see
-  \code{\link{contr.treatment}}), so that results are expressed as
-  contrasts to the control.  The function works with other contrast
-  types also, but then the user must take care that the resulting
-  coefficients are meaningful the resulting coefficient may be
-  meaningless.  The \code{time} must be an unordered factor.  }
+  control: use function \code{\link{relevel}} to guarantee the correct
+  refence level. The current version will ignore user setting of
+  \code{\link{contrasts}} and always use treatment contrasts
+  (\code{\link{contr.treatment}}). The \code{time} must be an unordered
+  factor.  }
 
 \seealso{\code{\link{rda}}, \code{\link{anova.cca}}.}
 \examples{



More information about the Vegan-commits mailing list