rwi.stats.running {dplR} | R Documentation |
(Running Window) Statistics on Detrended Ring-Width Series
Description
These functions calculate descriptive statistics on a
data.frame
of (usually) ring-width indices. The statistics are
optionally computed in a running window with adjustable length and
overlap. The data can be filtered so that the comparisons are made to
on just high-frequency data.
Usage
rwi.stats.running(rwi, ids = NULL, period = c("max", "common"),
method = c("spearman", "pearson","kendall"),
prewhiten=FALSE,n=NULL,
running.window = TRUE,
window.length = min(50, nrow(rwi)),
window.overlap = floor(window.length / 2),
first.start = NULL,
min.corr.overlap = min(30, window.length),
round.decimals = 3,
zero.is.missing = TRUE)
rwi.stats(rwi, ids=NULL, period=c("max", "common"),
method = c("spearman", "pearson","kendall"), ...)
rwi.stats.legacy(rwi, ids=NULL, period=c("max", "common"))
Arguments
rwi |
a |
ids |
an optional |
period |
a |
method |
Can be either |
n |
|
prewhiten |
|
running.window |
|
window.length |
|
window.overlap |
|
first.start |
an optional |
min.corr.overlap |
|
round.decimals |
non-negative integer |
zero.is.missing |
|
... |
arguments passed on to |
Details
This calculates a variety of descriptive statistics commonly used in dendrochronology.
The function rwi.stats
is a wrapper that calls
rwi.stats.running
with running.window = FALSE
.
The results may differ from those prior to dplR 1.5.3, where the
former rwi.stats
(now renamed to rwi.stats.legacy
) was
replaced with a call to rwi.stats.running
.
For correctly calculating the statistics on within and between series
variability, an appropriate mask (parameter ids
) must be
provided that identifies each series with a tree as it is common for
dendrochronologists to take more than one core per tree. The function
read.ids
is helpful for creating a mask based on the
series ID.
If ids
has duplicate tree/core combinations, the
corresponding series are averaged before any statistics are computed.
The value of the parameter zero.is.missing
is relevant in
the averaging: TRUE
ensures that zeros don’t
contribute to the average. The default value of
zero.is.missing
is TRUE
. The default prior to
dplR 1.5.3 was FALSE
. If the parameter is set to FALSE
,
the user will be warned in case zeros are present. Duplicate
tree/core combinations are not detected by rwi.stats.legacy
.
Row names of ids
may be used for matching the
IDs with series in rwi
. In this case, the
number of rows in ids
is allowed to exceed the number of
series. If some names of rwi
are missing from the row
names of ids
, the rows of ids
are assumed to
be in the same order as the columns of rwi
, and the
dimensions must match. The latter is also the way that
rwi.stats.legacy
handles ids
, i.e. names are
ignored and dimensions must match.
Note that period = "common"
can produce NaN
for many of
the stats if there is no common overlap period among the cores. This
happens especially in chronologies with floating subfossil samples
(e.g., ca533
).
Some of the statistics are specific to dendrochronology (e.g., the effective number of cores or the expressed population signal). Users unfamiliar with these should see Cook and Kairiukstis (1990) and Fritts (2001) for further details for computational details on the output. The signal-to-noise ratio is calculated following Cook and Pederson (2011).
Note that Buras (2017) cautions against using the expressed population signal as a statistic to determine the whether a chronology correctly represents the population signal of a data set. He reccomends the use of subsample signal strength (sss
) over EPS.
If desired, the rwi
can be filtered in the same manner
as the family of cross-dating functions using prewhiten
and
n
. See the help page for corr.rwl.seg
for
more details.
Value
A data.frame
containing the following columns (each row
corresponds to one position of the window):
start.year |
the first year in the window. Not returned if
|
mid.year |
the middle year in the window, rounded down. Not
returned if |
end.year |
the last year in the window. Not returned if
|
n.cores |
the number of cores |
n.trees |
the number of trees |
n |
the average number of trees (for each year, a tree needs at
least one non- |
n.tot |
total number of correlations calculated as
Equal to |
n.wt |
number of within-tree correlations computed |
n.bt |
number of between-tree correlations computed |
rbar.tot |
the mean of all the correlations between different cores |
rbar.wt |
the mean of the correlations between series from the same tree over all trees |
rbar.bt |
the mean interseries correlation between all series from different trees |
c.eff |
the effective number of cores (takes into account the number of within-tree correlations in each tree) |
rbar.eff |
the effective signal calculated as
|
eps |
the expressed population signal calculated using the average
number of trees as |
snr |
the signal to noise ratio calculated using the average
number of trees as |
Note
This function uses the foreach
looping
construct with the %dopar%
operator.
For parallel computing and a potential speedup, a parallel backend
must be registered before running the function.
Author(s)
Mikko Korpela, based on rwi.stats.legacy
by Andy
Bunn
References
Buras, A. (2017) A comment on the Expressed Population Signal. Dendrochronologia 44:130-132.
Cook, E. R. and Kairiukstis, L. A., editors (1990) Methods of Dendrochronology: Applications in the Environmental Sciences. Springer. ISBN-13: 978-0-7923-0586-6.
Cook, E. R. and Pederson, N. (2011) Uncertainty, Emergence, and Statistics in Dendrochronology. In Hughes, M. K., Swetnam, T. W., and Diaz, H. F., editors, Dendroclimatology: Progress and Prospects, pages 77–112. Springer. ISBN-13: 978-1-4020-4010-8.
Fritts, H. C. (2001) Tree Rings and Climate. Blackburn. ISBN-13: 978-1-930665-39-2.
See Also
detrend
, cor
,
read.ids
, rwi.stats
,
corr.rwl.seg
Examples
library(utils)
data(gp.rwl)
data(gp.po)
gp.rwi <- cms(rwl = gp.rwl, po = gp.po)
gp.ids <- read.ids(gp.rwl, stc = c(0, 2, 1))
# On a running window
rwi.stats.running(gp.rwi, gp.ids)
## With no running window (i.e. running.window = FALSE)
rwi.stats(gp.rwi, gp.ids)
## Restrict to common overlap (in this case 1899 to 1987)
rwi.stats(gp.rwi, gp.ids, period="common")
rwi.stats.legacy(gp.rwi, gp.ids) # rwi.stats prior to dplR 1.5.3