[Dplr-commits] r820 - in pkg/dplR: . R man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 17 18:13:54 CEST 2014


Author: andybunn
Date: 2014-04-17 18:13:54 +0200 (Thu, 17 Apr 2014)
New Revision: 820

Modified:
   pkg/dplR/ChangeLog
   pkg/dplR/R/ccf.series.rwl.R
   pkg/dplR/man/ccf.series.rwl.Rd
   pkg/dplR/vignettes/xdate-dplR.Rnw
Log:
* Swtiched the order of the arguments x and y in to ccf() in ccf.series.rwl. This now makes more sense to the user.

Modified: pkg/dplR/ChangeLog
===================================================================
--- pkg/dplR/ChangeLog	2014-04-16 14:41:14 UTC (rev 819)
+++ pkg/dplR/ChangeLog	2014-04-17 16:13:54 UTC (rev 820)
@@ -13,6 +13,13 @@
 - Added summary.rwl as an S3Method.
 - Added insert and delete.ring functions.
 
+File: ccf.series.rwl.R
+---------------
+
+- Switched the order of x and y in the call to ccf(). This makes a great deal
+  more logical sense now as a missing ring shows up with a positive lag rather
+  than a negative lag.
+
 File: ffcsaps.R
 ---------------
 

Modified: pkg/dplR/R/ccf.series.rwl.R
===================================================================
--- pkg/dplR/R/ccf.series.rwl.R	2014-04-16 14:41:14 UTC (rev 819)
+++ pkg/dplR/R/ccf.series.rwl.R	2014-04-17 16:13:54 UTC (rev 820)
@@ -76,7 +76,8 @@
             bin.ccf <- NA
         }
         else {
-            tmp <- ccf(master[mask], series2[mask], lag.max=lag.max, plot=FALSE)
+            tmp <- ccf(series2[mask], master[mask], lag.max=lag.max, 
+                       plot=FALSE)
             bin.ccf <- as.vector(tmp$acf)
         }
         res.cor[, j] <- bin.ccf

Modified: pkg/dplR/man/ccf.series.rwl.Rd
===================================================================
--- pkg/dplR/man/ccf.series.rwl.Rd	2014-04-16 14:41:14 UTC (rev 819)
+++ pkg/dplR/man/ccf.series.rwl.Rd	2014-04-17 16:13:54 UTC (rev 820)
@@ -49,8 +49,16 @@
   \code{\link{ccf}} at overlapping segments set by
   \code{\var{seg.length}}. For instance, with \code{\var{lag.max}} set
   to 5, cross-correlations would be calculated at for each segment with
-  the master lagged at \code{\var{k} = -5:5} years.  The function is
-  typically invoked to produce a plot.
+  the master lagged at \code{\var{k} = -5:5} years.  
+  
+  The cross correlations are calculated calling
+  \code{\link{ccf}} as 
+  \code{ccf(x=series, y=master, lag.max=lag.max, plot=FALSE)}. Note that
+  prior to dplR version 1.60, the \code{master} was set as \code{x} and 
+  the \code{series} as \code{y}. This was changed to be more in line with 
+  user expectations so that a missing ring in a series produces a positive
+  lag in the plot rather than a negative lag. This structure of this call
+  does put the plots at odds with Figure 3 in Bunn (2010) which is unfortunate.
 
   Correlations are calculated for the first segment, then the
   second segment and so on. Correlations are only calculated for segments with
@@ -83,6 +91,9 @@
 \seealso{ \code{\link{corr.rwl.seg}}, \code{\link{corr.series.seg}},
   \code{\link{skel.plot}}, \code{\link{series.rwl.plot}}
 }
+\references{ Bunn AG (2010). Statistical and visual crossdating 
+  in R using the dplR library. Dendrochronologia, 28(4): 251-258.
+}
 \examples{
 data(co021)
 dat <- co021

Modified: pkg/dplR/vignettes/xdate-dplR.Rnw
===================================================================
--- pkg/dplR/vignettes/xdate-dplR.Rnw	2014-04-16 14:41:14 UTC (rev 819)
+++ pkg/dplR/vignettes/xdate-dplR.Rnw	2014-04-17 16:13:54 UTC (rev 820)
@@ -196,14 +196,26 @@
 \caption{Cross-correlations between the flagged series and the master 
 chronology are shown for each segment (30-year segments lagged by 15 years). 
 The series correlates well at lag 0 until the 1865-1894 bin and then at 
-lag -1 prior to 1865.}
+lag +1 prior to 1865.}
 \label{fig:ccf.plot}
 \end{figure}
 \newpage
 
 Figure~\ref{fig:ccf.plot} shows that 1865 to 1894 is the misdated part of 
-this series. Using a smaller time window and shorter correlation segments we
-can try to further isolate the switch from correlation at lag 0 to lag -1.
+this series. The lag of +1 over a lag of 0 indicates that the series
+\code{flagged} is missing a ring as it better correlates to the master 
+chronology with a one-year offset. \footnote{As of dplR version 1.60,
+the cross correlations in \code{ccf.series.rwl} are calculated calling
+as \code{ccf(x=series, y=master, lag.max=lag.max, plot=FALSE)}. Note that
+prior to dplR version 1.60, the \code{master} was set as \code{x} and 
+the \code{series} as \code{y}. This was changed to be more in line with 
+user expectations so that a missing ring in a series produces a positive
+lag in the plot rather than a negative lag. This structure of this call
+does put the plots at odds with Figure 3 in \cite{Bunn2010} which is 
+unfortunate.}
+
+Using a smaller time window and shorter correlation segments we
+can try to further isolate the switch from correlation at lag 0 to lag +1.
 We'll, of course, have to be very careful about using such short segments
 for correlation and be ready to adjust our expectations accordingly. 
 Fortunately, in this case the trees are so exquisitely sensitive that we can
@@ -227,7 +239,7 @@
 \end{figure}
 
 By 1879 the correlation between \code{flagged} and the master is solidly at 
-lag -1 (Figure~\ref{fig:ccf.plot2}). The 1870 to 1889 correlation is marginal 
+lag +1 (Figure~\ref{fig:ccf.plot2}). The 1870 to 1889 correlation is marginal 
 while the dating at 1880-1899 seems accurate (lag 0). This suggests that 
 the dating error is between 1879 and 1889. At this point the analyst would
 go to the wood and take a good look at the core and see what they could



More information about the Dplr-commits mailing list