[Dplr-commits] r761 - in pkg/dplR: . man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 3 21:33:23 CEST 2014


Author: andybunn
Date: 2014-04-03 21:33:23 +0200 (Thu, 03 Apr 2014)
New Revision: 761

Modified:
   pkg/dplR/TODO
   pkg/dplR/man/series.rho.Rd
Log:
Trying the new TODO file (via RStudio and not Emacs however - tell me if it works Mikko). Improved the help file for series.rho().


Modified: pkg/dplR/TODO
===================================================================
--- pkg/dplR/TODO	2014-04-02 13:45:06 UTC (rev 760)
+++ pkg/dplR/TODO	2014-04-03 19:33:23 UTC (rev 761)
@@ -1,4 +1,15 @@
+* Decide when to use class('rwl') in functions dealing with rwl objects.
+  Other than the plot S3Method for rwl, are there cases when having that class
+  would be useful. E.g., in error checking?
 
+* Add 'prewhiten' as a detrending method.
+  It would be nice to have a prewhitening option to detrend.series
+  (and therefore dentrend) that returns white noise 
+  This could be as easy as:
+    y <- detrend.series(x, method="Mean")
+    y <- ar.func(y)
+    return(y)
+
 * Dummy item
    This is a sample item.
 

Modified: pkg/dplR/man/series.rho.Rd
===================================================================
--- pkg/dplR/man/series.rho.Rd	2014-04-02 13:45:06 UTC (rev 760)
+++ pkg/dplR/man/series.rho.Rd	2014-04-03 19:33:23 UTC (rev 761)
@@ -8,37 +8,56 @@
   series.rho(rwl,n=NULL,prewhiten=TRUE,biweight=TRUE)
 }
 \arguments{
-  \item{rwl}{ an \code{rwl} object (or similar \code{data.frame}) }
-  \item{n}{ an \code{rwl} object (or similar \code{data.frame}) }
-  \item{prewhiten}{ an \code{rwl} object (or similar \code{data.frame}) }
-  \item{biweight}{ an \code{rwl} object (or similar \code{data.frame}) }
+  \item{rwl}{ a \code{data.frame} with series as columns and years as
+    rows such as that produced by \code{\link{read.rwl}}. }
+  \item{n}{ \code{NULL} or an integral value giving the filter length
+    for the \code{\link{hanning}} filter used for removal of low
+    frequency variation. }
+  \item{prewhiten}{ \code{logical} flag.  If \code{TRUE} each series is
+    whitened using \code{\link{ar}}. }
+  \item{biweight}{ \code{logical} flag.  If \code{TRUE} then a robust
+    mean is calculated using \code{\link{tbrm}}. }
 }
 \details{
-  This calculates the Spearman's correlation on each series in a rwl object
-  against a master chronology built using every other series in that object.
-  Before the correlation is calculated every series is optionally detrended
-  with a hanning filter and/or the residuals from an ar model. This function
-  produces the same output of the "overall" portion of 
-  \code{\link{corr.rwl.seg}}. This function is called by 
-  \code{\link{rwl.stats}}. The mean rho value given is sometimes referred to as
+  This function calculates correlation serially between each tree-ring
+  series and a master chronology built from all the other series in the
+  \code{\var{rwl}} object (leave-one-out principle).
+
+  Each series in the rwl object is optionally
+  detrended as the residuals from a \code{\link{hanning}} filter with
+  weight \code{\var{n}}.  The filter is not applied if \code{\var{n}} is
+  \code{NULL}.  Detrending can also be done via prewhitening where the
+  residuals of an \code{\link{ar}} model are added to each series
+  mean.  This is the default.  The master chronology is computed as the
+  mean of the \code{\var{rwl}} object using \code{\link{tbrm}} if
+  \code{\var{biweight}} is \code{TRUE} and \code{rowMeans} if not.  Note
+  that detrending can change the length of the series.  E.g., a
+  \code{\link{hanning}} filter will shorten the series on either end by
+  \code{floor(\var{n}/2)}.  The prewhitening default will change the
+  series length based on the \code{\link{ar}} model fit.  The effects of
+  detrending can be seen with \code{\link{series.rwl.plot}}.
+
+  This function produces the same output of the "overall" portion of 
+  \code{\link{corr.rwl.seg}}. The mean rho value given is sometimes referred to as
   the "overall interseries correlation"" or the "COFECHA interseries 
-  correlation." This output differs from the rbar statistic given by
-  \code{\link{rwi.stats}} in that rbar is the average correaltion of each series
-  compared to each series where this is the correlation between a series and a
-  master chronology.
+  correlation." This output differs from the \code{rbar} statistics given by
+  \code{\link{rwi.stats}} in that \code{rbar} is the average pairwise correlation between 
+  series where this is the correlation between a series and a master chronology.
 }
 \value{ a \code{data.frame} with rho values and p-values given from
 \code{\link{cor.test}}
 }
 \author{ Andy Bunn, patched and improved by Mikko Korpela  }
 \seealso{ \code{\link{rwl.stats}}, \code{\link{rwi.stats}} }
-\examples{data(co021)
-foo <- series.rho(co021)
+\examples{data(gp.rwl)
+foo <- series.rho(gp.rwl)
 # compare to: 
-# corr.rwl.seg(rwl=co021)$overall
+# corr.rwl.seg(rwl=gp.rwl)$overall
 
-# two measures of interseries correlation:
-bar <- rwi.stats(detrend(co021,method="ModNegExp"))
+# two measures of interseries correlation
+# compare series.rho to rbar from rwi.stats
+gp.ids <- read.ids(gp.rwl, stc = c(0, 2, 1))
+bar <- rwi.stats(gp.rwl, gp.ids, prewhiten=TRUE)
 bar$rbar.eff
 mean(foo[,1])
 



More information about the Dplr-commits mailing list