[Dplr-commits] r731 - in pkg/dplR: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 24 09:53:29 CET 2014


Author: mvkorpel
Date: 2014-03-24 09:53:29 +0100 (Mon, 24 Mar 2014)
New Revision: 731

Modified:
   pkg/dplR/ChangeLog
   pkg/dplR/DESCRIPTION
   pkg/dplR/R/rwi.stats.running.R
Log:
rwi.stats() / rwi.stats.running(): fixed 'n' (used in EPS) when
period = "common".  Thanks to Donald Zhao for reporting.


Modified: pkg/dplR/ChangeLog
===================================================================
--- pkg/dplR/ChangeLog	2014-01-19 20:00:33 UTC (rev 730)
+++ pkg/dplR/ChangeLog	2014-03-24 08:53:29 UTC (rev 731)
@@ -43,6 +43,16 @@
   bounds. However, in most cases that would probably not have been a
   problem.
 
+File: rwi.stats.running.R
+-------------------------
+
+- Bug fix: when using period = "common" in rwi.stats() or
+  rwi.stats.running(), the number of trees 'n' used in EPS and shown
+  in the return value is now the total number of trees in the
+  data.frame, taking into account the fact that rows with any
+  missing values are effectively dropped.  Thanks to Donald Zhao for
+  reporting.
+
 * CHANGES IN dplR VERSION 1.5.8
 
 File: tbrm.Rd

Modified: pkg/dplR/DESCRIPTION
===================================================================
--- pkg/dplR/DESCRIPTION	2014-01-19 20:00:33 UTC (rev 730)
+++ pkg/dplR/DESCRIPTION	2014-03-24 08:53:29 UTC (rev 731)
@@ -3,7 +3,7 @@
 Type: Package
 Title: Dendrochronology Program Library in R
 Version: 1.5.9
-Date: 2014-01-19
+Date: 2014-03-24
 Authors at R: c(person("Andy", "Bunn", role = c("aut", "cph",
         "cre", "trl"), email = "andy.bunn at wwu.edu"), person("Mikko",
         "Korpela", role = c("aut", "trl")), person("Franco", "Biondi",

Modified: pkg/dplR/R/rwi.stats.running.R
===================================================================
--- pkg/dplR/R/rwi.stats.running.R	2014-01-19 20:00:33 UTC (rev 730)
+++ pkg/dplR/R/rwi.stats.running.R	2014-03-24 08:53:29 UTC (rev 731)
@@ -170,6 +170,9 @@
         bad.rows <- which(apply(is.na(rwi3), 1, any))
         rwi3[bad.rows, ] <- NA
         good.rows <- setdiff(good.rows, bad.rows)
+        period.common <- TRUE
+    } else {
+        period.common <- FALSE
     }
 
     if (length(good.rows) < min.corr.overlap) {
@@ -291,11 +294,18 @@
             rbar.bt <- rsum.bt / n.bt
         }
 
-        ## Number of trees averaged over the years in the window.
-        ## We keep this number separate of the correlation estimates,
-        ## i.e. the data from some tree / year may contribute to n
-        ## without taking part in the correlation estimates.
-        n <- mean(n.trees.by.year[year.idx], na.rm=TRUE)
+        if (period.common) {
+            ## If period is "common", we are only looking at the rows
+            ## with no missing values.
+            n <- n.trees
+        } else {
+            ## Number of trees averaged over the years in the window.
+            ## We keep this number separate of the correlation
+            ## estimates, i.e. the data from some tree / year may
+            ## contribute to n without taking part in the correlation
+            ## estimates.
+            n <- mean(n.trees.by.year[year.idx], na.rm=TRUE)
+        }
 
         ## Expressed population signal
         if (n.wt == 0) {



More information about the Dplr-commits mailing list