[Vegan-commits] r579 - pkg/lmodel2/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 20 16:26:43 CET 2008


Author: jarioksa
Date: 2008-11-20 16:26:43 +0100 (Thu, 20 Nov 2008)
New Revision: 579

Modified:
   pkg/lmodel2/R/lmodel2.R
Log:
lmodel2: same permutation used for testing RMA and other methods

Modified: pkg/lmodel2/R/lmodel2.R
===================================================================
--- pkg/lmodel2/R/lmodel2.R	2008-11-20 13:50:12 UTC (rev 578)
+++ pkg/lmodel2/R/lmodel2.R	2008-11-20 15:26:43 UTC (rev 579)
@@ -517,7 +517,8 @@
     n <- length(y)
     for(i in 1:nperm) {
         ## Permutation, could use permuted.index2
-        y.per <- y[sample(n)]
+        idx <- sample(n)
+        y.per <- y[idx]
         ## OLS regression
         temp <- lm(y.per ~ x)                # lm {stats}  Fitting linear model
         b.ols.per <- summary(temp)$coefficients[2,1]
@@ -548,7 +549,7 @@
         ## RMA regression
         if(RMA) {
             ## Permutation: could use permuted.index2
-            y.2.per <- y.2[sample(n)]
+            y.2.per <- y.2[idx]
             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



More information about the Vegan-commits mailing list