Title: | Tree-ring dating and estimating felling dates of historical timbers |
---|---|
Description: | fellingdater provides a comprehensive suite of functions for dendrochronological and dendroarchaeological analysis, covering a workflow from tree-ring **data processing** and **crossdating**, up to the estimation and reporting of **felling dates**. Originally designed to assist dendrochronologists in inferring felling dates from dated tree-ring series with partially preserved sapwood, the package has been expanded to include a workflow for tree-ring dating, analysis, and visualization. |
Authors: | Kristof Haneca [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-7719-8305>), Koen Van Daele [ctb] (ORCID: <https://orcid.org/0000-0002-8153-2978>), Ronald Visser [ctb] (ORCID: <https://orcid.org/0000-0001-6966-1729>), Antonio Jesus Pérez-Luque [rev] (ORCID: <https://orcid.org/0000-0002-1747-0469>), Nicholas John Tierney [rev] (ORCID: <https://orcid.org/0000-0003-1460-8722>) |
Maintainer: | Kristof Haneca <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.2.0 |
Built: | 2025-06-30 07:27:12 UTC |
Source: | https://github.com/ropensci/fellingdater |
Sapwood data set for Western Sweden published by Bräthen in 1982.
Brathen_1982
Brathen_1982
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 69 observations
Bräthen A. 1982. A tree-ring chronology from the western part of Sweden. Sapwood and a dating problem, in: Hackens T., Mejdahl V. (Eds.), Second Nordic Conference on the Application of Scientific Methods in Archaeology, PACT 7(1). pp. 27–35.
sw_data_info("Brathen_1982") sw_model("Brathen_1982", plot = TRUE)
sw_data_info("Brathen_1982") sw_model("Brathen_1982", plot = TRUE)
This function reports the felling date estimate of individual tree-ring series, based on the presence/absence of sapwood and/or waney edge. There are three possible modes of reporting:
a terminus post quem or earliest possible felling date: when only heartwood rings have been observed and measured
a felling date range or interval: when sapwood rings have been recorded, but no bark or waney edge is present.
an exact felling date: when bark or waney edge is present on the measured sample.
fd_report( x, series = "series", last = "last", n_sapwood = "n_sapwood", waneyedge = "waneyedge", sw_data = "Hollstein_1980", cred_mass = 0.954, densfun = "lognormal" )
fd_report( x, series = "series", last = "last", n_sapwood = "n_sapwood", waneyedge = "waneyedge", sw_data = "Hollstein_1980", cred_mass = 0.954, densfun = "lognormal" )
x |
Name of a
Optionally, a column specifying the sapwood data set ( |
series |
Name of the column in |
last |
Name of the column in |
n_sapwood |
Name of the column in |
waneyedge |
Name of the column in |
sw_data |
There are two options:
|
cred_mass |
A numeric |
densfun |
Name of the density function to fit to the sapwood distribution. Should be one of:
|
A data.frame
with felling date estimates per tree-ring series.
Columns include:
series
: series identifier
last
: last measured ring
n_sapwood
: number of sapwood rings
waneyedge
: TRUE/FALSE for waney edge
lower
, upper
: numeric bounds for the estimated felling date
felling_date
: a character summary (e.g., "between 1500 and 1510")
sapwood_model
: the sapwood data/model used
sw_interval()
, sw_data_overview()
, sw_interval_plot()
df <- data.frame( id = c("trs1", "trs2", "trs3", "trs4"), swr = c(7, 1, 10, 12), waneyedge = c(FALSE, FALSE, FALSE, TRUE), end = c(1482, 1475, 1490, 1498) ) fd_report(df, series = "id", n_sapwood = "swr", last = "end", sw_data = "Wazny_1990" ) # Example with different sw_model for individual series # You can add a user-defined sapwood dataset as well. sapwood_model_column <- c( "Sohar_2012_ELL_c", "Wazny_1990", "Hollstein_1980", "vanDaalen_Norway" ) df2 <- cbind(df, sw_data = sapwood_model_column) fd_report(df2, series = "id", n_sapwood = "swr", last = "end", sw_data = "sw_data" ) #' @importFrom rlang .data
df <- data.frame( id = c("trs1", "trs2", "trs3", "trs4"), swr = c(7, 1, 10, 12), waneyedge = c(FALSE, FALSE, FALSE, TRUE), end = c(1482, 1475, 1490, 1498) ) fd_report(df, series = "id", n_sapwood = "swr", last = "end", sw_data = "Wazny_1990" ) # Example with different sw_model for individual series # You can add a user-defined sapwood dataset as well. sapwood_model_column <- c( "Sohar_2012_ELL_c", "Wazny_1990", "Hollstein_1980", "vanDaalen_Norway" ) df2 <- cbind(df, sw_data = sapwood_model_column) fd_report(df2, series = "id", n_sapwood = "swr", last = "end", sw_data = "sw_data" ) #' @importFrom rlang .data
fellingdater provides a comprehensive suite of functions for dendrochronological and dendroarchaeological analysis, covering a workflow from tree-ring data processing and crossdating, up to the estimation and reporting of felling dates. Originally designed to assist dendrochronologists in inferring felling dates from dated tree-ring series with partially preserved sapwood, the package has been expanded to include a workflow for tree-ring dating, analysis, and visualization.
Maintainer: Kristof Haneca [email protected] (ORCID) [copyright holder]
Other contributors:
Koen Van Daele (ORCID) [contributor]
Ronald Visser (ORCID) [contributor]
Antonio Jesus Pérez-Luque (ORCID) [reviewer]
Nicholas John Tierney (ORCID) [reviewer]
Useful links:
Report bugs at https://github.com/ropensci/fellingdater/issues
This function reports the HEADER fields from a Heidelberg format
(.fh) ring-width file. The header fields are harvested from the .fh-file by
the read_fh()
function, which stores the HEADER fields from the .fh file
as attributes of the data.frame
with the measurement data it returns.
fh_header(x)
fh_header(x)
x |
The output of |
A data.frame
with 29 header fields.
Doel1 <- system.file("extdata", "DOEL1.fh", package = "fellingdater") Doel1_trs <- read_fh(Doel1, verbose = FALSE) fh_header(Doel1_trs)
Doel1 <- system.file("extdata", "DOEL1.fh", package = "fellingdater") Doel1_trs <- read_fh(Doel1, verbose = FALSE) fh_header(Doel1_trs)
This function returns a matrix with 'upper' and 'lower' limits
of the hdi (highest density interval), and the associated probability 'p'.
The function first sorts the input data.frame
- with columns 'n_sapwood´
and 'p' (the associated probability) - by column 'p' in decreasing order
and then it calculates the HDI by finding the first value of the sorted
probabilities higher than the specified cred_mass.
It then finds the
indices of the values that are greater than or equal to this threshold, and
uses these indices to find the 'upper' and 'lower' limits of the hdi.
The function also calculates the probability of the interval. The final
result is returned as a matrix
with 'lower', 'upper', and 'p' values.
This function is applied in functions sw_model and sw_interval.
hdi(x, a = "n_sapwood", b = "p", cred_mass = 0.954)
hdi(x, a = "n_sapwood", b = "p", cred_mass = 0.954)
x |
A |
a |
The name of the column in x that lists the number of sapwood rings. |
b |
The name of the column in x that lists the the associated probability of having n sapwood rings. |
cred_mass |
A |
A matrix
with ´upper´ and ´lower´ limits of the hdi, and the
associated probability ´p´.
tmp <- data.frame(n_sapwood = seq(1,30, 1), p = dnorm(seq(1,30, 1), 15, 5)) hdi(tmp, cred_mass = 0.954)
tmp <- data.frame(n_sapwood = seq(1,30, 1), p = dnorm(seq(1,30, 1), 15, 5)) hdi(tmp, cred_mass = 0.954)
Sapwood data set for South and Central Germany published by Hollstein in 1980.
Hollstein_1980
Hollstein_1980
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 490 observations
Hollstein E. 1980. Mitteleuropäische Eichenchronologie: Trierer dendrochronologische Forschungen zur Archäologie und Kunstgeschichte, Trierer Grabungen und Forschungen. Verlag Phillipp von Zabern, Mainz am Rhein.
sw_data_info("Hollstein_1980") sw_model("Hollstein_1980", plot = TRUE)
sw_data_info("Hollstein_1980") sw_model("Hollstein_1980", plot = TRUE)
Sapwood data set for the Northern Midland counties (U.K.) - Cheshire, Staffordshire, West Midlands, Northamptonshire, Cambridgeshire, and everything to the north - published by Miles in 1997.
Miles_1997_NM
Miles_1997_NM
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 295 observations
Miles D. 1997. The interpretation, presentation and use of tree-ring dates. Vernacular architecture 28, 40–56. https://doi.org/10.1179/030554797786050563
sw_data_info("Miles_1997_NM") sw_model("Miles_1997_NM", plot = TRUE)
sw_data_info("Miles_1997_NM") sw_model("Miles_1997_NM", plot = TRUE)
Sapwood data set for the Southern counties (U.K.), up to and including Gloucestershire, Warwickshire, Bedfordshire, Suffolk and Norfolk, published by Miles in 1997.
Miles_1997_SC
Miles_1997_SC
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 406 observations
Miles D. 1997. The interpretation, presentation and use of tree-ring dates. Vernacular architecture 28, 40–56. https://doi.org/10.1179/030554797786050563
sw_data_info("Miles_1997_SC") sw_model("Miles_1997_SC", plot = TRUE)
sw_data_info("Miles_1997_SC") sw_model("Miles_1997_SC", plot = TRUE)
Sapwood data set for Wales and border counties (U.K.), Shropshire, Hereford and Worcesterthe, published by Miles in 1997.
Miles_1997_WBC
Miles_1997_WBC
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 219 observations
Miles D. 1997. The interpretation, presentation and use of tree-ring dates. Vernacular architecture 28, 40–56. https://doi.org/10.1179/030554797786050563
sw_data_info("Miles_1997_WBC") sw_model("Miles_1997_WBC", plot = TRUE)
sw_data_info("Miles_1997_WBC") sw_model("Miles_1997_WBC", plot = TRUE)
This vectorized function computes a running mean/moving average over a continuous (time) series with a specified window width.
mov_av(x, w = 11, align = "center", edges = "fill")
mov_av(x, w = 11, align = "center", edges = "fill")
x |
A |
w |
The width of the moving average window. When |
align |
The alignment of the window relative to the current data point. It can be one of:
|
edges |
Defines how values are computed at the start and end of the series. Options are:
|
A numeric
vector of the same length of x
with the computed
running mean values.
num_vec <- sample(seq(50, 100, 1), 100, replace = TRUE) filtered <- mov_av(num_vec, w = 5, align = "center", edges = "nofill") plot(num_vec, type = "l") lines(filtered, col = "darkblue")
num_vec <- sample(seq(50, 100, 1), 100, replace = TRUE) filtered <- mov_av(num_vec, w = 5, align = "center", edges = "nofill") plot(num_vec, type = "l") lines(filtered, col = "darkblue")
Sapwood data set for northern France , published by Pilcher in 1987.
Pilcher_1987
Pilcher_1987
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 219 observations
Pilcher J.R. 1987. A 700 year dating chronology for northern France. Applications of tree-ring studies. Current research in dendrochronology and related subjects. BAR International Series 333, 127–139.
sw_data_info("Pilcher_1987") sw_model("Pilcher_1987", plot = TRUE)
sw_data_info("Pilcher_1987") sw_model("Pilcher_1987", plot = TRUE)
This function reads a Heidelberg format file (.fh) containing
ring width data and returns the HEADER fields as attributes of the
data.frame
´with the measurement data.
The Heidelberg file format is described in detail here: https://www.treeringsociety.org/resources/SOM/Brewer_Murphy_SupplementaryMaterial.pdf
read_fh(fname, BC_correction = FALSE, verbose = TRUE, header = FALSE)
read_fh(fname, BC_correction = FALSE, verbose = TRUE, header = FALSE)
fname |
A |
BC_correction |
A |
verbose |
A |
header |
A |
This function reads .fh file with ring width data in either block
(decadal format) or column format (e.g., with comment flags) as used by
TSAP program. The function is also capable of reading chronologies or
half-chronos in decadal format. The read_fh
function is case-insensitive.
Information found in the HEADER fields is listed as attributes of the
data.frame
´with the measurement data. .
The header fields harvested from the .fh file include:
"Project", "FirstMeasurementDate", "Location", "Town", "Street", "Client", "Longitude", "Latitude", "DateOfSampling", "FirstMeasurementDate", "SapWoodRings", "Comment", "MissingRingsAfter", "InvalidRingsAfter", "MissingringsBefore", "DeltaMissingringsBefore", "ChronoMemberKeycodes", "PersId"
If header
is TRUE, a data.frame is returned with HEADER fields as
attributes. If header
is FALSE, a data.frame
of class rwl
with
ring-width measurements in columns is returned, with (calendar) years as
row names.'
The original read.fh()
function is part of the dplR package
(https://github.com/opendendro/dplR) and was developed by Christian Zang,
with new features and patches contributed by Mikko Korpela and Ronald
Visser. This read_fh()
function expands the functionalities of the
original dplR::read.fh()
.
This function is an extension of read.fh()
from the dplR
package (https://github.com/opendendro/dplR), developed and maintained
by Prof. dr. Andy Bunn (Bunn 2008, Bunn 2010, Bunn et al. 2022) on
https://opendendro.org/.
Doel1 <- system.file("extdata", "DOEL1.fh", package = "fellingdater") Doel1_trs <- read_fh(Doel1, verbose = FALSE) head(Doel1_trs, 10) Doel1_header <- read_fh(Doel1, verbose = FALSE, header = TRUE) Doel1_header
Doel1 <- system.file("extdata", "DOEL1.fh", package = "fellingdater") Doel1_trs <- read_fh(Doel1, verbose = FALSE) head(Doel1_trs, 10) Doel1_header <- read_fh(Doel1, verbose = FALSE, header = TRUE) Doel1_header
Identifies years when two tree-ring series show synchronous growth changes (SGC)
both increasing or both decreasing from the previous year. Based on the logic used in trs_pv() for distinguishing between synchronous and semi-synchronous growth.
sgc_for_plot(x, y)
sgc_for_plot(x, y)
x |
A |
y |
A |
The function compares year-to-year growth direction changes between two series using the same logic as trs_pv():
Synchronous Growth Changes (SGC): Both series change in the same direction (both + or both -)
Semi-synchronous/Asynchronous: One series changes while other doesn't, or they change in opposite directions
Only years with synchronous growth changes receive TRUE values. Years with missing values in either series are marked as FALSE. The first year cannot be evaluated (no previous year for comparison) and is marked as FALSE.
A data.frame
with two columns:
pv_logi |
Logical vector indicating synchronous growth changes (TRUE) or not (FALSE) |
year |
Numeric vector of years corresponding to the logical values |
# Create sample data years <- 1950:1980 x <- data.frame(series1 = runif(length(years), 0.5, 2.0)) rownames(x) <- years y <- data.frame(series2 = runif(length(years), 0.8, 1.8)) rownames(y) <- years # Detect synchronous growth changes sync_growth <- sgc_for_plot(x, y) head(sync_growth)
# Create sample data years <- 1950:1980 x <- data.frame(series1 = runif(length(years), 0.5, 2.0)) rownames(x) <- years y <- data.frame(series2 = runif(length(years), 0.8, 1.8)) rownames(y) <- years # Detect synchronous growth changes sync_growth <- sgc_for_plot(x, y) head(sync_growth)
Sapwood data set for Eastern Estonia, Latvia, Lithuania, published by Sohar et al. in 2012.
Sohar_2012_ELL_c
Sohar_2012_ELL_c
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 562 observations !!! sapwood determined by _color_
Sohar K., Vitas A. & Läänelaid A. 2012. Sapwood estimates of pedunculate oak (Quercus robur L.) in eastern Baltic, Dendrochronologia 30.1, 49–56. https://doi.org/10.1016/j.dendro.2011.08.001
sw_data_info("Sohar_2012_ELL_c") sw_model("Sohar_2012_ELL_c", plot = TRUE)
sw_data_info("Sohar_2012_ELL_c") sw_model("Sohar_2012_ELL_c", plot = TRUE)
Sapwood data set for Eastern Estonia, Latvia, Lithuania, published by Sohar et al. in 2012.
Sohar_2012_ELL_t
Sohar_2012_ELL_t
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 533 observations !!! sapwood determined by presence of _tyloses_
Sohar K., Vitas A. & Läänelaid A. 2012. Sapwood estimates of pedunculate oak (Quercus robur L.) in eastern Baltic, Dendrochronologia 30.1, 49–56. https://doi.org/10.1016/j.dendro.2011.08.001
sw_data_info("Sohar_2012_ELL_t") sw_model("Sohar_2012_ELL_t", plot = TRUE)
sw_data_info("Sohar_2012_ELL_t") sw_model("Sohar_2012_ELL_t", plot = TRUE)
Sapwood data set for Southern Finland and western Estonia, published by Sohar et al. in 2012.
Sohar_2012_FWE_c
Sohar_2012_FWE_c
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 98 observations !!! sapwood determined by _color_
Sohar K., Vitas A. & Läänelaid A. 2012. Sapwood estimates of pedunculate oak (Quercus robur L.) in eastern Baltic, Dendrochronologia 30.1, 49–56. https://doi.org/10.1016/j.dendro.2011.08.001
sw_data_info("Sohar_2012_FWE_c") sw_model("Sohar_2012_FWE_c", plot = TRUE)
sw_data_info("Sohar_2012_FWE_c") sw_model("Sohar_2012_FWE_c", plot = TRUE)
Sapwood data set for Southern Finland and western Estonia, published by Sohar et al. in 2012.
Sohar_2012_FWE_t
Sohar_2012_FWE_t
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 97 observations !!! sapwood determined by the presence of _tyloses_
Sohar K., Vitas A. & Läänelaid A. 2012. Sapwood estimates of pedunculate oak (Quercus robur L.) in eastern Baltic, Dendrochronologia 30.1, 49–56. https://doi.org/10.1016/j.dendro.2011.08.001
sw_data_info("Sohar_2012_FWE_t") sw_model("Sohar_2012_FWE_t", plot = TRUE)
sw_data_info("Sohar_2012_FWE_t") sw_model("Sohar_2012_FWE_t", plot = TRUE)
This function evaluates whether multiple sapwood estimates can be combined into a single felling date range and computes the resulting interval if possible.
sw_combine( x, series = "series", last = "last", n_sapwood = "n_sapwood", waneyedge = "waneyedge", sw_data = "Hollstein_1980", densfun = "lognormal", cred_mass = 0.954, hdi = TRUE, plot = FALSE )
sw_combine( x, series = "series", last = "last", n_sapwood = "n_sapwood", waneyedge = "waneyedge", sw_data = "Hollstein_1980", densfun = "lognormal", cred_mass = 0.954, hdi = TRUE, plot = FALSE )
x |
A |
series |
Name of the column in |
last |
Name of the column in |
n_sapwood |
Name of the column in |
waneyedge |
Name of the column in |
sw_data |
The name of the sapwood data set to use for modelling. It
should be one of the data sets listed in |
densfun |
Name of the density function fitted to the sapwood data set. Should be one of:
|
cred_mass |
A |
hdi |
A |
plot |
A |
@return Depends on plot
:
If TRUE
: a ggplot
-style plot showing individual and combined felling date estimates.
If FALSE
: a list
with:
- $raw_data
: matrix of combined and individual densities.
- $sapwood_data
: sapwood data set used.
- $sapwood_model
: density function used.
- $cred_mass
: credibility mass for the interval.
- $hdi_combine
: HDI for the combined felling date range.
- $individual_series
: summary with agreement indices.
- $A_model
: overall model agreement index.
- $A_c
: critical threshold (default 60%).
- $model_summary
: text summary of the result.Depends on the value of plot.
The rationale of the agreement index is outlined by Bronk Ramsey (1995; 2009)
Bronk Ramsey, C. (1995) Radiocarbon calibration and analysis of stratigraphy: the OxCal program. Radiocarbon 37, 425–430. https://doi.org/10.1017/S0033822200030903
Bronk Ramsey, C. (2009) Bayesian analysis of radiocarbon dates. Radiocarbon 51, 337–360. https://doi.org/10.1017/S0033822200033865
# Example with all series preserving sapwood sw_combine(sw_example1, plot = TRUE) # Example with one exact felling date (= waney edge preserved) sw_example2 sw_combine(sw_example2, plot = TRUE) # Example with multiple exact felling dates sw_example3 sw_combine(sw_example3, plot = FALSE)
# Example with all series preserving sapwood sw_combine(sw_example1, plot = TRUE) # Example with one exact felling date (= waney edge preserved) sw_example2 sw_combine(sw_example2, plot = TRUE) # Example with multiple exact felling dates sw_example3 sw_combine(sw_example3, plot = FALSE)
sw_combine()
This function plots the result of sw_combine()
and the
interval for, or the exact felling date of, a group of tree-ring series,
with agreement indices for the global model.
sw_combine_plot(x)
sw_combine_plot(x)
x |
Output of |
A ggplot-style graph, with calendar years on the X-axis and the probability (p) on the Y-axis. Dots represent exact felling dates.
sw_example2 tmp <- sw_combine(sw_example2) sw_combine_plot(tmp)
sw_example2 tmp <- sw_combine(sw_example2) sw_combine_plot(tmp)
This function returns more information on a sapwdood data set. It lists the correct citation for the data set, the area the data set is supposed to represent, the number of observations and summary stats of the raw data.
sw_data_info(x = NULL)
sw_data_info(x = NULL)
x |
The name of a sapwood data set. you can use |
A list
with the following components:
data
: the name of the data set,
citation
: the correct citation for the data set,
area
: the area represented by the data set,
n_observations
: the number of observations in the data set and,
summary_raw_data
: summary stats of the raw data.
# Get detailed information on a sapwood data set sw_data_info("Hollstein_1980") # Retrieve the citation for a specific data set sw_data_info("Sohar_2012_FWE_c")$citation
# Get detailed information on a sapwood data set sw_data_info("Hollstein_1980") # Retrieve the citation for a specific data set sw_data_info("Sohar_2012_FWE_c")$citation
fellingdater
packageThis function provides an overview of the available sapwood data
sets and models within the fellingdater
package.
sw_data_overview()
sw_data_overview()
A character
vector with the names of all available data sets with
sapwood counts in the fellingdater
package.
# Get an overview of available sapwood data sets sw_data_overview()
# Get an overview of available sapwood data sets sw_data_overview()
A dataset in which all series have preserved sapwood. Unconventional variable names.
sw_example0
sw_example0
A tibble of 4 variables:
unique ID of the tree-ring series
calendar year assigned to the last measured ring
number of observed sapwood rings
waney edge present TRUE/FALSE
sw_example0
sw_example0
A dataset in which all series have preserved sapwood rings.
sw_example1
sw_example1
A tibble of 4 variables:
unique ID of the tree-ring series
calendar year assigned to the last measured ring
number of observed sapwood rings
waney edge present TRUE/FALSE
sw_example1
sw_example1
A dataset in which one series has an exact felling date (= waney edge present).
sw_example2
sw_example2
A tibble of 4 variables:
unique ID of the tree-ring series
calendar year assigned to the last measured ring
number of observed sapwood rings
waney edge present TRUE/FALSE
sw_example2
sw_example2
A dataset with multiple exact felling dates.
sw_example3
sw_example3
A tibble of 4 variables:
unique ID of the tree-ring series
calendar year assigned to the last measured ring
number of observed sapwood rings
waney edge present TRUE/FALSE
sw_example3
sw_example3
A combination of series with and without sapwood rings.
sw_example4
sw_example4
A tibble of 4 variables:
unique ID of the tree-ring series
calendar year assigned to the last measured ring
number of observed sapwood rings
waney edge present TRUE/FALSE
sw_example4
sw_example4
None of the series in this dataset have preserved sapwood rings.
sw_example5
sw_example5
A tibble of 4 variables:
unique ID of the tree-ring series
calendar year assigned to the last measured ring
number of observed sapwood rings
waney edge present TRUE/FALSE
sw_example5
sw_example5
A test dataset for sw_sum().
sw_example6
sw_example6
A tibble of 4 variables:
unique ID of the tree-ring series
calendar year assigned to the last measured ring
number of observed sapwood rings
waney edge present TRUE/FALSE
sw_example6
sw_example6
A test dataset for sw_sum().
sw_example7
sw_example7
A tibble of 4 variables:
unique ID of the tree-ring series
calendar year assigned to the last measured ring
number of observed sapwood rings
waney edge present TRUE/FALSE
sw_example7
sw_example7
This function computes the probability density function (PDF) and the highest posterior density interval (HDI) of the felling date range, based on the observed number of sapwood rings, their dating, and a selected sapwood dataset and model.
sw_interval( n_sapwood = NA, last = 1, hdi = FALSE, cred_mass = 0.954, sw_data = "Hollstein_1980", densfun = "lognormal", plot = FALSE )
sw_interval( n_sapwood = NA, last = 1, hdi = FALSE, cred_mass = 0.954, sw_data = "Hollstein_1980", densfun = "lognormal", plot = FALSE )
n_sapwood |
A |
last |
A |
hdi |
Logical. If |
cred_mass |
A numeric |
sw_data |
The name of the sapwood data set to use for modelling. It
should be one of the data sets listed in |
densfun |
A character string naming the distribution to fit. One of:
|
plot |
A
|
The type of output depends on the value of hdi
:
If hdi = TRUE
, a numeric vector with the lower and upper limits of the
highest density interval (HDI). Attributes include cred_mass
, sw_data
,
and the fitted model
.
If hdi = FALSE
, a data frame with scaled probability values (p
) for
each year after the last dated sapwood ring.
# 10 sapwood rings observed and the Wazny 1990 sapwood model: sw_interval( n_sapwood = 10, last = 1234, hdi = TRUE, cred_mass = .95, sw_data = "Wazny_1990", densfun = "lognormal", plot = FALSE ) # same example as above, but with numerical output (hdi = FALSE): sw_interval( n_sapwood = 10, last = 1234, hdi = FALSE, cred_mass = .95, sw_data = "Wazny_1990", densfun = "lognormal", plot = FALSE )
# 10 sapwood rings observed and the Wazny 1990 sapwood model: sw_interval( n_sapwood = 10, last = 1234, hdi = TRUE, cred_mass = .95, sw_data = "Wazny_1990", densfun = "lognormal", plot = FALSE ) # same example as above, but with numerical output (hdi = FALSE): sw_interval( n_sapwood = 10, last = 1234, hdi = FALSE, cred_mass = .95, sw_data = "Wazny_1990", densfun = "lognormal", plot = FALSE )
sw_interval()
Returns a ggplot-style graph of the probability density function for the
felling date range, as computed by sw_interval()
.
sw_interval_plot(x, area_fill = "tomato3", line_color = "tomato3")
sw_interval_plot(x, area_fill = "tomato3", line_color = "tomato3")
x |
Output of |
area_fill |
Fill color for the area under fitted distribution. |
line_color |
Line color for the fitted distribution. |
A ggplot-style graph, with calendar years on the X-axis and the probability (p) on the Y-axis.
tmp <- sw_interval( n_sapwood = 10, last = 1000, hdi = FALSE, cred_mass = .95, sw_data = "Hollstein_1980", densfun = "lognormal", plot = FALSE ) sw_interval_plot(tmp, area_fill = "forestgreen", line_color = "forestgreen")
tmp <- sw_interval( n_sapwood = 10, last = 1000, hdi = FALSE, cred_mass = .95, sw_data = "Hollstein_1980", densfun = "lognormal", plot = FALSE ) sw_interval_plot(tmp, area_fill = "forestgreen", line_color = "forestgreen")
This function fits a distribution to a data set of observed sapwood numbers and computes the highest posterior density interval (hdi) for a given credibility mass.
sw_model( sw_data = "Hollstein_1980", densfun = "lognormal", cred_mass = 0.954, source = NA, plot = FALSE )
sw_model( sw_data = "Hollstein_1980", densfun = "lognormal", cred_mass = 0.954, source = NA, plot = FALSE )
sw_data |
The name of the sapwood data set to use for modelling. It
should be one of the data sets listed in |
densfun |
Name of the density function to fit to the sapwood data set. Should be one of:
|
cred_mass |
A |
source |
A character string with info on the data source. This info is
incorporated in the title of the plot when a sapwood data set is provided
from a user-defined |
plot |
A |
The return value depends on the plot
parameter.
if plot
is TRUE, a ggplot-style graph is returned.
if plot
is FALSE, a list
with the numeric output of the modelling
process is returned.
sw_model( sw_data = "Sohar_2012_ELL_c", densfun = "lognormal", cred_mass = .095, plot = FALSE ) sw_model("Hollstein_1980")
sw_model( sw_data = "Sohar_2012_ELL_c", densfun = "lognormal", cred_mass = .095, plot = FALSE ) sw_model("Hollstein_1980")
sw_model()
Returns a ggplot-style graph of the probability density function modelled to
a data set of observed sapwood numbers, as computed by sw_model()
.
sw_model_plot( x, bar_fill = "steelblue3", bar_color = "grey60", line_color = "red3" )
sw_model_plot( x, bar_fill = "steelblue3", bar_color = "grey60", line_color = "red3" )
x |
Output of |
bar_fill |
Fill color for the bars (original data). |
bar_color |
Line color for the bars (original data). |
line_color |
Line color for the fitted distribution. |
A ggplot-style graph.
tmp <- sw_model( sw_data = "Hollstein_1980", densfun = "lognormal", cred_mass = .95, plot = FALSE ) sw_model_plot(tmp, bar_fill = "forestgreen", bar_color = "darkgreen", line_color = "tomato3" )
tmp <- sw_model( sw_data = "Hollstein_1980", densfun = "lognormal", cred_mass = .95, plot = FALSE ) sw_model_plot(tmp, bar_fill = "forestgreen", bar_color = "darkgreen", line_color = "tomato3" )
Computes the summed probability density (SPD) for a set of felling date ranges.
sw_sum( x, series = "series", last = "last", n_sapwood = "n_sapwood", waneyedge = "waneyedge", sw_data = "Hollstein_1980", densfun = "lognormal", cred_mass = 0.954, plot = FALSE, scale_p = FALSE )
sw_sum( x, series = "series", last = "last", n_sapwood = "n_sapwood", waneyedge = "waneyedge", sw_data = "Hollstein_1980", densfun = "lognormal", cred_mass = 0.954, plot = FALSE, scale_p = FALSE )
x |
A |
series |
Name of the column in |
last |
Name of the column in |
n_sapwood |
Name of the column in |
waneyedge |
Name of the column in |
sw_data |
The name of the sapwood data set to use for modelling. It
should be one of the data sets listed in |
densfun |
Name of the density function fitted to the sapwood data set. Should be one of:
|
cred_mass |
A |
plot |
A
|
scale_p |
A |
Depends on the value of plot.
sw_example7 sw_sum(sw_example7, densfun = "lognormal", cred_mass = 0.63, plot = FALSE)
sw_example7 sw_sum(sw_example7, densfun = "lognormal", cred_mass = 0.63, plot = FALSE)
sw_sum()
This function creates a visualization of the summed probability
density (SPD) output from sw_sum()
. It displays both the SPD as a bar plot
and exact felling dates (waney edge series) as stacked points. A smoothing
spline is also added to reveal long-term trends in felling activity.
sw_sum_plot( x, bar_col = "steelblue", trend_col = "red3", dot_col = "steelblue4", dot_size = 2, dot_shape = 21, window_smooth = 11 )
sw_sum_plot( x, bar_col = "steelblue", trend_col = "red3", dot_col = "steelblue4", dot_size = 2, dot_shape = 21, window_smooth = 11 )
x |
A |
bar_col |
Fill color for the SPD bars. Default is |
trend_col |
Color of the smoothing spline line. |
dot_col |
Fill color of the symbols representing exact felling dates (waney edge).
Default is |
dot_size |
Size of the felling date symbols. Default is |
dot_shape |
Shape code for the felling date symbols. See |
window_smooth |
Numeric value specifying the smoothing window width (in years)
for calculating the moving average trend line. Default is |
A ggplot
object showing:
The SPD as a bar plot.
A smoothing spline through the SPD.
Stacked symbols for exact felling years (waney edge), if available.
sw_sum()
to generate the SPD data.
sw_example6 tmp <- sw_sum(sw_example6, plot = FALSE) sw_sum_plot(tmp, bar_col = "burlywood1", trend_col = "brown", dot_col = "orange", dot_shape = 23, dot_size = 5 )
sw_example6 tmp <- sw_sum(sw_example6, plot = FALSE) sw_sum_plot(tmp, bar_col = "burlywood1", trend_col = "brown", dot_col = "orange", dot_shape = 23, dot_size = 5 )
This function performs crossdating analysis using a sliding window with multiple statistical methods: Parallel Variation (GLK/SGC), Baillie & Pilcher t-values, Hollstein t-values, and standard Pearson correlation t-values. It tests series at different temporal lags to find a potential date positions.
trs_crossdate( x, y = NULL, min_overlap = 30, sliding = TRUE, top_n = NULL, rank_by = NULL, pb = TRUE )
trs_crossdate( x, y = NULL, min_overlap = 30, sliding = TRUE, top_n = NULL, rank_by = NULL, pb = TRUE )
x |
A data frame of test tree-ring series in |
y |
A data frame of reference tree-ring series in |
min_overlap |
Integer. Minimum number of overlapping years required between series pairs to compute statistics. Must be >= 3. Default is 30. |
sliding |
Logical. If |
top_n |
Integer or NULL. If specified, returns only the top n matches per
test series (after optional sorting by |
rank_by |
Character or NULL. Statistic to rank by when sorting results per
test series. If |
pb |
Logical. If |
This function implements sliding window crossdating, a fundamental technique in dendrochronology for dating wood samples of unknown age. The process involves:
Determining the range of possible lags based on series overlap
For each lag, shifting the test series temporally
Computing all crossdating statistics
Returning results for each tested position
The sliding window approach allows identification of the temporal position where test and reference series show maximum similarity, which indicates the most likely dating for the test series.
Statistical Methods:
t_BP: t-values according to the Baillie & Pilcher (1973) algorithm
t_Ho: t-values according to the Hollstein (1980) algorithm
sgc, sgc_p: synchronous growth change and associated significance level (Visser 2020)
ssgc: semi-synchronous growth change (Visser 2020)
glk, glk_p: 'Gleichläufigkeit' or 'percentage of parallel variation' (Buras & Wilmking 2015; Eckstein & Bauch 1969; Huber 1942), and significance level (p-value) associated with the glk-value (Jansma 1995)
r_pearson: the Pearson's correlation coefficient
t_St: Student's t-value
Sorting and Filtering:
If rank_by = NULL
: Results are returned with default ordering (series, reference, first)
If rank_by
is specified: Results are sorted per test series by the chosen statistic (high to low)
If top_n
is specified: Only the top n matches per test series are returned (after optional sorting)
A data frame with crossdating results containing the following columns:
Name of the test series from x
Length of the test series
Date of the first ring at the particular lag position
Date of the last ring at the particular lag position
Name of the reference series
Date of the first ring in the reference series
Date of the last ring in the reference series
Number of overlapping years between series and reference
Pearson correlation coefficient
Student's t-statistic
Baillie & Pilcher t-statistic
Hollstein t-statistic
Synchronous Growth Change (SGC) statistic
Semi-SGC statistic
SGC p-value
Gleichläufigkeit (GLK) statistic
GLK p-value
Baillie, M.G.L., Pilcher, J.R. (1973) A simple crossdating program for tree-ring research. Tree-Ring Bulletin 33, 7–14. http://hdl.handle.net/10150/260029
Buras, A. and Wilmking, M. (2015) Correcting the calculation of Gleichläufigkeit, Dendrochronologia 34, 29-30. https://doi.org/10.1016/j.dendro.2015.03.003
Eckstein, D. and Bauch, J. (1969) Beitrag zur Rationalisierung eines dendrochronologischen Verfahrens und zur Analyse seiner Aussagesicherheit. Forstwissenschaftliches Centralblatt, 88(1), 230-250.
Huber, B. (1943) Über die Sicherheit jahrringchronologischer Datierung. Holz als Roh- und Werkstoff 6, 263-268. https://doi.org/10.1007/BF02603303
Hollstein E. (1980) Mitteleuropäische Eichenchronologie. Trierer dendrochronologische Forschungen zur Archäologie und Kunstgeschichte, Trierer Grabungen und Forschungen 11, Mainz am Rhein.
Jansma, E. (1995) RemembeRINGs; The development and application of local and regional tree-ring chronologies of oak for the purposes of archaeological and historical research in the Netherlands, Nederlandse Archeologische Rapporten 19, Rijksdienst voor het Oudheidkundig Bodemonderzoek, Amersfoort. https://dspace.library.uu.nl/handle/1874/45149
Schweingruber, F. H. (1988) Tree rings: basics and applications of dendrochronology, Kluwer Academic Publishers, Dordrecht, Netherlands, 276 p.
Visser, R.M. (2020) On the similarity of tree-ring patterns: Assessing the influence of semi-synchronous growth changes on the Gleichläufigkeit for big tree-ring data sets, Archaeometry 63, 204-215. https://doi.org/10.1111/arcm.12600
## Not run: # Create sample data rwl_test <- trs_pseudo_rwl(n_series = 2, series_length = 80, end_date = 1950) rwl_ref <- trs_pseudo_rwl(n_series = 3, series_length = 150, end_date = 2000) # Full sliding window analysis with default ordering result <- trs_crossdate(rwl_test, rwl_ref, min_overlap = 30) # Sort by Hollstein t-values result_sorted <- trs_crossdate(rwl_test, rwl_ref, min_overlap = 30, rank_by = "t_Ho") # Contemporary positioning only contemp <- trs_crossdate(rwl_test, rwl_ref, sliding = FALSE) # Self-comparison for quality control self_check <- trs_crossdate(rwl_ref, sliding = FALSE) # Get top 3 matches per series ranked by Hollstein t-values top_matches <- trs_crossdate(rwl_test, rwl_ref, top_n = 3, rank_by = "t_Ho") ## End(Not run)
## Not run: # Create sample data rwl_test <- trs_pseudo_rwl(n_series = 2, series_length = 80, end_date = 1950) rwl_ref <- trs_pseudo_rwl(n_series = 3, series_length = 150, end_date = 2000) # Full sliding window analysis with default ordering result <- trs_crossdate(rwl_test, rwl_ref, min_overlap = 30) # Sort by Hollstein t-values result_sorted <- trs_crossdate(rwl_test, rwl_ref, min_overlap = 30, rank_by = "t_Ho") # Contemporary positioning only contemp <- trs_crossdate(rwl_test, rwl_ref, sliding = FALSE) # Self-comparison for quality control self_check <- trs_crossdate(rwl_ref, sliding = FALSE) # Get top 3 matches per series ranked by Hollstein t-values top_matches <- trs_crossdate(rwl_test, rwl_ref, top_n = 3, rank_by = "t_Ho") ## End(Not run)
Sets the row names (years) of an rwl-style data frame based on a specified end year.
Optionally trims trailing rows with only NA
values.
trs_end_date(x, end_year = 2025, trim = FALSE)
trs_end_date(x, end_year = 2025, trim = FALSE)
x |
A |
end_year |
An integer. The calendar year assigned to the most recent tree ring (last row). |
trim |
Logical. If |
A data.frame
with row names set to calendar years.
rwl <- trs_pseudo_rwl(n_series = 2, series_length = 50) trs_end_date(rwl, end_year = 2000) trs_end_date(rwl, end_year = 2000, trim = TRUE)
rwl <- trs_pseudo_rwl(n_series = 2, series_length = 50) trs_end_date(rwl, end_year = 2000) trs_end_date(rwl, end_year = 2000, trim = TRUE)
Creates a line plot of a dated tree-ring series and a reference chronology, with optional z-score standardization, statistical annotations, and visual highlighting of synchronous growth changes (SCG).
trs_plot_dated( x, y, end_year = NULL, zscore = TRUE, pv_highlight = TRUE, pv_alpha = 0.2, show_stats = TRUE, labels = TRUE, label_size = 3 )
trs_plot_dated( x, y, end_year = NULL, zscore = TRUE, pv_highlight = TRUE, pv_alpha = 0.2, show_stats = TRUE, labels = TRUE, label_size = 3 )
x |
A |
y |
A |
end_year |
Optional numeric. If provided, the rownames of |
zscore |
Logical. If |
pv_highlight |
Logical. If |
pv_alpha |
Numeric between 0 and 1. Controls the transparency of the parallel variation highlight.
Defaults to |
show_stats |
Logical. If |
labels |
Logical. If |
label_size |
Numeric. Controls the size of the year labels. Defaults to |
The function assumes that x
and y
are already calendar-dated and aligned by row names.
It performs internal trimming and optional z-scoring before plotting. Crossdating statistics
are computed using trs_crossdate()
, and regions of synchronous growth change (SGC) are highlighted.
Required helper functions include: trs_trim
, trs_zscore
,
trs_end_date
, and sgc_for_plot
. Statistics are derived from trs_crossdate
.
Required packages: ggplot2, ggtext, plyr
A ggplot
object showing the plotted time series.
x <- trs_pseudo_rwl(n_series = 1, series_length = 80, end_date = 1500, prefix = "trs_") y <- trs_pseudo_rwl(n_series = 1, series_length = 400, end_date = 1700, prefix = "ref_") trs_plot_dated(x, y)
x <- trs_pseudo_rwl(n_series = 1, series_length = 80, end_date = 1500, prefix = "trs_") y <- trs_pseudo_rwl(n_series = 1, series_length = 400, end_date = 1700, prefix = "ref_") trs_plot_dated(x, y)
Creates a line plot of all tree-ring series in an rwl dataframe, with optional z-score standardization and faceting options.
trs_plot_rwl( x, zscore = TRUE, facet = FALSE, ncol = 1, color = NULL, scale_y = "fixed" )
trs_plot_rwl( x, zscore = TRUE, facet = FALSE, ncol = 1, color = NULL, scale_y = "fixed" )
x |
A |
zscore |
Logical. If |
facet |
Logical. If |
ncol |
Numeric. Number of columns for faceted plots (only used when |
color |
Character string or vector specifying line color(s). When |
scale_y |
Character string specifying y-axis scaling for faceted plots.
Options are "fixed", "free", "free_x", or "free_y". Defaults to |
The function assumes that the rwl dataframe is already calendar-dated with years as row names.
When facet = FALSE
, all series are plotted on the same axes with different colors.
When facet = TRUE
, each series gets its own panel for easier individual inspection.
When providing a vector of colors, the length must match the number of series in the data.
Required helper functions include: trs_trim
and trs_zscore
.
Required packages: ggplot2, plyr, tidyr, dplyr
A ggplot
object showing the plotted time series.
rwl_data <- trs_pseudo_rwl(n_series = 5, series_length = c(75, 100), end_date = c(2000, 2025)) # Overlaid plot with z-scores trs_plot_rwl(rwl_data, zscore = TRUE, facet = FALSE) # Faceted plot with raw values trs_plot_rwl(rwl_data, zscore = FALSE, facet = TRUE, ncol = 1) # Custom colors for each series col_vec <- c("#0fa3b1", "#07beb8", "#3dccc7", "#68d8d6", "#9ceaef") trs_plot_rwl(rwl_data, color = c("tomato3", "navyblue", "forestgreen", "purple", "orange")) trs_plot_rwl(rwl_data, color = col_vec, zscore = FALSE)
rwl_data <- trs_pseudo_rwl(n_series = 5, series_length = c(75, 100), end_date = c(2000, 2025)) # Overlaid plot with z-scores trs_plot_rwl(rwl_data, zscore = TRUE, facet = FALSE) # Faceted plot with raw values trs_plot_rwl(rwl_data, zscore = FALSE, facet = TRUE, ncol = 1) # Custom colors for each series col_vec <- c("#0fa3b1", "#07beb8", "#3dccc7", "#68d8d6", "#9ceaef") trs_plot_rwl(rwl_data, color = c("tomato3", "navyblue", "forestgreen", "purple", "orange")) trs_plot_rwl(rwl_data, color = col_vec, zscore = FALSE)
Generates a synthetic tree-ring width dataset in rwl
format,
suitable for testing crossdating and chronology construction methods.
trs_pseudo_rwl( n_series = 10, series_length = 100, end_date = 2024, related = TRUE, trend = NULL, neg_lin_param = -0.1, neg_exp_param = 0.05, ar = TRUE, ar_params = 0.7, mean_rw = 100, noise_sd = 8, common_signal_strength = 0.75, prefix = "trs_", seed = NULL )
trs_pseudo_rwl( n_series = 10, series_length = 100, end_date = 2024, related = TRUE, trend = NULL, neg_lin_param = -0.1, neg_exp_param = 0.05, ar = TRUE, ar_params = 0.7, mean_rw = 100, noise_sd = 8, common_signal_strength = 0.75, prefix = "trs_", seed = NULL )
n_series |
Integer. Number of tree-ring series to generate. |
series_length |
Numeric or numeric vector of length 2. If a single number, all series have this fixed length. If a vector of two values, series lengths are randomly sampled between the minimum and maximum values (inclusive). |
end_date |
Numeric or numeric vector of length 2. If a single number, all series end in this year. If a vector of two values, series end years are randomly sampled within this range. |
related |
Logical. If |
trend |
Character. Type of trend to apply to series. Options: |
neg_lin_param |
Numeric. Slope for the linear decline (typically between -0.1 and -1.0). |
neg_exp_param |
Numeric. Rate parameter for the exponential decline (typically between 0.01 and 0.1). |
ar |
Logical. If |
ar_params |
Numeric vector. Autoregressive coefficients (e.g., |
mean_rw |
Numeric. Mean ring width around which the data is centered (default is 100). |
noise_sd |
Numeric. Standard deviation of noise added to each series (default is 8). |
common_signal_strength |
Numeric. Strength of common signal when |
prefix |
Character. Prefix used when naming each tree-ring series (default is |
seed |
Numeric. Random seed for reproducible results. If |
A data.frame
of class "rwl"
, with years as row names and each column
representing one synthetic tree-ring series.
# Basic usage pseudo_data <- trs_pseudo_rwl(n_series = 5, series_length = 50) # Variable lengths and end dates with reproducible results pseudo_data <- trs_pseudo_rwl( n_series = 10, series_length = c(80, 120), end_date = c(2020, 2024), seed = 123 ) # Related series with strong common signal (high rbar) pseudo_data <- trs_pseudo_rwl( n_series = 8, series_length = 100, related = TRUE, common_signal_strength = 0.85, # Should produce rbar ~ 0.7-0.8 trend = "neg_exp", ar = TRUE, ar_params = c(0.7, 0.2), seed = 456 )
# Basic usage pseudo_data <- trs_pseudo_rwl(n_series = 5, series_length = 50) # Variable lengths and end dates with reproducible results pseudo_data <- trs_pseudo_rwl( n_series = 10, series_length = c(80, 120), end_date = c(2020, 2024), seed = 123 ) # Related series with strong common signal (high rbar) pseudo_data <- trs_pseudo_rwl( n_series = 8, series_length = 100, related = TRUE, common_signal_strength = 0.85, # Should produce rbar ~ 0.7-0.8 trend = "neg_exp", ar = TRUE, ar_params = c(0.7, 0.2), seed = 456 )
Compares tree-ring series in two data frames using Gleichläufigkeit (GLK) and
Synchronous Growth Changes (SGC), adapted from the dplR
package.
trs_pv(x, y = NULL, min_overlap = 50, prob = TRUE, as_df = FALSE)
trs_pv(x, y = NULL, min_overlap = 50, prob = TRUE, as_df = FALSE)
x |
A data frame of test tree-ring series ( |
y |
A data frame of reference series ( |
min_overlap |
Integer. Minimum number of overlapping years required for computing GLK/SGC statistics. Default is 50. |
prob |
Logical. If TRUE (default), computes two-tailed p-values for GLK and SGC. |
as_df |
Logical. If TRUE, returns a long-format data.frame with all combinations and results. Default is FALSE. |
If as_df = FALSE
, a list with components:
Matrix of Gleichläufigkeit values.
Matrix of GLK p-values (if prob = TRUE
).
Matrix of synchronous growth change values.
Matrix of semi-synchronous growth change values.
Matrix of SGC p-values (if prob = TRUE
).
Matrix of the number of overlapping years used in each comparison.
If as_df = TRUE
, returns a data frame with columns:
series
, reference
, glk
, glk_p
, sgc
, ssgc
, sgc_p
, and overlap
.
# Create sample data, trs <- trs_pseudo_rwl(n_series = 5, series_length = c(80, 100), end_date = c(2010, 2020)) trs_pv(trs)$sgc
# Create sample data, trs <- trs_pseudo_rwl(n_series = 5, series_length = c(80, 100), end_date = c(2010, 2020)) trs_pv(trs)$sgc
Removes one or more tree-ring series (columns) from a data frame of class "rwl"
. Optionally adds the rownames (assumed to be years) as a column.
trs_remove(x, series, rownames_to_years = FALSE, trim = FALSE)
trs_remove(x, series, rownames_to_years = FALSE, trim = FALSE)
x |
A |
series |
A character vector specifying the names of the series (columns) to remove. |
rownames_to_years |
Logical. If |
trim |
Logical. If |
A data.frame
with the specified series removed. If rownames_to_years = TRUE
, the result will have an additional year
column.
rwl <- trs_pseudo_rwl(n_series = 3, series_length = 60, end_date = 2000) trs_remove(rwl, series = "trs_1") trs_remove(rwl, series = c("trs_1", "trs_3"), rownames_to_years = TRUE)
rwl <- trs_pseudo_rwl(n_series = 3, series_length = 60, end_date = 2000) trs_remove(rwl, series = "trs_1") trs_remove(rwl, series = c("trs_1", "trs_3"), rownames_to_years = TRUE)
Extracts one or more tree-ring series (columns) from a data frame of class "rwl"
.
Optionally adds the rownames (assumed to be years) as a column.
trs_select(x, series, rownames_to_years = FALSE, trim = FALSE)
trs_select(x, series, rownames_to_years = FALSE, trim = FALSE)
x |
A |
series |
A character string or vector specifying the name(s) of the series (columns) to extract. |
rownames_to_years |
Logical. If |
trim |
Logical. If |
A data.frame
with the selected series. If rownames_to_years = TRUE
, the result will have an additional year
column.
If trim = TRUE
, leading and trailing all-NA rows are removed. If a single series is selected, returns a single-column data frame.
rwl <- trs_pseudo_rwl(n_series = 5, series_length = 60, end_date = 2000) # Select single series trs_select(rwl, series = "trs_1") trs_select(rwl, series = "trs_2", rownames_to_years = TRUE) # Select multiple series trs_select(rwl, series = c("trs_1", "trs_2")) trs_select(rwl, series = c("trs_1", "trs_3", "trs_5"), rownames_to_years = TRUE)
rwl <- trs_pseudo_rwl(n_series = 5, series_length = 60, end_date = 2000) # Select single series trs_select(rwl, series = "trs_1") trs_select(rwl, series = "trs_2", rownames_to_years = TRUE) # Select multiple series trs_select(rwl, series = c("trs_1", "trs_2")) trs_select(rwl, series = c("trs_1", "trs_3", "trs_5"), rownames_to_years = TRUE)
This function computes crossdating t-statistics between all series in two datasets using the Baillie & Pilcher (1973) method. Series are standardized using a 5-year centered moving average and log-transformed before computing correlations and t-values.
trs_tbp(x, y = NULL, min_overlap = 50, as_df = FALSE, transform = TRUE)
trs_tbp(x, y = NULL, min_overlap = 50, as_df = FALSE, transform = TRUE)
x |
A data frame of test tree-ring series in |
y |
A data frame of reference tree-ring series in |
min_overlap |
Integer. Minimum number of overlapping years required between series pairs to compute t-values. Must be >= 3. Default is 50. |
as_df |
Logical. If |
transform |
Logical. If |
The Baillie & Pilcher method involves:
Alignment of series by common years
Application of 5-year centered moving average to each series
Log transformation:
Computation of Pearson correlation between transformed series
Calculation of t-statistic:
Where is the number of overlapping observations and is adjusted by
subtracting 4 to account for degrees of freedom lost in the moving average.
Negative correlations are set to 0, and perfect correlations (|r| = 1) result in infinite t-values.
Depending on as_df
parameter:
If as_df = FALSE
(default): A list containing:
t_BP
: Matrix of t-values with test series as rows, reference series as columns
overlap
: Matrix of overlap counts (number of common years) with same dimensions
If as_df = TRUE
: A data frame with columns:
series
: Name of test series
reference
: Name of reference series
t_BP
: Baillie & Pilcher t-value
overlap
: Number of overlapping years
Baillie, M.G.L. & Pilcher, J.R. (1973). A simple crossdating program for tree-ring research. Tree-Ring Bulletin, 33, 7–14.
trs_tbp_transform
for the transformation function
## Not run: # Create sample data rwl_test <- trs_pseudo_rwl(n_series = 3, series_length = 100, end_date = 2020) rwl_ref <- trs_pseudo_rwl(n_series = 2, series_length = 80, end_date = 2015) # Compute t-values (matrix format) result <- trs_tbp(rwl_test, rwl_ref, min_overlap = 30) print(result$t_BP) print(result$overlap) # Compute t-values (data frame format) result_df <- trs_tbp(rwl_test, rwl_ref, min_overlap = 30, as_df = TRUE) print(result_df) # Self-comparison within single dataset self_comparison <- trs_tbp(rwl_test, min_overlap = 40) ## End(Not run)
## Not run: # Create sample data rwl_test <- trs_pseudo_rwl(n_series = 3, series_length = 100, end_date = 2020) rwl_ref <- trs_pseudo_rwl(n_series = 2, series_length = 80, end_date = 2015) # Compute t-values (matrix format) result <- trs_tbp(rwl_test, rwl_ref, min_overlap = 30) print(result$t_BP) print(result$overlap) # Compute t-values (data frame format) result_df <- trs_tbp(rwl_test, rwl_ref, min_overlap = 30, as_df = TRUE) print(result_df) # Self-comparison within single dataset self_comparison <- trs_tbp(rwl_test, min_overlap = 40) ## End(Not run)
Applies a 5-year centered moving average and computes the log index:
log(100 * value / MA5)
. Uses edge mirroring to maintain
constant window size and avoid NA values.
trs_tbp_transform(x)
trs_tbp_transform(x)
x |
A rwl-style data frame. |
A matrix of log-transformed index values.
# Create sample data, trs <- trs_pseudo_rwl(n_series = 5, series_length = 100, end_date = c(2020, 2025)) transformed <- trs_tbp_transform(trs) head(transformed, 10)
# Create sample data, trs <- trs_pseudo_rwl(n_series = 5, series_length = 100, end_date = c(2020, 2025)) transformed <- trs_tbp_transform(trs) head(transformed, 10)
This function calculates Hollstein (1980) t-values for all pairwise comparisons between tree-ring series in two data frames, using log-transformed growth ratios. The method computes year-to-year growth ratios and applies correlation-based t-statistics for crossdating analysis.
trs_tho(x, y = NULL, min_overlap = 50, as_df = FALSE, transform = TRUE)
trs_tho(x, y = NULL, min_overlap = 50, as_df = FALSE, transform = TRUE)
x |
A data frame of test tree-ring series in |
y |
A data frame of reference tree-ring series in |
min_overlap |
Integer. Minimum number of overlapping years required between series pairs to compute t-values. Must be >= 3. Default is 50. |
as_df |
Logical. If |
transform |
Logical. If |
The Hollstein method involves:
Alignment of series by common years
Computation of log-transformed growth ratios:
Calculation of Pearson correlation between transformed series
Computation of t-statistic:
Where is the number of overlapping observations (original years, not growth ratios).
The degrees of freedom are adjusted by subtracting 3 to account for the growth ratio transformation.
Negative correlations are set to 0, and perfect correlations (|r| ≥ 1) result in infinite t-values to handle floating-point precision issues.
Depending on as_df
parameter:
If as_df = FALSE
(default): A list containing:
t_Ho
: Matrix of Hollstein t-values with test series as rows, reference series as columns
overlap
: Matrix of overlap counts (number of common years) with same dimensions
If as_df = TRUE
: A data frame with columns:
series
: Name of test series
reference
: Name of reference series
t_Ho
: Hollstein t-value
overlap
: Number of overlapping years
Hollstein, E. (1980). Mitteleuropäische Eichenchronologie. Verlag Philipp von Zabern, Mainz.
trs_tbp
for Baillie & Pilcher t-values
## Not run: # Create sample data rwl_test <- trs_pseudo_rwl(n_series = 3, series_length = 100, end_date = 2020) rwl_ref <- trs_pseudo_rwl(n_series = 2, series_length = 80, end_date = 2015) # Compute Hollstein t-values (matrix format) result <- trs_tho(rwl_test, rwl_ref, min_overlap = 30) print(result$t_Ho) print(result$overlap) # Compute t-values (data frame format) result_df <- trs_tho(rwl_test, rwl_ref, min_overlap = 30, as_df = TRUE) print(result_df) # Self-comparison within single dataset self_comparison <- trs_tho(rwl_test, min_overlap = 40) ## End(Not run)
## Not run: # Create sample data rwl_test <- trs_pseudo_rwl(n_series = 3, series_length = 100, end_date = 2020) rwl_ref <- trs_pseudo_rwl(n_series = 2, series_length = 80, end_date = 2015) # Compute Hollstein t-values (matrix format) result <- trs_tho(rwl_test, rwl_ref, min_overlap = 30) print(result$t_Ho) print(result$overlap) # Compute t-values (data frame format) result_df <- trs_tho(rwl_test, rwl_ref, min_overlap = 30, as_df = TRUE) print(result_df) # Self-comparison within single dataset self_comparison <- trs_tho(rwl_test, min_overlap = 40) ## End(Not run)
Computes log-transformed growth ratios for tree-ring series following
the Hollstein (1980) method: 100 * log10(value_t / value_(t-1))
.
This transformation emphasizes year-to-year growth variations.
trs_tho_transform(x)
trs_tho_transform(x)
x |
A rwl-style data frame with years as rownames and series as columns. All columns must be numeric. |
The Hollstein transformation computes year-to-year growth ratios:
where is the ring width at year
. This transformation:
Emphasizes relative changes between consecutive years
Reduces the influence of long-term trends
Makes series more suitable for crossdating analysis
Values that would result in undefined logarithms (zero or negative ratios) are set to NA. The first year of each series is always NA since no previous year exists for ratio calculation.
A matrix of log-transformed growth ratios with the same dimensions as the input. The first row (first year) is set to NA since no previous year exists for ratio calculation. Row names match the input data.
Hollstein, E. (1980). Mitteleuropäische Eichenchronologie. Verlag Philipp von Zabern, Mainz.
trs_tbp_transform
for Baillie & Pilcher transformation,
trs_tho
for computing Hollstein t-values
## Not run: # Create sample rwl data rwl_data <- trs_pseudo_rwl(n_series = 3, series_length = 50, end_date = 2020) # Apply Hollstein transformation transformed <- trs_tho_transform(rwl_data) # Check dimensions (should be one row fewer) nrow(rwl_data) # Original rows nrow(transformed) # One fewer row # View first few transformed values head(transformed) ## End(Not run)
## Not run: # Create sample rwl data rwl_data <- trs_pseudo_rwl(n_series = 3, series_length = 50, end_date = 2020) # Apply Hollstein transformation transformed <- trs_tho_transform(rwl_data) # Check dimensions (should be one row fewer) nrow(rwl_data) # Original rows nrow(transformed) # One fewer row # View first few transformed values head(transformed) ## End(Not run)
Removes rows at the beginning and end of a data.frame
of class "rwl"
that contain only missing values across all series.
trs_trim(x, rownames_to_years = FALSE)
trs_trim(x, rownames_to_years = FALSE)
x |
A |
rownames_to_years |
Logical. If |
A trimmed data.frame
with all leading and trailing all-NA rows removed. If rownames_to_years = TRUE
, a column year
is added.
x <- trs_pseudo_rwl(n_series = 3, series_length = 80, end_date = 1990) x[1:5, ] <- NA # Add leading NA rows x[81:85, ] <- NA # Add trailing NA rows dim(x) x_trim <- trs_trim(x) dim(x_trim) # With year column added head(trs_trim(x, rownames_to_years = TRUE))
x <- trs_pseudo_rwl(n_series = 3, series_length = 80, end_date = 1990) x[1:5, ] <- NA # Add leading NA rows x[81:85, ] <- NA # Add trailing NA rows dim(x) x_trim <- trs_trim(x) dim(x_trim) # With year column added head(trs_trim(x, rownames_to_years = TRUE))
This function computes correlation coefficients and their corresponding Student's t-statistics between all pairs of series from two tree-ring datasets.
trs_tSt(x, y = NULL, min_overlap = 30, as_df = FALSE)
trs_tSt(x, y = NULL, min_overlap = 30, as_df = FALSE)
x |
A data frame of test tree-ring series in |
y |
A data frame of reference tree-ring series in |
min_overlap |
Integer. Minimum number of overlapping years required between series pairs to compute statistics. Must be >= 3. Default is 30. |
as_df |
Logical. If |
The function computes Pearson correlation coefficients between all pairs of series from the two input datasets, then converts these to Student's t-statistics using the formula: t = r * sqrt(n-2) / sqrt(1-r²), where n is the number of overlapping observations.
A list containing:
Correlation coefficients between series pairs
Student's t-statistics
Number of overlapping years between series pairs
# Create sample data, trs <- trs_pseudo_rwl(n_series = 5, series_length = c(80, 100), end_date = c(2010, 2020)) trs_tSt(trs)$t_St
# Create sample data, trs <- trs_pseudo_rwl(n_series = 5, series_length = c(80, 100), end_date = c(2010, 2020)) trs_tSt(trs)$t_St
Converts each series (column) in an rwl-style data.frame
to z-scores by subtracting the mean and dividing by the standard deviation.
trs_zscore(x)
trs_zscore(x)
x |
A |
A data.frame
of the same dimensions as x
, with each column transformed to z-scores.
rwl <- trs_pseudo_rwl(n_series = 3, series_length = 50, end_date = 1990) z_rwl <- trs_zscore(rwl) apply(z_rwl, 2, mean, na.rm = TRUE) # should be ~0 apply(z_rwl, 2, sd, na.rm = TRUE) # should be ~1
rwl <- trs_pseudo_rwl(n_series = 3, series_length = 50, end_date = 1990) z_rwl <- trs_zscore(rwl) apply(z_rwl, 2, mean, na.rm = TRUE) # should be ~0 apply(z_rwl, 2, sd, na.rm = TRUE) # should be ~1
Sapwood data set for historical timbers found in the Netherlands en Belgium, with a local provenance. Unpublished data by S. van Daalen (version 19 Dec 2022, Van Daalen Dendrochronologie - <www.dendro.nl>).
vanDaalen_NLBE
vanDaalen_NLBE
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 644 observations
S. van Daalen, unpublished dataset (version: 19 Dec 2022).
sw_data_info("vanDaalen_NLBE") sw_model("vanDaalen_NLBE", plot = TRUE)
sw_data_info("vanDaalen_NLBE") sw_model("vanDaalen_NLBE", plot = TRUE)
Sapwood data set for historical timbers found in the Netherlands that were imported from Norway. Unpublished data by S. van Daalen (version 19 Dec 2022, Van Daalen Dendrochronologie - <www.dendro.nl>).
vanDaalen_Norway
vanDaalen_Norway
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 104 observations
S. van Daalen, unpublished dataset (version: 19 Dec 2022).
sw_data_info("vanDaalen_Norway") sw_model("vanDaalen_Norway", plot = TRUE)
sw_data_info("vanDaalen_Norway") sw_model("vanDaalen_Norway", plot = TRUE)
Sapwood data set for Poland, published by Wazny in 1990.
Wazny_1990
Wazny_1990
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 206 observations
Wazny T. 1990. Aufbau und Anwendung der Dendrochronologie für Eichenholz in Polen (PhD dissertation). Hamburg University, Hamburg.
sw_data_info("Wazny_1990") sw_model("Wazny_1990", plot = TRUE)
sw_data_info("Wazny_1990") sw_model("Wazny_1990", plot = TRUE)
Sapwood data set for the Brussels region in Belgium, published by Weitz et al. in 2025.
Weitz_2025
Weitz_2025
A tibble of 2 variables:
number of sapwood rings
number of times n_sapwood was observed
sample size = 443 observations
Weitz A., Haneca K. & Hoffsummer P. (in press): Estimating sapwood counts for historical oak timbers from Brussels, Belgium (13th-18th C), International Journal of Wood Culture.
sw_data_info("Weitz_2025") sw_model("Weitz_2025", plot = TRUE)
sw_data_info("Weitz_2025") sw_model("Weitz_2025", plot = TRUE)