Function to find 95% highest density region (HDR) for a provided shoreline date. Negative values denote years BCE while positive values denote CE.
shoredate_hdr(bce, probability, site_name, cal_reso, prob = 0.95)
A vector holding calendar years associated with a date.
A vector holding the probability mass corresponding to each calendar year.
A vector holding the name of the site that has been dated.
Resolution on the calendar scale used when dating the site.
A numerical value between 0 and 1 indicating the probability
coverage of the HDR. Defaults to 0.95
.
A list holding start and end points for segments of the highest density region of a shoreline date, the weighted mean date, the probability coverage and site name.
target_point <- sf::st_sfc(sf::st_point(c(538310, 6544255)), crs = 32632)
# Reduce date resolution with cal_reso and elevation_reso for speed
target_date <- shoreline_date(sites = target_point,
elevation = 80,
elev_reso = 1,
cal_reso = 400)
# shoredate_hdr() is already called under the hood with shoreline_date(),
# the result of which is printed when calling the shoreline_date object
target_date
#> ===============
#> Site: 1
#> Elevation: 80
#>
#> 95% HDR:
#> 8850 BCE-7250 BCE
# However, shoredate_hdr() can be applied separately by pulling the
# necessary data from the date
(shoredate_hdr(target_date[[1]][[1]]$date$bce,
target_date[[1]][[1]]$date$probability,
target_date[[1]][[1]]$site_name,
target_date[[1]][[1]]$cal_reso))
#> $start
#> [1] -8850
#>
#> $end
#> [1] -7250
#>
#> $prob
#> [1] 0.95
#>
#> $site_name
#> [1] "1"
#>
#> $weighted_mean
#> [1] -8321.197
#>