Skip to contents

Detect points of sudden increase in Rate-of-Change values from the output of estimate_roc().

Usage

detect_peak_points(
  data_source,
  sel_method = c("trend_linear", "trend_non_linear", "threshold", "GAM_deriv", "SNI"),
  sd_threshold = 2
)

Arguments

data_source

tibble. Output of estimate_roc().

sel_method

character. Method to use for peak-point detection.

  • "threshold" - Each point is compared to the median of all RoC scores. A point is significant if its 95th-quantile RoC exceeds the median threshold.

  • "trend_linear" - A linear model is fitted between RoC values and their ages. A peak is significant if it is sd_threshold SD above the fitted value.

  • "trend_non_linear" - A conservative GAM (RoC ~ s(age, k = 3)) is fitted. A peak is significant if it is sd_threshold SD above the fitted value.

  • "GAM_deriv" - A smooth GAM (RoC ~ s(age)) is fitted and the first derivative evaluated using the gratia package (Simpson, 2018). A peak is significant if the confidence interval of the first derivative excludes zero.

  • "SNI" - Signal-to-noise index adapted from Kelly et al. (2011). A peak is significant if SNI > 3.

sd_threshold

numeric. Number of standard deviations above the trend required for a point to be classified as a peak (default = 2). Used by "trend_linear" and "trend_non_linear".

Value

The input tibble with an additional logical column Peak that is TRUE for samples identified as significant peak points.

References

Kelly, R.F., Higuera, P.E., Barrett, C.M., Feng Sheng, H., 2011. A signal-to-noise index to quantify the potential for peak detection in sediment-charcoal records. Quat. Res. 75, 11-17.

Simpson, G.L., 2018. Modelling palaeoecological time series using generalised additive models. Front. Ecol. Evol. 6, 1-21.

Wood, S.N., 2011. Fast stable restricted maximum likelihood and marginal likelihood estimation of semiparametric generalized linear models. J. R. Stat. Soc. Ser. B Stat. Methodol. 73, 3-36.

Examples

if (FALSE) { # \dontrun{
data("example_data", package = "RRatepol")

sequence_01 <-
  estimate_roc(
    data_source_community = example_data$pollen_data[[1]],
    data_source_age = example_data$sample_age[[1]],
    smooth_method = "shep",
    working_units = "MW",
    rand = 1e3,
    use_parallel = TRUE,
    dissimilarity_coefficient = "chisq"
  )

sequence_01_peak <-
  detect_peak_points(
    sequence_01,
    sel_method = "trend_non_linear",
    sd_threshold = 2
  )

plot_roc(
  sequence_01_peak,
  age_threshold = 8e3,
  roc_threshold = 2,
  peaks = TRUE,
  trend = "trend_non_linear"
)
} # }