[Dplr-commits] r692 - branches/redfit/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 17 18:30:12 CEST 2013


Author: mvkorpel
Date: 2013-09-17 18:30:12 +0200 (Tue, 17 Sep 2013)
New Revision: 692

Modified:
   branches/redfit/R/redfit.R
Log:
Fixed sign comparison of runs test to match that of the original Fortran REDFIT
(and literature).


Modified: branches/redfit/R/redfit.R
===================================================================
--- branches/redfit/R/redfit.R	2013-09-16 09:53:52 UTC (rev 691)
+++ branches/redfit/R/redfit.R	2013-09-17 16:30:12 UTC (rev 692)
@@ -324,7 +324,9 @@
     ## equations for calculating critical values for 5-% significance
     ## were derived from the tabulated critical values in B&P.
     if (iwin2 == 0 && ofac == 1 && dn50 == 1) {
-        rcnt <- 1 + sum(diff(sign(gxxc - gredth)) != 0)
+        spectrcomp <- rep.int(0, nfreq)
+        spectrcomp[gxxc - gredth >= 0] <- 1
+        rcnt <- 1 + sum(diff(spectrcomp) != 0)
         ## dplR: NOTE! Integer division is used in REDFIT.  This should be
         ## checked (by finding a copy of Bendat and Piersol).  For now, we
         ## can assume that real(nout/2) was supposed to be real(nout)/2.



More information about the Dplr-commits mailing list