
Computes statistics to describe parallel variations between two rwl-style data frames
Source:R/trs_pv.R
trs_pv.Rd
Compares tree-ring series in two data frames using Gleichläufigkeit (GLK) and
Synchronous Growth Changes (SGC), adapted from the dplR
package.
Arguments
- x
A data frame of test tree-ring series (
rwl
format: years in rows, series in columns).- y
A data frame of reference series (
rwl
format).- 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.
Value
If as_df = FALSE
, a list with components:
- glk
Matrix of Gleichläufigkeit values.
- glk_p
Matrix of GLK p-values (if
prob = TRUE
).- sgc
Matrix of synchronous growth change values.
- ssgc
Matrix of semi-synchronous growth change values.
- sgc_p
Matrix of SGC p-values (if
prob = TRUE
).- overlap
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
.
Examples
# Create sample data,
trs <- trs_pseudo_rwl(n_series = 5, series_length = c(80, 100), end_date = c(2010, 2020))
trs_pv(trs)$sgc
#> trs_1 trs_2 trs_3 trs_4 trs_5
#> trs_1 100.0 81.5 71.0 79.6 78.7
#> trs_2 81.5 100.0 71.0 75.0 75.3
#> trs_3 71.0 71.0 100.0 70.2 75.3
#> trs_4 79.6 75.0 70.2 100.0 79.8
#> trs_5 78.7 75.3 75.3 79.8 100.0