[Vegan-commits] r574 - in pkg/lmodel2: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 19 18:11:05 CET 2008


Author: jarioksa
Date: 2008-11-19 18:11:04 +0100 (Wed, 19 Nov 2008)
New Revision: 574

Modified:
   pkg/lmodel2/DESCRIPTION
   pkg/lmodel2/R/lmodel2.R
   pkg/lmodel2/man/lmodel2.Rd
Log:
freeing lmodel2 from vegan dependence: permutation uses simple sample() instead of permuted.index2

Modified: pkg/lmodel2/DESCRIPTION
===================================================================
--- pkg/lmodel2/DESCRIPTION	2008-11-19 03:28:04 UTC (rev 573)
+++ pkg/lmodel2/DESCRIPTION	2008-11-19 17:11:04 UTC (rev 574)
@@ -1,8 +1,8 @@
 Package: lmodel2
 Type: Package
 Title: Model II Regression
-Version: 1.6
-Date: 2008-11-12
+Version: 1.6-1
+Date: 2008-11-19
 Author: Pierre Legendre
 Maintainer: Jari Oksanen <jari.oksanen at oulu.fi>
 Depends: vegan

Modified: pkg/lmodel2/R/lmodel2.R
===================================================================
--- pkg/lmodel2/R/lmodel2.R	2008-11-19 03:28:04 UTC (rev 573)
+++ pkg/lmodel2/R/lmodel2.R	2008-11-19 17:11:04 UTC (rev 574)
@@ -1,6 +1,6 @@
 `lmodel2` <-
 function(formula, data = NULL, range.y = NULL, range.x = NULL,
-             nperm = 0, control = permControl(nperm = nperm))
+             nperm = 0)
 ###
 ### Bivariate model II regression.
 ### Regression methods: OLS, MA, SMA, RMA
@@ -200,7 +200,7 @@
     if((nperm > 0) & (rsquare > epsilon)) {
         require(vegan) || stop("requires package 'vegan'")
         res8 <- permutest.lmodel2(yx, yx.2, b.ols, b.ma, b.rma/ratio,
-                          RMA, ratio, nperm, epsilon, control = control)
+                          RMA, ratio, nperm, epsilon)
     }
     
     ## Output results
@@ -468,9 +468,10 @@
     CL <- c(b0inf, b0sup, b1inf, b1sup)
 }
 
+## vegan defines generic permutest, but if we don't depend on vegan we
+## need to use another name
 `permutest.lmodel2` <-
-    function(x, yx.2, b.ols, b.ma, b.rma, RMA, ratio, nperm, epsilon,
-             control, ...)
+    function(x, yx.2, b.ols, b.ma, b.rma, RMA, ratio, nperm, epsilon, ...)
 
 ### One-tailed permutation tests of OLS, MA, and RMA regression slopes.
 ### The SMA slope cannot be tested for significance.
@@ -512,7 +513,8 @@
     ## Permutation test begins
     n <- length(y)
     for(i in 1:nperm) {
-        y.per <- y[permuted.index2(n, control = control)]
+        ## Permutation, could use permuted.index2
+        y.per <- y[sample(n)]
         ## OLS regression
         temp <- lm(y.per ~ x)                # lm {stats}  Fitting linear model
         b.ols.per <- summary(temp)$coefficients[2,1]
@@ -542,7 +544,8 @@
 
         ## RMA regression
         if(RMA) {
-            y.2.per <- y.2[permuted.index2(n, control = control)]
+            ## Permutation: could use permuted.index2
+            y.2.per <- y.2[sample(n)]
             r.per <- cor(y.2.per,x.2)
             rsq.per <- r.per^2
             temp.ranged <- lm(y.2.per ~ x.2)  # lm {stats}  Fitting linear model

Modified: pkg/lmodel2/man/lmodel2.Rd
===================================================================
--- pkg/lmodel2/man/lmodel2.Rd	2008-11-19 03:28:04 UTC (rev 573)
+++ pkg/lmodel2/man/lmodel2.Rd	2008-11-19 17:11:04 UTC (rev 574)
@@ -19,8 +19,7 @@
 variable. }
 
 \usage{
-lmodel2(formula, data = NULL, range.y=NULL, range.x=NULL, nperm=0,
-   control = permControl(nperm=nperm))
+lmodel2(formula, data = NULL, range.y=NULL, range.x=NULL, nperm=0)
 }
 
 \arguments{
@@ -39,8 +38,6 @@
   variable)  }
   \item{nperm}{ Number of permutations for the tests. If \code{nperm =
    0}, tests will not be computed. } 
-   \item{control}{Permutation control item for
-  \code{\link[vegan]{permuted.index2}}.} 
 } 
 
 \details{



More information about the Vegan-commits mailing list