[Vegan-commits] r561 - devel/lmodel2/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 12 11:09:29 CET 2008


Author: jarioksa
Date: 2008-11-12 11:09:29 +0100 (Wed, 12 Nov 2008)
New Revision: 561

Modified:
   devel/lmodel2/R/lmodel2.R
Log:
lmodel2: fixed permutations

Modified: devel/lmodel2/R/lmodel2.R
===================================================================
--- devel/lmodel2/R/lmodel2.R	2008-11-12 07:49:18 UTC (rev 560)
+++ devel/lmodel2/R/lmodel2.R	2008-11-12 10:09:29 UTC (rev 561)
@@ -512,7 +512,7 @@
     ## Permutation test begins
     n <- length(y)
     for(i in 1:nperm) {
-        y.per <- permuted.index2(n, control = control)
+        y.per <- y[permuted.index2(n, control = control)]
         ## OLS regression
         temp <- lm(y.per ~ x)                # lm {stats}  Fitting linear model
         b.ols.per <- summary(temp)$coefficients[2,1]
@@ -542,7 +542,7 @@
 
         ## RMA regression
         if(RMA) {
-            y.2.per <- sample(y.2)
+            y.2.per <- y.2[permuted.index2(n, control = control)]
             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