Title: | Post-Processing of Markov Chain Monte Carlo Simulations for Chronological Modelling |
---|---|
Description: | Statistical analysis of archaeological dates and groups of dates. This package allows to post-process Markov Chain Monte Carlo (MCMC) simulations from 'ChronoModel' <https://chronomodel.com/>, 'Oxcal' <https://c14.arch.ox.ac.uk/oxcal.html> or 'BCal' <https://bcal.shef.ac.uk/>. It provides functions for the study of rhythms of the long term from the posterior distribution of a series of dates (tempo and activity plot). It also allows the estimation and visualization of time ranges from the posterior distribution of groups of dates (e.g. duration, transition and hiatus between successive phases) as described in Philippe and Vibet (2020) <doi:10.18637/jss.v093.c01>. |
Authors: | Anne Philippe [aut, cre] , Marie-Anne Vibet [aut] , Thomas S. Dye [ctb] , Nicolas Frerebeau [aut] |
Maintainer: | Anne Philippe <[email protected]> |
License: | GPL (>= 3) |
Version: | 2.0 |
Built: | 2024-12-05 06:28:51 UTC |
Source: | https://github.com/ArchaeoStat/ArchaeoPhases |
Plots the first derivative of the tempo
plot Bayesian estimate.
activity(object, ...) ## S4 method for signature 'EventsMCMC' activity( object, from = min(object), to = max(object), grid = getOption("ArchaeoPhases.grid") ) ## S4 method for signature 'CumulativeEvents' activity(object) ## S4 method for signature 'ActivityEvents,missing' plot( x, calendar = getOption("ArchaeoPhases.calendar"), main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... )
activity(object, ...) ## S4 method for signature 'EventsMCMC' activity( object, from = min(object), to = max(object), grid = getOption("ArchaeoPhases.grid") ) ## S4 method for signature 'CumulativeEvents' activity(object) ## S4 method for signature 'ActivityEvents,missing' plot( x, calendar = getOption("ArchaeoPhases.calendar"), main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... )
object |
An |
... |
Other graphical parameters may also be passed as
arguments to this function, particularly, |
from |
A length-one |
to |
A length-one |
grid |
A length-one |
x |
An |
calendar |
A |
main |
A |
sub |
A |
ann |
A |
axes |
A |
frame.plot |
A |
panel.first |
An an |
panel.last |
An |
activity()
returns an ActivityEvents
object.
plot()
is called it for its side-effects: it results in a graphic being
displayed (invisibly returns x
).
A. Philippe, M.-A. Vibet, T. S. Dye, N. Frerebeau
Dye, T. S. (2016). Long-term rhythms in the development of Hawaiian social stratification. Journal of Archaeological Science, 71: 1-9. doi:10.1016/j.jas.2016.05.006.
Other event tools:
elapse()
,
occurrence()
,
tempo()
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Tempo plot tmp <- tempo(eve) plot(tmp) plot(tmp, interval = "credible", panel.first = grid()) plot(tmp, interval = "gauss", panel.first = grid()) ## Activity plot act <- activity(tmp) plot(act, panel.first = grid())
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Tempo plot tmp <- tempo(eve) plot(tmp) plot(tmp, interval = "credible", panel.first = grid()) plot(tmp, interval = "gauss", panel.first = grid()) ## Activity plot act <- activity(tmp) plot(act, panel.first = grid())
Visualize composite Allen relations with a Nokel lattice.
allen_analyze(x, y, ...)
allen_analyze(x, y, ...)
x , y
|
A |
... |
Further arguments to be passed to internal methods. |
allen_analyze()
is called it for its side-effects: it results in a
graphic being displayed.
T. S. Dye
Other Allen's intervals:
allen_complement()
,
allen_composition()
,
allen_converse()
,
allen_illustrate()
,
allen_intersect()
,
allen_joint_concurrency()
,
allen_observe()
,
allen_observe_frequency()
,
allen_relation()
,
allen_relation_code()
,
allen_union()
allen_analyze("mDFo", "MdfO", main = "Composite reticulation relation")
allen_analyze("mDFo", "MdfO", main = "Composite reticulation relation")
Complement of an Allen Relation
allen_complement(x, ...) ## S4 method for signature 'character' allen_complement(x) ## S4 method for signature 'matrix' allen_complement(x)
allen_complement(x, ...) ## S4 method for signature 'character' allen_complement(x) ## S4 method for signature 'matrix' allen_complement(x)
x |
A |
... |
Currently not used. |
A character
vector or matrix (same as x
).
T. S. Dye, N. Frerebeau
Allen, J. F. (1983). Maintaining Knowledge about Temporal Intervals. Communications of the ACM, 26(11): 832-843. doi:10.1145/182.358434.
Other Allen's intervals:
allen_analyze()
,
allen_composition()
,
allen_converse()
,
allen_illustrate()
,
allen_intersect()
,
allen_joint_concurrency()
,
allen_observe()
,
allen_observe_frequency()
,
allen_relation()
,
allen_relation_code()
,
allen_union()
## Data from Husi 2022 loire <- data.frame( lower = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), upper = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425) ) ## Basic relations allen_relation(loire$lower, loire$upper) ## Complement (comp <- allen_complement("F")) # "pmoDseSdfOMP" ## Converse (conv <- allen_converse(comp)) # "pmoFDseSdOMP" ## Composition allen_composition("oFD", "oFDseS") # "pmoFD" ## Intersection allen_intersect("pFsSf", "pmoFD") # "pF" # Union allen_union("pFsSf", "pmoFD") # "pmoFDsSf"
## Data from Husi 2022 loire <- data.frame( lower = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), upper = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425) ) ## Basic relations allen_relation(loire$lower, loire$upper) ## Complement (comp <- allen_complement("F")) # "pmoDseSdfOMP" ## Converse (conv <- allen_converse(comp)) # "pmoFDseSdOMP" ## Composition allen_composition("oFD", "oFDseS") # "pmoFD" ## Intersection allen_intersect("pFsSf", "pmoFD") # "pF" # Union allen_union("pFsSf", "pmoFD") # "pmoFDsSf"
Composition of Allen Relations
allen_composition(x, y, ...) ## S4 method for signature 'character,character' allen_composition(x, y)
allen_composition(x, y, ...) ## S4 method for signature 'character,character' allen_composition(x, y)
x , y
|
A |
... |
Currently not used. |
A character
vector.
T. S. Dye, N. Frerebeau
Allen, J. F. (1983). Maintaining Knowledge about Temporal Intervals. Communications of the ACM, 26(11): 832-843. doi:10.1145/182.358434.
Other Allen's intervals:
allen_analyze()
,
allen_complement()
,
allen_converse()
,
allen_illustrate()
,
allen_intersect()
,
allen_joint_concurrency()
,
allen_observe()
,
allen_observe_frequency()
,
allen_relation()
,
allen_relation_code()
,
allen_union()
## Data from Husi 2022 loire <- data.frame( lower = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), upper = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425) ) ## Basic relations allen_relation(loire$lower, loire$upper) ## Complement (comp <- allen_complement("F")) # "pmoDseSdfOMP" ## Converse (conv <- allen_converse(comp)) # "pmoFDseSdOMP" ## Composition allen_composition("oFD", "oFDseS") # "pmoFD" ## Intersection allen_intersect("pFsSf", "pmoFD") # "pF" # Union allen_union("pFsSf", "pmoFD") # "pmoFDsSf"
## Data from Husi 2022 loire <- data.frame( lower = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), upper = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425) ) ## Basic relations allen_relation(loire$lower, loire$upper) ## Complement (comp <- allen_complement("F")) # "pmoDseSdfOMP" ## Converse (conv <- allen_converse(comp)) # "pmoFDseSdOMP" ## Composition allen_composition("oFD", "oFDseS") # "pmoFD" ## Intersection allen_intersect("pFsSf", "pmoFD") # "pF" # Union allen_union("pFsSf", "pmoFD") # "pmoFDsSf"
Converse of an Allen Relation
allen_converse(x, ...) ## S4 method for signature 'character' allen_converse(x) ## S4 method for signature 'matrix' allen_converse(x)
allen_converse(x, ...) ## S4 method for signature 'character' allen_converse(x) ## S4 method for signature 'matrix' allen_converse(x)
x |
A |
... |
Currently not used. |
A character
vector or matrix (same as x
).
T. S. Dye, N. Frerebeau
Allen, J. F. (1983). Maintaining Knowledge about Temporal Intervals. Communications of the ACM, 26(11): 832-843. doi:10.1145/182.358434.
Other Allen's intervals:
allen_analyze()
,
allen_complement()
,
allen_composition()
,
allen_illustrate()
,
allen_intersect()
,
allen_joint_concurrency()
,
allen_observe()
,
allen_observe_frequency()
,
allen_relation()
,
allen_relation_code()
,
allen_union()
## Data from Husi 2022 loire <- data.frame( lower = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), upper = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425) ) ## Basic relations allen_relation(loire$lower, loire$upper) ## Complement (comp <- allen_complement("F")) # "pmoDseSdfOMP" ## Converse (conv <- allen_converse(comp)) # "pmoFDseSdOMP" ## Composition allen_composition("oFD", "oFDseS") # "pmoFD" ## Intersection allen_intersect("pFsSf", "pmoFD") # "pF" # Union allen_union("pFsSf", "pmoFD") # "pmoFDsSf"
## Data from Husi 2022 loire <- data.frame( lower = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), upper = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425) ) ## Basic relations allen_relation(loire$lower, loire$upper) ## Complement (comp <- allen_complement("F")) # "pmoDseSdfOMP" ## Converse (conv <- allen_converse(comp)) # "pmoFDseSdOMP" ## Composition allen_composition("oFD", "oFDseS") # "pmoFD" ## Intersection allen_intersect("pFsSf", "pmoFD") # "pF" # Union allen_union("pFsSf", "pmoFD") # "pmoFDsSf"
Illustrate Basic and Composite Allen Relations
allen_illustrate(relations = "basic", ...)
allen_illustrate(relations = "basic", ...)
relations |
A |
... |
Further arguments to be passed to internal methods. |
Illustrate basic and composite Allen relations for several chronological model domains with a Nokel lattice. Chronological model domains include stratigraphy and branching, transformative, and reticulate processes of artifact change.
The illustrative graphics include:
basic
the 13 basic Allen relations (default);
concurrent
concurrent relations;
distinct
relations with distinct endpoints;
stratigraphic
basic relations established by an observation of superposition;
branching
basic branching relations;
transformation
basic relations of transformation;
reticulation
basic relations of reticulation;
sequence
composite relations in a stratigraphic sequence;
branch
composite relations of branching;
transform
composite relations of transformation; or
reticulate
composite relations of reticulation.
allen_illustrate()
is called it for its side-effects: it results in a
graphic being displayed.
T. S. Dye
Harris, E. C. (1997). Principles of Archaeological Stratigraphy. Second edition. London: Academic Press.
Lyman, R. L. and O'Brien, M. J. (2017). "Sedation and Cladistics: The Difference between Anagenetic and Cladogenetic Evolution". In Mapping Our Ancestors: Phylogenetic Approaches in Anthropology and Prehistory, edited by Lipo, C. P., O'Brien, M. J., Couard, M., and Shennan, S. J. New York: Routledge. doi:10.4324/9780203786376.
Viola, T. (2020). Peirce on the Uses of History. De Gruyter. doi:10.1515/9783110651560. See chapter 3, "Historicity as Process", especially p. 83-88.
Other Allen's intervals:
allen_analyze()
,
allen_complement()
,
allen_composition()
,
allen_converse()
,
allen_intersect()
,
allen_joint_concurrency()
,
allen_observe()
,
allen_observe_frequency()
,
allen_relation()
,
allen_relation_code()
,
allen_union()
## Plot the basic Allen relations allen_illustrate()
## Plot the basic Allen relations allen_illustrate()
Intersection of Allen Relations
allen_intersect(x, y, ...) ## S4 method for signature 'character,character' allen_intersect(x, y)
allen_intersect(x, y, ...) ## S4 method for signature 'character,character' allen_intersect(x, y)
x , y
|
A |
... |
Currently not used. |
A character
vector.
T. S. Dye, N. Frerebeau
Allen, J. F. (1983). Maintaining Knowledge about Temporal Intervals. Communications of the ACM, 26(11): 832-843. doi:10.1145/182.358434.
Other Allen's intervals:
allen_analyze()
,
allen_complement()
,
allen_composition()
,
allen_converse()
,
allen_illustrate()
,
allen_joint_concurrency()
,
allen_observe()
,
allen_observe_frequency()
,
allen_relation()
,
allen_relation_code()
,
allen_union()
## Data from Husi 2022 loire <- data.frame( lower = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), upper = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425) ) ## Basic relations allen_relation(loire$lower, loire$upper) ## Complement (comp <- allen_complement("F")) # "pmoDseSdfOMP" ## Converse (conv <- allen_converse(comp)) # "pmoFDseSdOMP" ## Composition allen_composition("oFD", "oFDseS") # "pmoFD" ## Intersection allen_intersect("pFsSf", "pmoFD") # "pF" # Union allen_union("pFsSf", "pmoFD") # "pmoFDsSf"
## Data from Husi 2022 loire <- data.frame( lower = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), upper = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425) ) ## Basic relations allen_relation(loire$lower, loire$upper) ## Complement (comp <- allen_complement("F")) # "pmoDseSdfOMP" ## Converse (conv <- allen_converse(comp)) # "pmoFDseSdOMP" ## Composition allen_composition("oFD", "oFDseS") # "pmoFD" ## Intersection allen_intersect("pFsSf", "pmoFD") # "pF" # Union allen_union("pFsSf", "pmoFD") # "pmoFDsSf"
Estimates the age of an undated context based on the known depositional history of associated artifacts.
allen_joint_concurrency(x, groups, ...) ## S4 method for signature 'EventsMCMC,list' allen_joint_concurrency(x, groups, ...)
allen_joint_concurrency(x, groups, ...) ## S4 method for signature 'EventsMCMC,list' allen_joint_concurrency(x, groups, ...)
x |
An |
groups |
A |
... |
Currently not used. |
A PhasesMCMC
object.
T. S. Dye
Other Allen's intervals:
allen_analyze()
,
allen_complement()
,
allen_composition()
,
allen_converse()
,
allen_illustrate()
,
allen_intersect()
,
allen_observe()
,
allen_observe_frequency()
,
allen_relation()
,
allen_relation_code()
,
allen_union()
Plots an empirical Nökel lattice.
allen_observe(x, groups, ...) ## S4 method for signature 'PhasesMCMC,missing' allen_observe(x, converse = TRUE, ...) ## S4 method for signature 'EventsMCMC,list' allen_observe(x, groups, converse = TRUE, ...)
allen_observe(x, groups, ...) ## S4 method for signature 'PhasesMCMC,missing' allen_observe(x, converse = TRUE, ...) ## S4 method for signature 'EventsMCMC,list' allen_observe(x, groups, converse = TRUE, ...)
x |
An |
groups |
A |
... |
Further arguments to be passed to internal methods. |
converse |
A |
allen_observe()
is called it for its side-effects: it results in a graphic
being displayed (invisibly returns x
).
T. S. Dye, N. Frerebeau
Other Allen's intervals:
allen_analyze()
,
allen_complement()
,
allen_composition()
,
allen_converse()
,
allen_illustrate()
,
allen_intersect()
,
allen_joint_concurrency()
,
allen_observe_frequency()
,
allen_relation()
,
allen_relation_code()
,
allen_union()
if (requireNamespace("ArchaeoData", quietly = TRUE)) { ## Load the Anglo Saxon burials dataset path <- system.file("oxcal/burials.csv", package = "ArchaeoData") burials <- read.table(path, header = TRUE, sep = ",", dec = ".", check.names = FALSE) ## Coerce to event burials <- as_events(burials, calendar = CE()) ## Dates associated with bead BE3 Amber be3_amber <- c( "UB-4836 (WG27)", "UB-5208 (ApD107)", "UB-4965 (ApD117)", "UB-4735 (Ber022)", "UB-4739 (Ber134/1)", "UB-4728 (MH064)", "UB-4729 (MH068)", "UB-4732 (MH094)", "UB-4733 (MH095)", "UB-4734 (MH105c)", "UB-4984 (Lec018)", "UB-4709 (EH014)", "UB-4707 (EH079)", "UB-4708 (EH083)", "UB-6033 (WHes113)", "UB-4706 (WHes118)", "UB-4705 (WHes123)", "UB-6040 (CasD053)", "UB-6037 (CasD134)", "UB-6472 (BuD222)", "UB-6473 (BuD250)", "UB-6476 (BuD339)", "UB-4963 (SPTip208)", "UB-4890 (MelSG075)", "UB-4887 (MelSG082)", "UB-4888 (MelSG089)", "MaDE1 & E2", "UB-4552 (MaDE3)", "UB-4975 (AstCli12)", "UB-4835 (ApD134)", "SUERC-39108 ERLK G322", "SUERC-39109 ERL G362", "SUERC-39112 ERL G405", "SUERC-51560 ERL G038", "SUERC-39091 (ERL G003)", "SUERC-39092 (ERL G005)", "SUERC-39113 (ERL G417)", "SUERC-51549 (ERL G195)", "SUERC-51552 (ERL G107)", "SUERC-51550 (ERL G254)" ) ## Dates associated with bead BE1 Dghnt be1_dghnt <- c( "UB-4503 (Lec148)", "UB-4506 (Lec172/2)", "UB-6038 (CasD183)", "UB-4512 (EH091)", "UB-4501 (Lec014)", "UB-4507 (Lec187)", "UB-4502 (Lec138)", "UB-4042 (But1674)", "SUERC-39100 (ERL G266)" ) ## Construct a list of lists chains <- list( list("BE3-Amber" = be3_amber, "BE1-Dghnt" = be1_dghnt), list("BE1-Dghnt" = be1_dghnt, "BE3-Amber" = be3_amber) ) ## Plot allen_observe(x = burials, groups = chains) ## Observe 2x2 frequency matrix of the relation of trunk to branch allen_observe_frequency(burials, groups = chains, set = "oFD") }
if (requireNamespace("ArchaeoData", quietly = TRUE)) { ## Load the Anglo Saxon burials dataset path <- system.file("oxcal/burials.csv", package = "ArchaeoData") burials <- read.table(path, header = TRUE, sep = ",", dec = ".", check.names = FALSE) ## Coerce to event burials <- as_events(burials, calendar = CE()) ## Dates associated with bead BE3 Amber be3_amber <- c( "UB-4836 (WG27)", "UB-5208 (ApD107)", "UB-4965 (ApD117)", "UB-4735 (Ber022)", "UB-4739 (Ber134/1)", "UB-4728 (MH064)", "UB-4729 (MH068)", "UB-4732 (MH094)", "UB-4733 (MH095)", "UB-4734 (MH105c)", "UB-4984 (Lec018)", "UB-4709 (EH014)", "UB-4707 (EH079)", "UB-4708 (EH083)", "UB-6033 (WHes113)", "UB-4706 (WHes118)", "UB-4705 (WHes123)", "UB-6040 (CasD053)", "UB-6037 (CasD134)", "UB-6472 (BuD222)", "UB-6473 (BuD250)", "UB-6476 (BuD339)", "UB-4963 (SPTip208)", "UB-4890 (MelSG075)", "UB-4887 (MelSG082)", "UB-4888 (MelSG089)", "MaDE1 & E2", "UB-4552 (MaDE3)", "UB-4975 (AstCli12)", "UB-4835 (ApD134)", "SUERC-39108 ERLK G322", "SUERC-39109 ERL G362", "SUERC-39112 ERL G405", "SUERC-51560 ERL G038", "SUERC-39091 (ERL G003)", "SUERC-39092 (ERL G005)", "SUERC-39113 (ERL G417)", "SUERC-51549 (ERL G195)", "SUERC-51552 (ERL G107)", "SUERC-51550 (ERL G254)" ) ## Dates associated with bead BE1 Dghnt be1_dghnt <- c( "UB-4503 (Lec148)", "UB-4506 (Lec172/2)", "UB-6038 (CasD183)", "UB-4512 (EH091)", "UB-4501 (Lec014)", "UB-4507 (Lec187)", "UB-4502 (Lec138)", "UB-4042 (But1674)", "SUERC-39100 (ERL G266)" ) ## Construct a list of lists chains <- list( list("BE3-Amber" = be3_amber, "BE1-Dghnt" = be1_dghnt), list("BE1-Dghnt" = be1_dghnt, "BE3-Amber" = be3_amber) ) ## Plot allen_observe(x = burials, groups = chains) ## Observe 2x2 frequency matrix of the relation of trunk to branch allen_observe_frequency(burials, groups = chains, set = "oFD") }
Creates a matrix of observed frequencies of a given Allen set among two or more groups of chains from the MCMC output of a Bayesian calibration.
allen_observe_frequency(x, groups, ...) ## S4 method for signature 'PhasesMCMC,missing' allen_observe_frequency(x, set) ## S4 method for signature 'EventsMCMC,list' allen_observe_frequency(x, groups, ...)
allen_observe_frequency(x, groups, ...) ## S4 method for signature 'PhasesMCMC,missing' allen_observe_frequency(x, set) ## S4 method for signature 'EventsMCMC,list' allen_observe_frequency(x, groups, ...)
x |
An |
groups |
A |
... |
Currently not used. |
set |
A |
A square matrix
of observed frequencies.
T. S. Dye, N. Frerebeau
Other Allen's intervals:
allen_analyze()
,
allen_complement()
,
allen_composition()
,
allen_converse()
,
allen_illustrate()
,
allen_intersect()
,
allen_joint_concurrency()
,
allen_observe()
,
allen_relation()
,
allen_relation_code()
,
allen_union()
if (requireNamespace("ArchaeoData", quietly = TRUE)) { ## Load the Anglo Saxon burials dataset path <- system.file("oxcal/burials.csv", package = "ArchaeoData") burials <- read.table(path, header = TRUE, sep = ",", dec = ".", check.names = FALSE) ## Coerce to event burials <- as_events(burials, calendar = CE()) ## Dates associated with bead BE3 Amber be3_amber <- c( "UB-4836 (WG27)", "UB-5208 (ApD107)", "UB-4965 (ApD117)", "UB-4735 (Ber022)", "UB-4739 (Ber134/1)", "UB-4728 (MH064)", "UB-4729 (MH068)", "UB-4732 (MH094)", "UB-4733 (MH095)", "UB-4734 (MH105c)", "UB-4984 (Lec018)", "UB-4709 (EH014)", "UB-4707 (EH079)", "UB-4708 (EH083)", "UB-6033 (WHes113)", "UB-4706 (WHes118)", "UB-4705 (WHes123)", "UB-6040 (CasD053)", "UB-6037 (CasD134)", "UB-6472 (BuD222)", "UB-6473 (BuD250)", "UB-6476 (BuD339)", "UB-4963 (SPTip208)", "UB-4890 (MelSG075)", "UB-4887 (MelSG082)", "UB-4888 (MelSG089)", "MaDE1 & E2", "UB-4552 (MaDE3)", "UB-4975 (AstCli12)", "UB-4835 (ApD134)", "SUERC-39108 ERLK G322", "SUERC-39109 ERL G362", "SUERC-39112 ERL G405", "SUERC-51560 ERL G038", "SUERC-39091 (ERL G003)", "SUERC-39092 (ERL G005)", "SUERC-39113 (ERL G417)", "SUERC-51549 (ERL G195)", "SUERC-51552 (ERL G107)", "SUERC-51550 (ERL G254)" ) ## Dates associated with bead BE1 Dghnt be1_dghnt <- c( "UB-4503 (Lec148)", "UB-4506 (Lec172/2)", "UB-6038 (CasD183)", "UB-4512 (EH091)", "UB-4501 (Lec014)", "UB-4507 (Lec187)", "UB-4502 (Lec138)", "UB-4042 (But1674)", "SUERC-39100 (ERL G266)" ) ## Construct a list of lists chains <- list( list("BE3-Amber" = be3_amber, "BE1-Dghnt" = be1_dghnt), list("BE1-Dghnt" = be1_dghnt, "BE3-Amber" = be3_amber) ) ## Plot allen_observe(x = burials, groups = chains) ## Observe 2x2 frequency matrix of the relation of trunk to branch allen_observe_frequency(burials, groups = chains, set = "oFD") }
if (requireNamespace("ArchaeoData", quietly = TRUE)) { ## Load the Anglo Saxon burials dataset path <- system.file("oxcal/burials.csv", package = "ArchaeoData") burials <- read.table(path, header = TRUE, sep = ",", dec = ".", check.names = FALSE) ## Coerce to event burials <- as_events(burials, calendar = CE()) ## Dates associated with bead BE3 Amber be3_amber <- c( "UB-4836 (WG27)", "UB-5208 (ApD107)", "UB-4965 (ApD117)", "UB-4735 (Ber022)", "UB-4739 (Ber134/1)", "UB-4728 (MH064)", "UB-4729 (MH068)", "UB-4732 (MH094)", "UB-4733 (MH095)", "UB-4734 (MH105c)", "UB-4984 (Lec018)", "UB-4709 (EH014)", "UB-4707 (EH079)", "UB-4708 (EH083)", "UB-6033 (WHes113)", "UB-4706 (WHes118)", "UB-4705 (WHes123)", "UB-6040 (CasD053)", "UB-6037 (CasD134)", "UB-6472 (BuD222)", "UB-6473 (BuD250)", "UB-6476 (BuD339)", "UB-4963 (SPTip208)", "UB-4890 (MelSG075)", "UB-4887 (MelSG082)", "UB-4888 (MelSG089)", "MaDE1 & E2", "UB-4552 (MaDE3)", "UB-4975 (AstCli12)", "UB-4835 (ApD134)", "SUERC-39108 ERLK G322", "SUERC-39109 ERL G362", "SUERC-39112 ERL G405", "SUERC-51560 ERL G038", "SUERC-39091 (ERL G003)", "SUERC-39092 (ERL G005)", "SUERC-39113 (ERL G417)", "SUERC-51549 (ERL G195)", "SUERC-51552 (ERL G107)", "SUERC-51550 (ERL G254)" ) ## Dates associated with bead BE1 Dghnt be1_dghnt <- c( "UB-4503 (Lec148)", "UB-4506 (Lec172/2)", "UB-6038 (CasD183)", "UB-4512 (EH091)", "UB-4501 (Lec014)", "UB-4507 (Lec187)", "UB-4502 (Lec138)", "UB-4042 (But1674)", "SUERC-39100 (ERL G266)" ) ## Construct a list of lists chains <- list( list("BE3-Amber" = be3_amber, "BE1-Dghnt" = be1_dghnt), list("BE1-Dghnt" = be1_dghnt, "BE3-Amber" = be3_amber) ) ## Plot allen_observe(x = burials, groups = chains) ## Observe 2x2 frequency matrix of the relation of trunk to branch allen_observe_frequency(burials, groups = chains, set = "oFD") }
Allen Relation Between Definite Intervals
allen_relation(x, y, ...) ## S4 method for signature 'numeric,numeric' allen_relation(x, y) ## S4 method for signature 'ANY,missing' allen_relation(x)
allen_relation(x, y, ...) ## S4 method for signature 'numeric,numeric' allen_relation(x, y) ## S4 method for signature 'ANY,missing' allen_relation(x)
x , y
|
A |
... |
Currently not used. |
Relation | Converse | ||
precedes | (p) | (P) | preceded by |
meets | (m) | (M) | met by |
overlaps | (o) | (O) | overlapped by |
finished by | (F) | (f) | finishes |
contains | (D) | (d) | during |
starts | (s) | (S) | started by |
equals | (e) | ||
A character
matrix specifying the Allen relations.
T. S. Dye, N. Frerebeau
Allen, J. F. (1983). Maintaining Knowledge about Temporal Intervals. Communications of the ACM, 26(11): 832-843. doi:10.1145/182.358434.
Alspaugh, T. (2019). Allen's Interval Algebra. URL: https://thomasalspaugh.org/pub/fnd/allen.html.
Other Allen's intervals:
allen_analyze()
,
allen_complement()
,
allen_composition()
,
allen_converse()
,
allen_illustrate()
,
allen_intersect()
,
allen_joint_concurrency()
,
allen_observe()
,
allen_observe_frequency()
,
allen_relation_code()
,
allen_union()
## Data from Husi 2022 loire <- data.frame( lower = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), upper = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425) ) ## Basic relations allen_relation(loire$lower, loire$upper) ## Complement (comp <- allen_complement("F")) # "pmoDseSdfOMP" ## Converse (conv <- allen_converse(comp)) # "pmoFDseSdOMP" ## Composition allen_composition("oFD", "oFDseS") # "pmoFD" ## Intersection allen_intersect("pFsSf", "pmoFD") # "pF" # Union allen_union("pFsSf", "pmoFD") # "pmoFDsSf"
## Data from Husi 2022 loire <- data.frame( lower = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), upper = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425) ) ## Basic relations allen_relation(loire$lower, loire$upper) ## Complement (comp <- allen_complement("F")) # "pmoDseSdfOMP" ## Converse (conv <- allen_converse(comp)) # "pmoFDseSdOMP" ## Composition allen_composition("oFD", "oFDseS") # "pmoFD" ## Intersection allen_intersect("pFsSf", "pmoFD") # "pF" # Union allen_union("pFsSf", "pmoFD") # "pmoFDsSf"
The Basic Allen Relation Set
allen_relation_code(...) allen_relation_string(...) allen_relation_concurrent(...) allen_relation_distinct(...)
allen_relation_code(...) allen_relation_string(...) allen_relation_concurrent(...) allen_relation_distinct(...)
... |
Currently not used. |
allen_relation_code()
returns a character
vector of one-letter codes
for the thirteen basic Allen relations.
allen_relation_string()
returns a character
vector of string
descriptors of the Allen basic relations.
allen_relation_concurrent()
returns a character
vector of nine
one-letter codes for the Allen concurrent relations.
allen_relation_distinct()
returns the six value Allen relation set for
intervals with distinct endpoints.
The codes were proposed by Thomas Alspaugh.
T. S. Dye
Allen, J. F. (1983). Maintaining Knowledge about Temporal Intervals. Communications of the ACM, 26(11): 832-843. doi:10.1145/182.358434.
Alspaugh, T. (2019). Allen's Interval Algebra. URL: https://thomasalspaugh.org/pub/fnd/allen.html.
Other Allen's intervals:
allen_analyze()
,
allen_complement()
,
allen_composition()
,
allen_converse()
,
allen_illustrate()
,
allen_intersect()
,
allen_joint_concurrency()
,
allen_observe()
,
allen_observe_frequency()
,
allen_relation()
,
allen_union()
Union of Allen Relations
allen_union(x, y, ...) ## S4 method for signature 'character,character' allen_union(x, y)
allen_union(x, y, ...) ## S4 method for signature 'character,character' allen_union(x, y)
x , y
|
A |
... |
Currently not used. |
A character
vector.
T. S. Dye, N. Frerebeau
Allen, J. F. (1983). Maintaining Knowledge about Temporal Intervals. Communications of the ACM, 26(11): 832-843. doi:10.1145/182.358434.
Other Allen's intervals:
allen_analyze()
,
allen_complement()
,
allen_composition()
,
allen_converse()
,
allen_illustrate()
,
allen_intersect()
,
allen_joint_concurrency()
,
allen_observe()
,
allen_observe_frequency()
,
allen_relation()
,
allen_relation_code()
## Data from Husi 2022 loire <- data.frame( lower = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), upper = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425) ) ## Basic relations allen_relation(loire$lower, loire$upper) ## Complement (comp <- allen_complement("F")) # "pmoDseSdfOMP" ## Converse (conv <- allen_converse(comp)) # "pmoFDseSdOMP" ## Composition allen_composition("oFD", "oFDseS") # "pmoFD" ## Intersection allen_intersect("pFsSf", "pmoFD") # "pF" # Union allen_union("pFsSf", "pmoFD") # "pmoFDsSf"
## Data from Husi 2022 loire <- data.frame( lower = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), upper = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425) ) ## Basic relations allen_relation(loire$lower, loire$upper) ## Complement (comp <- allen_complement("F")) # "pmoDseSdfOMP" ## Converse (conv <- allen_converse(comp)) # "pmoFDseSdOMP" ## Composition allen_composition("oFD", "oFDseS") # "pmoFD" ## Intersection allen_intersect("pFsSf", "pmoFD") # "pF" # Union allen_union("pFsSf", "pmoFD") # "pmoFDsSf"
Extracts parallel chains from an MCMC
object to create an
mcmc.list
object for use with coda diagnostic tools.
as_coda(from, ...) ## S4 method for signature 'MCMC' as_coda(from, chains = 1)
as_coda(from, ...) ## S4 method for signature 'MCMC' as_coda(from, chains = 1)
from |
from An object to be coerced. |
... |
Currently not used. |
chains |
An |
An coda::mcmc.list
object.
A. Philippe, M.-A. Vibet
coda::mcmc()
, coda::mcmc.list()
Other read methods:
as_events()
,
as_phases()
,
check
,
read_bcal()
,
read_chronomodel
,
read_oxcal()
if (requireNamespace("coda", quietly = TRUE)) { ## Load coda library(coda) ## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Coerce to coda mc <- as_coda(eve[, 1:2], chains = 3) plot(mc) ## Autocorrelation autocorr.plot(mc) ## Gelman-Rubin diagnostic ## The multivariate criterion can not be evaluated when a phase ## contains only one date. This induces colinearity problems. gelman.diag(mc) gelman.plot(mc) }
if (requireNamespace("coda", quietly = TRUE)) { ## Load coda library(coda) ## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Coerce to coda mc <- as_coda(eve[, 1:2], chains = 3) plot(mc) ## Autocorrelation autocorr.plot(mc) ## Gelman-Rubin diagnostic ## The multivariate criterion can not be evaluated when a phase ## contains only one date. This induces colinearity problems. gelman.diag(mc) gelman.plot(mc) }
Coerce to Events
as_events(from, ...) ## S4 method for signature 'matrix' as_events(from, calendar, iteration = NULL) ## S4 method for signature 'data.frame' as_events(from, calendar, iteration = NULL)
as_events(from, ...) ## S4 method for signature 'matrix' as_events(from, calendar, iteration = NULL) ## S4 method for signature 'data.frame' as_events(from, calendar, iteration = NULL)
from |
from An object to be coerced. |
... |
Currently not used. |
calendar |
A |
iteration |
A length-one |
An EventsMCMC
object.
A. Philippe, M.-A. Vibet, N. Frerebeau
Other read methods:
as_coda()
,
as_phases()
,
check
,
read_bcal()
,
read_chronomodel
,
read_oxcal()
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Plot first event plot(eve[, 1], interval = "hdr") ## Colorfull plot plot(eve, col.density = c("#4477AA", "#EE6677", "#228833", "#CCBB44")) ## Plot events plot(eve, calendar = CE(), interval = "credible", level = 0.68) plot(eve, calendar = BP(), interval = "hdr", level = 0.68) ## Plot only 95% credible interval plot(eve, density = FALSE, interval = "credible", lwd = 3, tcl = 0)
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Plot first event plot(eve[, 1], interval = "hdr") ## Colorfull plot plot(eve, col.density = c("#4477AA", "#EE6677", "#228833", "#CCBB44")) ## Plot events plot(eve, calendar = CE(), interval = "credible", level = 0.68) plot(eve, calendar = BP(), interval = "hdr", level = 0.68) ## Plot only 95% credible interval plot(eve, density = FALSE, interval = "credible", lwd = 3, tcl = 0)
Coerce to Phases
as_phases(from, ...) ## S4 method for signature 'matrix' as_phases( from, calendar = NULL, start = seq(from = 1, to = ncol(from), by = 2), stop = start + 1, names = NULL, iteration = NULL ) ## S4 method for signature 'data.frame' as_phases( from, calendar, start = seq(from = 1, to = ncol(from), by = 2), stop = start + 1, names = NULL, iteration = NULL )
as_phases(from, ...) ## S4 method for signature 'matrix' as_phases( from, calendar = NULL, start = seq(from = 1, to = ncol(from), by = 2), stop = start + 1, names = NULL, iteration = NULL ) ## S4 method for signature 'data.frame' as_phases( from, calendar, start = seq(from = 1, to = ncol(from), by = 2), stop = start + 1, names = NULL, iteration = NULL )
from |
from An object to be coerced. |
... |
Currently not used. |
calendar |
A |
start |
An |
stop |
An |
names |
A |
iteration |
A length-one |
A PhasesMCMC
object.
A. Philippe, M.-A. Vibet, N. Frerebeau
Other read methods:
as_coda()
,
as_events()
,
check
,
read_bcal()
,
read_chronomodel
,
read_oxcal()
## Coerce to phases (pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1)) summary(pha, calendar = CE()) ## Plot phases plot(pha) plot(pha, succession = "hiatus") plot(pha, succession = "transition") ## Compute phases from events (eve <- as_events(mcmc_events, calendar = CE(), iteration = 1)) ## Compute min-max range for all chains pha1 <- phases(eve) summary(pha1, calendar = CE()) ## Compute min-max range by group pha2 <- phases(eve, groups = list(phase_1 = c(1, 3), phase_2 = c(2, 4))) summary(pha2, calendar = CE()) zz <- [email protected] head(zz) head(zz[, 1, ]) head(pha)
## Coerce to phases (pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1)) summary(pha, calendar = CE()) ## Plot phases plot(pha) plot(pha, succession = "hiatus") plot(pha, succession = "transition") ## Compute phases from events (eve <- as_events(mcmc_events, calendar = CE(), iteration = 1)) ## Compute min-max range for all chains pha1 <- phases(eve) summary(pha1, calendar = CE()) ## Compute min-max range by group pha2 <- phases(eve, groups = list(phase_1 = c(1, 3), phase_2 = c(2, 4))) summary(pha2, calendar = CE()) zz <- pha@.Data head(zz) head(zz[, 1, ]) head(pha)
Combine two MCMC Objects
## S4 method for signature 'MCMC,MCMC' cbind2(x, y)
## S4 method for signature 'MCMC,MCMC' cbind2(x, y)
x , y
|
An |
An MCMC
object.
N. Frerebeau
Other mutators:
data.frame
,
names()
,
sort()
,
sort.list()
,
subset()
## Events (eve <- as_events(mcmc_events, calendar = CE(), iteration = 1)) eve[1:1000, ] # Select the first 1000 iterations eve[, 1:2] # Select the first 2 events cbind2(eve[, 1:2], eve[, 3:4]) # Combine two MCMC objects sort(eve, decreasing = TRUE) # Sort events in descending order ## Phases (pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1)) pha[1:1000, , ] # Select the first 1000 iterations pha[, 1, , drop = FALSE] # Select the first phase
## Events (eve <- as_events(mcmc_events, calendar = CE(), iteration = 1)) eve[1:1000, ] # Select the first 1000 iterations eve[, 1:2] # Select the first 2 events cbind2(eve[, 1:2], eve[, 3:4]) # Combine two MCMC objects sort(eve, decreasing = TRUE) # Sort events in descending order ## Phases (pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1)) pha[1:1000, , ] # Select the first 1000 iterations pha[, 1, , drop = FALSE] # Select the first phase
Computes the shortest interval that satisfies
for each phase.
boundaries(x, y, ...) ## S4 method for signature 'numeric,numeric' boundaries(x, y, level = 0.95) ## S4 method for signature 'PhasesMCMC,missing' boundaries(x, level = 0.95)
boundaries(x, y, ...) ## S4 method for signature 'numeric,numeric' boundaries(x, y, level = 0.95) ## S4 method for signature 'PhasesMCMC,missing' boundaries(x, level = 0.95)
x , y
|
A |
... |
Currently not used. |
level |
A length-one |
The endpoints of the shortest time range (at a given level
).
boundaries(x = numeric, y = numeric)
: Returns a length-two numeric
vector
(terminal times).
boundaries(x = PhasesMCMC, y = missing)
: Returns a TimeRange
object.
A. Philippe, M.-A. Vibet, N. Frerebeau
Other time ranges:
hiatus()
,
transition()
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Compute min-max range by group pha <- phases(eve, groups = list(A = c(1, 3), B = c(2, 4))) ## Compute phase ranges bou <- boundaries(pha) as.data.frame(bou) ## Compute phase transition tra <- transition(pha) as.data.frame(tra) ## Compute phase hiatus hia <- hiatus(pha) as.data.frame(hia)
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Compute min-max range by group pha <- phases(eve, groups = list(A = c(1, 3), B = c(2, 4))) ## Compute phase ranges bou <- boundaries(pha) as.data.frame(bou) ## Compute phase transition tra <- transition(pha) as.data.frame(tra) ## Compute phase hiatus hia <- hiatus(pha) as.data.frame(hia)
Computes the age-depth curve from the output of the MCMC algorithm and the known depth of each dated samples.
bury(object, depth, ...) ## S4 method for signature 'EventsMCMC,numeric' bury(object, depth) ## S4 method for signature 'AgeDepthModel' predict(object, newdata) ## S4 method for signature 'AgeDepthModel,missing' plot( x, level = 0.95, calendar = getOption("ArchaeoPhases.calendar"), main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... )
bury(object, depth, ...) ## S4 method for signature 'EventsMCMC,numeric' bury(object, depth) ## S4 method for signature 'AgeDepthModel' predict(object, newdata) ## S4 method for signature 'AgeDepthModel,missing' plot( x, level = 0.95, calendar = getOption("ArchaeoPhases.calendar"), main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... )
object |
An |
depth |
A |
... |
Other graphical parameters may also be passed as
arguments to this function, particularly, |
newdata |
A |
x |
An |
level |
A length-one |
calendar |
A |
main |
A |
sub |
A |
ann |
A |
axes |
A |
frame.plot |
A |
panel.first |
An an |
panel.last |
An |
We assume it exists a function relating the age and the depth
. We estimate the function using local regression
(also called local polynomial regression):
.
This estimated function
depends on the unknown dates. However,
from the posterior distribution of the age/date sequence, we can evaluate
the posterior distribution of the age function for each desired depth.
bury()
returns an AgeDepthModel
object.
predict()
returns an EventsMCMC
object.
plot()
is called it for its side-effects: it results in a graphic being
displayed (invisibly returns x
).
A. Philippe
Jha, D. K., Sanyal, P. & Philippe, A. (2020). Multi-Proxy Evidence of Late Quaternary Climate and Vegetational History of North-Central India: Implication for the Paleolithic to Neolithic Phases. Quaternary Science Reviews, 229: 106121. doi:10.1016/j.quascirev.2019.106121.
Ghosh, S., Sanyal, P., Roy, S., Bhushan, R., Sati, S. P., Philippe, A. & Juyal, N. (2020). Early Holocene Indian Summer Monsoon and Its Impact on Vegetation in the Central Himalaya: Insight from dD and d13C Values of Leaf Wax Lipid. The Holocene, 30(7): 1063-1074. doi:10.1177/0959683620908639.
Other age-depth modeling tools:
interpolate()
## Coerce to MCMC eve <- matrix(rnorm(6000, (1:6)^2), ncol = 6, byrow = TRUE) eve <- as_events(eve, calendar = CE()) ## Compute an age-depth curve age <- bury(eve, depth = 1:6) plot(age) ## Predict new values new <- predict(age, newdata = 1.5:5.5) summary(new) plot(eve) plot(new)
## Coerce to MCMC eve <- matrix(rnorm(6000, (1:6)^2), ncol = 6, byrow = TRUE) eve <- as_events(eve, calendar = CE()) ## Compute an age-depth curve age <- bury(eve, depth = 1:6) plot(age) ## Predict new values new <- predict(age, newdata = 1.5:5.5) summary(new) plot(eve) plot(new)
Checks whether or not a file is identical to the one used to create an object.
is_original(object, ...) ## S4 method for signature 'MCMC' is_original(object, file, download = FALSE) ## S4 method for signature 'PhasesMCMC' is_original(object, file, download = FALSE) ## S4 method for signature 'CumulativeEvents' is_original(object, file, download = FALSE) ## S4 method for signature 'ActivityEvents' is_original(object, file, download = FALSE) ## S4 method for signature 'OccurrenceEvents' is_original(object, file, download = FALSE)
is_original(object, ...) ## S4 method for signature 'MCMC' is_original(object, file, download = FALSE) ## S4 method for signature 'PhasesMCMC' is_original(object, file, download = FALSE) ## S4 method for signature 'CumulativeEvents' is_original(object, file, download = FALSE) ## S4 method for signature 'ActivityEvents' is_original(object, file, download = FALSE) ## S4 method for signature 'OccurrenceEvents' is_original(object, file, download = FALSE)
object |
An object (typically an |
... |
Currently not used. |
file |
Either a path to a CSV file or a connection. |
download |
A |
A logical
: TRUE
if the files match, FALSE
otherwise.
T. S. Dye, N. Frerebeau
Other read methods:
as_coda()
,
as_events()
,
as_phases()
,
read_bcal()
,
read_chronomodel
,
read_oxcal()
## Not run: ## Import OxCal Output path_output <- system.file("oxcal/ksarakil/MCMC_Sample.csv", package = "ArchaeoData") url_output <- paste0("https://raw.githubusercontent.com/ArchaeoStat/ArchaeoData/master/", "inst/oxcal/ksarakil/MCMC_Sample.csv") oxcal <- read_oxcal(path_output) ## Check md5 sum is_original(oxcal, path_output) # Same as local file? TRUE is_original(oxcal, url_output, download = FALSE) # Same as remote file? FALSE is_original(oxcal, url_output, download = TRUE) # Same as remote file? TRUE ## End(Not run)
## Not run: ## Import OxCal Output path_output <- system.file("oxcal/ksarakil/MCMC_Sample.csv", package = "ArchaeoData") url_output <- paste0("https://raw.githubusercontent.com/ArchaeoStat/ArchaeoData/master/", "inst/oxcal/ksarakil/MCMC_Sample.csv") oxcal <- read_oxcal(path_output) ## Check md5 sum is_original(oxcal, path_output) # Same as local file? TRUE is_original(oxcal, url_output, download = FALSE) # Same as remote file? FALSE is_original(oxcal, url_output, download = TRUE) # Same as remote file? TRUE ## End(Not run)
Coerce to a Data Frame
## S4 method for signature 'CumulativeEvents' as.data.frame(x, ..., calendar = getOption("ArchaeoPhases.calendar")) ## S4 method for signature 'ActivityEvents' as.data.frame(x, ..., calendar = getOption("ArchaeoPhases.calendar")) ## S4 method for signature 'OccurrenceEvents' as.data.frame(x, ..., calendar = getOption("ArchaeoPhases.calendar")) ## S4 method for signature 'TimeRange' as.data.frame(x, ..., calendar = getOption("ArchaeoPhases.calendar"))
## S4 method for signature 'CumulativeEvents' as.data.frame(x, ..., calendar = getOption("ArchaeoPhases.calendar")) ## S4 method for signature 'ActivityEvents' as.data.frame(x, ..., calendar = getOption("ArchaeoPhases.calendar")) ## S4 method for signature 'OccurrenceEvents' as.data.frame(x, ..., calendar = getOption("ArchaeoPhases.calendar")) ## S4 method for signature 'TimeRange' as.data.frame(x, ..., calendar = getOption("ArchaeoPhases.calendar"))
x |
An object. |
... |
Further parameters to be passed to |
calendar |
A |
A data.frame
with an extra time
column giving the (decimal) years at
which the time series was sampled.
N. Frerebeau
Other mutators:
bind
,
names()
,
sort()
,
sort.list()
,
subset()
Phase Duration
duration(x, y, ...) ## S4 method for signature 'numeric,numeric' duration(x, y) ## S4 method for signature 'PhasesMCMC,missing' duration(x)
duration(x, y, ...) ## S4 method for signature 'numeric,numeric' duration(x, y) ## S4 method for signature 'PhasesMCMC,missing' duration(x)
x , y
|
A |
... |
Currently not used. |
A. Philippe, M.-A. Vibet, N. Frerebeau
Other phase tools:
phases()
## Coerce to phases pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1) ## Compute phase duration dur <- duration(pha) summary(dur)
## Coerce to phases pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1) ## Compute phase duration dur <- duration(pha) summary(dur)
Elapsed Time Scale
elapse(object, ...) ## S4 method for signature 'MCMC' elapse(object, origin = 1)
elapse(object, ...) ## S4 method for signature 'MCMC' elapse(object, origin = 1)
object |
An object (typically an |
... |
Currently not used. |
origin |
An |
Returns an object of the same class as object
with an elapsed
An object of the same sort as object
with a new time scale.
There is no year in BCE/CE scale.
N. Frerebeau
Other event tools:
activity()
,
occurrence()
,
tempo()
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Elapsed origin eve_elapse <- elapse(eve, origin = 4) plot(eve_elapse)
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Elapsed origin eve_elapse <- elapse(eve, origin = 4) plot(eve_elapse)
Tests for the existence of a hiatus between two parameters.
hiatus(x, y, ...) ## S4 method for signature 'numeric,numeric' hiatus(x, y, level = 0.95) ## S4 method for signature 'EventsMCMC,missing' hiatus(x, level = 0.95) ## S4 method for signature 'PhasesMCMC,missing' hiatus(x, level = 0.95)
hiatus(x, y, ...) ## S4 method for signature 'numeric,numeric' hiatus(x, y, level = 0.95) ## S4 method for signature 'EventsMCMC,missing' hiatus(x, level = 0.95) ## S4 method for signature 'PhasesMCMC,missing' hiatus(x, level = 0.95)
x , y
|
A |
... |
Currently not used. |
level |
A length-one |
Finds if a gap exists between two dates and returns the longest interval
that satisfies
The hiatus between two successive phases is the longest interval that
satisfies
(this assumes that the phases are in temporal order constraint).
The endpoints of the hiatus between successive events/phases
(at a given level
).
hiatus(x = numeric, y = numeric)
: Returns a length-three numeric
vector (terminal times
and hiatus duration, if any).
hiatus(x = EventsMCMC, y = missing)
: Returns a TimeRange
object.
hiatus(x = PhasesMCMC, y = missing)
: Returns a TimeRange
object.
A. Philippe, M.-A. Vibet, N. Frerebeau
Other time ranges:
boundaries()
,
transition()
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Test for anteriority older(eve) ## Test for hiatus hia <- hiatus(eve) as.data.frame(hia)
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Test for anteriority older(eve) ## Test for hiatus hia <- hiatus(eve) as.data.frame(hia)
Interpolate Between Two Dates
interpolate(x, y, ...) ## S4 method for signature 'numeric,numeric' interpolate(x, y) ## S4 method for signature 'EventsMCMC,missing' interpolate(x, e1 = 1, e2 = 2)
interpolate(x, y, ...) ## S4 method for signature 'numeric,numeric' interpolate(x, y) ## S4 method for signature 'EventsMCMC,missing' interpolate(x, e1 = 1, e2 = 2)
x |
A |
y |
A |
... |
Currently not used. |
e1 , e2
|
An |
For a given output of MCMC algorithm, this function interpolates between
to events and
(assuming
).
N. Frerebeau
Other age-depth modeling tools:
bury()
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Interpolate between two events inter <- interpolate(eve, e1 = 2, e2 = 3) plot(inter, level = 0.95, interval = "credible")
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Interpolate between two events inter <- interpolate(eve, e1 = 2, e2 = 3) plot(inter, level = 0.95, interval = "credible")
Computes the shortest credible interval of the output of the MCMC algorithm for a single parameter.
interval_credible(x, ...) ## S4 method for signature 'MCMC' interval_credible( x, level = 0.95, calendar = getOption("ArchaeoPhases.calendar") )
interval_credible(x, ...) ## S4 method for signature 'MCMC' interval_credible( x, level = 0.95, calendar = getOption("ArchaeoPhases.calendar") )
x |
An |
... |
Currently not used. |
level |
A length-one |
calendar |
A |
A % credible interval is an interval
that keeps
elements of the
sample outside the interval.
The % credible interval is the
shortest of all those intervals.
For instance, the 95% credible interval is the central portion of the posterior distribution that contains 95% of the values.
Returns a list
of numeric
matrix
.
A. Philippe, M.-A. Vibet, T. S. Dye, N. Frerebeau
Other statistics:
interval_hdr()
,
sensitivity()
,
summary()
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Rata die interval_credible(eve, level = 0.95) # Credible interval interval_hdr(eve, level = 0.68) # HPD interval ## BP interval_credible(eve, level = 0.95, calendar = BP()) # Credible interval interval_hdr(eve, level = 0.95, calendar = BP()) # HPD interval
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Rata die interval_credible(eve, level = 0.95) # Credible interval interval_hdr(eve, level = 0.68) # HPD interval ## BP interval_credible(eve, level = 0.95, calendar = BP()) # Credible interval interval_hdr(eve, level = 0.95, calendar = BP()) # HPD interval
Bayesian HPD Regions
interval_hdr(x, y, ...) ## S4 method for signature 'MCMC,missing' interval_hdr( x, level = 0.95, calendar = getOption("ArchaeoPhases.calendar"), ... )
interval_hdr(x, y, ...) ## S4 method for signature 'MCMC,missing' interval_hdr( x, level = 0.95, calendar = getOption("ArchaeoPhases.calendar"), ... )
x |
An |
y |
Currently not used. |
... |
Extra arguments to be passed to |
level |
A length-one |
calendar |
A |
Returns a list
of numeric
matrix
.
A. Philippe, M.-A. Vibet, T. S. Dye, N. Frerebeau
Hyndman, R. J. (1996). Computing and graphing highest density regions. American Statistician, 50: 120-126. doi:10.2307/2684423.
stats::density()
, arkhe::interval_hdr()
Other statistics:
interval_credible()
,
sensitivity()
,
summary()
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Rata die interval_credible(eve, level = 0.95) # Credible interval interval_hdr(eve, level = 0.68) # HPD interval ## BP interval_credible(eve, level = 0.95, calendar = BP()) # Credible interval interval_hdr(eve, level = 0.95, calendar = BP()) # HPD interval
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Rata die interval_credible(eve, level = 0.95) # Credible interval interval_hdr(eve, level = 0.68) # HPD interval ## BP interval_credible(eve, level = 0.95, calendar = BP()) # Credible interval interval_hdr(eve, level = 0.95, calendar = BP()) # HPD interval
A data set containing information on the ages of four dated events.
mcmc_events
mcmc_events
A data.frame
with 30,000 rows and 5 variables:
iter
Iteration of the MCMC algorithm.
E1
Information on event 1.
E2
Information on event 2.
E3
Information on event 3.
E4
Information on event 4.
Other datasets:
mcmc_phases
A data set containing information on the start and end dates of two phases.
mcmc_phases
mcmc_phases
A data.frame
with 30,000 rows and 5 variables:
iter
Iteration of the MCMC algorithm.
P2_alpha
Start date of Phase 2.
P2_beta
End date of Phase 2.
P1_alpha
Start date of Phase 1.
P1_beta
End date of Phase 1.
Other datasets:
mcmc_events
Get or set the names of an object.
## S4 method for signature 'MCMC' names(x) ## S4 replacement method for signature 'MCMC' names(x) <- value ## S4 method for signature 'PhasesMCMC' names(x) ## S4 replacement method for signature 'PhasesMCMC' names(x) <- value
## S4 method for signature 'MCMC' names(x) ## S4 replacement method for signature 'MCMC' names(x) <- value ## S4 method for signature 'PhasesMCMC' names(x) ## S4 replacement method for signature 'PhasesMCMC' names(x) <- value
x |
An object from which to get or set names. |
value |
A possible value for the names of |
An object of the same sort as x
with the new names assigned.
N. Frerebeau
Other mutators:
bind
,
data.frame
,
sort()
,
sort.list()
,
subset()
A statistical graphic designed for the archaeological study of when events of a specified kind occurred.
occurrence(object, ...) ## S4 method for signature 'EventsMCMC' occurrence(object, level = 0.95) ## S4 method for signature 'OccurrenceEvents,missing' plot( x, calendar = getOption("ArchaeoPhases.calendar"), main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... )
occurrence(object, ...) ## S4 method for signature 'EventsMCMC' occurrence(object, level = 0.95) ## S4 method for signature 'OccurrenceEvents,missing' plot( x, calendar = getOption("ArchaeoPhases.calendar"), main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... )
object |
An |
... |
Other graphical parameters may also be passed as
arguments to this function, particularly, |
level |
A length-one |
x |
An |
calendar |
A |
main |
A |
sub |
A |
ann |
A |
axes |
A |
frame.plot |
A |
panel.first |
An an |
panel.last |
An |
If we have events, then we can estimate the calendar date
corresponding to the smallest date such that the number of events observed
before
is equal to
.
The occurrence()
estimates these occurrences and gives the credible
interval or the highest posterior density (HPD) region for a given level
of confidence.
occurrence()
returns an OccurrenceEvents
object.
plot()
is called it for its side-effects: it results in a graphic being
displayed (invisibly returns x
).
An OccurrenceEvents
object.
A. Philippe, M.-A. Vibet, T. S. Dye, N. Frerebeau
Other event tools:
activity()
,
elapse()
,
tempo()
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Occurrence plot occ <- occurrence(eve) plot(occ, panel.first = graphics::grid())
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Occurrence plot occ <- occurrence(eve) plot(occ, panel.first = graphics::grid())
A Bayesian test for checking the following assumption: "event x
is older
than event y
".
older(x, y, ...) ## S4 method for signature 'numeric,numeric' older(x, y) ## S4 method for signature 'EventsMCMC,missing' older(x, y)
older(x, y, ...) ## S4 method for signature 'numeric,numeric' older(x, y) ## S4 method for signature 'EventsMCMC,missing' older(x, y)
x |
A |
y |
A |
... |
Currently not used. |
For a given output of MCMC algorithm, this function estimates the posterior
probability of the event by the relative frequency of the event
"the value of event
x
is less than the value of event y
" in the
simulated Markov chain.
older(x = numeric, y = numeric)
: Returns a length-one numeric
vector (the posterior
probability of the assumption: "event x
is older than event y
").
older(x = EventsMCMC, y = missing)
: Returns a numeric
matrix of posterior probabilities.
A. Philippe, M.-A. Vibet, N. Frerebeau
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Test for anteriority older(eve) ## Test for hiatus hia <- hiatus(eve) as.data.frame(hia)
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Test for anteriority older(eve) ## Test for hiatus hia <- hiatus(eve) as.data.frame(hia)
Constructs the minimum and maximum for a group of events (phase).
phases(x, groups, ...) ## S4 method for signature 'EventsMCMC,missing' phases(x) ## S4 method for signature 'EventsMCMC,list' phases(x, groups)
phases(x, groups, ...) ## S4 method for signature 'EventsMCMC,missing' phases(x) ## S4 method for signature 'EventsMCMC,list' phases(x, groups)
x |
An |
groups |
A |
... |
Currently not used. |
A PhasesMCMC
object.
The default value of start
or end
corresponds to a CSV file exported
from ChronoModel.
A. Philippe, M.-A. Vibet, N. Frerebeau
Other phase tools:
duration()
## Coerce to phases (pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1)) summary(pha, calendar = CE()) ## Plot phases plot(pha) plot(pha, succession = "hiatus") plot(pha, succession = "transition") ## Compute phases from events (eve <- as_events(mcmc_events, calendar = CE(), iteration = 1)) ## Compute min-max range for all chains pha1 <- phases(eve) summary(pha1, calendar = CE()) ## Compute min-max range by group pha2 <- phases(eve, groups = list(phase_1 = c(1, 3), phase_2 = c(2, 4))) summary(pha2, calendar = CE()) zz <- [email protected] head(zz) head(zz[, 1, ]) head(pha)
## Coerce to phases (pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1)) summary(pha, calendar = CE()) ## Plot phases plot(pha) plot(pha, succession = "hiatus") plot(pha, succession = "transition") ## Compute phases from events (eve <- as_events(mcmc_events, calendar = CE(), iteration = 1)) ## Compute min-max range for all chains pha1 <- phases(eve) summary(pha1, calendar = CE()) ## Compute min-max range by group pha2 <- phases(eve, groups = list(phase_1 = c(1, 3), phase_2 = c(2, 4))) summary(pha2, calendar = CE()) zz <- pha@.Data head(zz) head(zz[, 1, ]) head(pha)
Plots credible intervals or HPD regions of a series of events.
## S4 method for signature 'MCMC,missing' plot( x, calendar = getOption("ArchaeoPhases.calendar"), density = TRUE, interval = NULL, level = 0.95, sort = TRUE, decreasing = TRUE, main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = FALSE, panel.first = NULL, panel.last = NULL, col.density = "grey", col.interval = "#77AADD", ... )
## S4 method for signature 'MCMC,missing' plot( x, calendar = getOption("ArchaeoPhases.calendar"), density = TRUE, interval = NULL, level = 0.95, sort = TRUE, decreasing = TRUE, main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = FALSE, panel.first = NULL, panel.last = NULL, col.density = "grey", col.interval = "#77AADD", ... )
x |
An |
calendar |
A |
density |
A |
interval |
A |
level |
A length-one |
sort |
A |
decreasing |
A |
main |
A |
sub |
A |
ann |
A |
axes |
A |
frame.plot |
A |
panel.first |
An an |
panel.last |
An |
col.density , col.interval
|
A specification for the plotting colors. |
... |
Extra parameters to be passed to |
plot()
is called it for its side-effects: it results in a graphic being
displayed (invisibly returns x
).
A. Philippe, M.-A. Vibet, T. S. Dye, N. Frerebeau
Other plot methods:
plot_phases
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Summary summary(eve, calendar = CE()) summary(eve, calendar = BP()) ## Plot events plot(eve, calendar = CE(), interval = "credible", level = 0.68) plot(eve, calendar = BP(), interval = "hdr", level = 0.68) plot(eve[, 1], interval = "hdr") ## Compute phases pha <- phases(eve, groups = list(B = c(2, 4), A = c(1, 3))) ## Summary summary(pha, calendar = CE()) summary(pha, calendar = BP()) ## Plot phases plot(pha, calendar = BP()) plot(pha, succession = "hiatus") plot(pha, succession = "transition")
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Summary summary(eve, calendar = CE()) summary(eve, calendar = BP()) ## Plot events plot(eve, calendar = CE(), interval = "credible", level = 0.68) plot(eve, calendar = BP(), interval = "hdr", level = 0.68) plot(eve[, 1], interval = "hdr") ## Compute phases pha <- phases(eve, groups = list(B = c(2, 4), A = c(1, 3))) ## Summary summary(pha, calendar = CE()) summary(pha, calendar = BP()) ## Plot phases plot(pha, calendar = BP()) plot(pha, succession = "hiatus") plot(pha, succession = "transition")
Plots the characteristics of a group of events (phase).
## S4 method for signature 'PhasesMCMC,missing' plot( x, calendar = getOption("ArchaeoPhases.calendar"), density = TRUE, range = TRUE, succession = NULL, level = 0.95, sort = TRUE, decreasing = TRUE, legend = TRUE, main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = FALSE, panel.first = NULL, panel.last = NULL, col.density = "grey", col.range = "black", col.succession = c("#77AADD", "#EE8866"), ... )
## S4 method for signature 'PhasesMCMC,missing' plot( x, calendar = getOption("ArchaeoPhases.calendar"), density = TRUE, range = TRUE, succession = NULL, level = 0.95, sort = TRUE, decreasing = TRUE, legend = TRUE, main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = FALSE, panel.first = NULL, panel.last = NULL, col.density = "grey", col.range = "black", col.succession = c("#77AADD", "#EE8866"), ... )
x |
A |
calendar |
A |
density |
A |
range |
A |
succession |
A |
level |
A length-one |
sort |
A |
decreasing |
A |
legend |
A |
main |
A |
sub |
A |
ann |
A |
axes |
A |
frame.plot |
A |
panel.first |
An an |
panel.last |
An |
col.density , col.range , col.succession
|
A specification for the plotting colors. |
... |
Extra parameters to be passed to |
plot()
is called it for its side-effects: it results in a graphic being
displayed (invisibly returns x
).
A. Philippe, M.-A. Vibet, T. S. Dye, N. Frerebeau
Other plot methods:
plot_events
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Summary summary(eve, calendar = CE()) summary(eve, calendar = BP()) ## Plot events plot(eve, calendar = CE(), interval = "credible", level = 0.68) plot(eve, calendar = BP(), interval = "hdr", level = 0.68) plot(eve[, 1], interval = "hdr") ## Compute phases pha <- phases(eve, groups = list(B = c(2, 4), A = c(1, 3))) ## Summary summary(pha, calendar = CE()) summary(pha, calendar = BP()) ## Plot phases plot(pha, calendar = BP()) plot(pha, succession = "hiatus") plot(pha, succession = "transition")
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Summary summary(eve, calendar = CE()) summary(eve, calendar = BP()) ## Plot events plot(eve, calendar = CE(), interval = "credible", level = 0.68) plot(eve, calendar = BP(), interval = "hdr", level = 0.68) plot(eve[, 1], interval = "hdr") ## Compute phases pha <- phases(eve, groups = list(B = c(2, 4), A = c(1, 3))) ## Summary summary(pha, calendar = CE()) summary(pha, calendar = BP()) ## Plot phases plot(pha, calendar = BP()) plot(pha, succession = "hiatus") plot(pha, succession = "transition")
Reads MCMC output.
read_bcal(file, ...) ## S4 method for signature 'character' read_bcal(file, bin_width = 1, calendar = BP())
read_bcal(file, ...) ## S4 method for signature 'character' read_bcal(file, bin_width = 1, calendar = BP())
file |
the name of the file which the data are to be read from.
Each row of the table appears as one line of the file. If it does
not contain an absolute path, the file name is
relative to the current working directory,
Alternatively,
|
... |
Further arguments to be passed to |
bin_width |
The bin width specified for the BCal calibration. Defaults to the BCal default of 1. |
calendar |
A |
An EventsMCMC
object.
T. S. Dye, N. Frerebeau
Buck C. E., Christen J. A. & James G. N. (1999). BCal: an on-line Bayesian radiocarbon calibration tool. Internet Archaeology, 7. doi:10.11141/ia.7.1.
Other read methods:
as_coda()
,
as_events()
,
as_phases()
,
check
,
read_chronomodel
,
read_oxcal()
if (requireNamespace("ArchaeoData", quietly = TRUE)) { ## Import BCal Output path_output <- system.file("bcal/fishpond.csv", package = "ArchaeoData") (bcal <- read_bcal(path_output)) }
if (requireNamespace("ArchaeoData", quietly = TRUE)) { ## Import BCal Output path_output <- system.file("bcal/fishpond.csv", package = "ArchaeoData") (bcal <- read_bcal(path_output)) }
Reads MCMC output.
read_chronomodel_events(file, ...) read_chronomodel_phases(file, ...) ## S4 method for signature 'character' read_chronomodel_events(file, calendar = CE(), sep = ",", dec = ".") ## S4 method for signature 'character' read_chronomodel_phases(file, calendar = CE(), sep = ",", dec = ".")
read_chronomodel_events(file, ...) read_chronomodel_phases(file, ...) ## S4 method for signature 'character' read_chronomodel_events(file, calendar = CE(), sep = ",", dec = ".") ## S4 method for signature 'character' read_chronomodel_phases(file, calendar = CE(), sep = ",", dec = ".")
file |
the name of the file which the data are to be read from.
Each row of the table appears as one line of the file. If it does
not contain an absolute path, the file name is
relative to the current working directory,
Alternatively,
|
... |
Further arguments to be passed to |
calendar |
A |
sep |
the field separator character. Values on each line of the
file are separated by this character. If |
dec |
the character used in the file for decimal points. |
An EventsMCMC
or a PhasesMCMC
object.
T. S. Dye, N. Frerebeau
Lanos, Ph., Philippe, A. & Dufresne, Ph. (2015). Chronomodel: Chronological Modeling of Archaeological Data using Bayesian Statistics. URL: https://chronomodel.com/.
Other read methods:
as_coda()
,
as_events()
,
as_phases()
,
check
,
read_bcal()
,
read_oxcal()
if (requireNamespace("ArchaeoData", quietly = TRUE)) { ## Import ChronoModel Output path <- "chronomodel/ksarakil" ## Events path_events <- system.file(path, "Chain_all_Events.csv", package = "ArchaeoData") (chrono_events <- read_chronomodel_events(path_events)) ## Phases path_phases <- system.file(path, "Chain_all_Phases.csv", package = "ArchaeoData") (chrono_phases <- read_chronomodel_phases(path_phases)) }
if (requireNamespace("ArchaeoData", quietly = TRUE)) { ## Import ChronoModel Output path <- "chronomodel/ksarakil" ## Events path_events <- system.file(path, "Chain_all_Events.csv", package = "ArchaeoData") (chrono_events <- read_chronomodel_events(path_events)) ## Phases path_phases <- system.file(path, "Chain_all_Phases.csv", package = "ArchaeoData") (chrono_phases <- read_chronomodel_phases(path_phases)) }
Reads MCMC output.
read_oxcal(file, ...) ## S4 method for signature 'character' read_oxcal(file, calendar = CE())
read_oxcal(file, ...) ## S4 method for signature 'character' read_oxcal(file, calendar = CE())
file |
the name of the file which the data are to be read from.
Each row of the table appears as one line of the file. If it does
not contain an absolute path, the file name is
relative to the current working directory,
Alternatively,
|
... |
Further arguments to be passed to |
calendar |
A |
An EventsMCMC
object.
T. S. Dye, N. Frerebeau
Bronk Ramsey, C. (2009). Bayesian Analysis of Radiocarbon Dates. Radiocarbon, 51(1), 337-360. doi:10.1017/S0033822200033865.
Other read methods:
as_coda()
,
as_events()
,
as_phases()
,
check
,
read_bcal()
,
read_chronomodel
if (requireNamespace("ArchaeoData", quietly = TRUE)) { ## Import OxCal Output path <- "oxcal/ksarakil/" path_output <- system.file(path, "MCMC_Sample.csv", package = "ArchaeoData") (oxcal <- read_oxcal(path_output)) }
if (requireNamespace("ArchaeoData", quietly = TRUE)) { ## Import OxCal Output path <- "oxcal/ksarakil/" path_output <- system.file(path, "MCMC_Sample.csv", package = "ArchaeoData") (oxcal <- read_oxcal(path_output)) }
Calculates the ranges of summary statistics from the output of two or more runs of the MCMC algorithm.
sensitivity(...) ## S4 method for signature 'EventsMCMC' sensitivity(..., positions = NULL, level = 0.95)
sensitivity(...) ## S4 method for signature 'EventsMCMC' sensitivity(..., positions = NULL, level = 0.95)
... |
Any |
positions |
A |
level |
A length-one |
This function is useful for estimating the sensitivity of calibration results to different model parameters.
A data.frame
.
T. S. Dye, N. Frerebeau
Other statistics:
interval_credible()
,
interval_hdr()
,
summary()
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Returns 0's sensitivity(eve, eve)
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Returns 0's sensitivity(eve, eve)
Sort (or order) an object into ascending or descending temporal order.
## S4 method for signature 'MCMC' sort(x, decreasing = FALSE) ## S4 method for signature 'PhasesMCMC' sort(x, decreasing = FALSE)
## S4 method for signature 'MCMC' sort(x, decreasing = FALSE) ## S4 method for signature 'PhasesMCMC' sort(x, decreasing = FALSE)
x |
An |
decreasing |
A |
An object of the same sort as x
.
N. Frerebeau
Other mutators:
bind
,
data.frame
,
names()
,
sort.list()
,
subset()
## Events (eve <- as_events(mcmc_events, calendar = CE(), iteration = 1)) eve[1:1000, ] # Select the first 1000 iterations eve[, 1:2] # Select the first 2 events cbind2(eve[, 1:2], eve[, 3:4]) # Combine two MCMC objects sort(eve, decreasing = TRUE) # Sort events in descending order ## Phases (pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1)) pha[1:1000, , ] # Select the first 1000 iterations pha[, 1, , drop = FALSE] # Select the first phase
## Events (eve <- as_events(mcmc_events, calendar = CE(), iteration = 1)) eve[1:1000, ] # Select the first 1000 iterations eve[, 1:2] # Select the first 2 events cbind2(eve[, 1:2], eve[, 3:4]) # Combine two MCMC objects sort(eve, decreasing = TRUE) # Sort events in descending order ## Phases (pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1)) pha[1:1000, , ] # Select the first 1000 iterations pha[, 1, , drop = FALSE] # Select the first phase
Returns a permutation which rearranges an object into ascending or descending temporal order.
## S4 method for signature 'MCMC' sort.list(x, decreasing = FALSE) ## S4 method for signature 'PhasesMCMC' sort.list(x, decreasing = FALSE)
## S4 method for signature 'MCMC' sort.list(x, decreasing = FALSE) ## S4 method for signature 'PhasesMCMC' sort.list(x, decreasing = FALSE)
x |
An |
decreasing |
A |
An integer
vector.
N. Frerebeau
Other mutators:
bind
,
data.frame
,
names()
,
sort()
,
subset()
## Events (eve <- as_events(mcmc_events, calendar = CE(), iteration = 1)) eve[1:1000, ] # Select the first 1000 iterations eve[, 1:2] # Select the first 2 events cbind2(eve[, 1:2], eve[, 3:4]) # Combine two MCMC objects sort(eve, decreasing = TRUE) # Sort events in descending order ## Phases (pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1)) pha[1:1000, , ] # Select the first 1000 iterations pha[, 1, , drop = FALSE] # Select the first phase
## Events (eve <- as_events(mcmc_events, calendar = CE(), iteration = 1)) eve[1:1000, ] # Select the first 1000 iterations eve[, 1:2] # Select the first 2 events cbind2(eve[, 1:2], eve[, 3:4]) # Combine two MCMC objects sort(eve, decreasing = TRUE) # Sort events in descending order ## Phases (pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1)) pha[1:1000, , ] # Select the first 1000 iterations pha[, 1, , drop = FALSE] # Select the first phase
Operators acting on objects to extract or replace parts.
## S4 method for signature 'MCMC' x[i, j, ..., drop = FALSE] ## S4 method for signature 'PhasesMCMC' x[i, j, k, drop = FALSE]
## S4 method for signature 'MCMC' x[i, j, ..., drop = FALSE] ## S4 method for signature 'PhasesMCMC' x[i, j, k, drop = FALSE]
x |
An object from which to extract element(s) or in which to replace element(s). |
i , j , k
|
Indices specifying elements to extract or replace. |
... |
Currently not used. |
drop |
A |
A subsetted object.
N. Frerebeau
Other mutators:
bind
,
data.frame
,
names()
,
sort()
,
sort.list()
## Events (eve <- as_events(mcmc_events, calendar = CE(), iteration = 1)) eve[1:1000, ] # Select the first 1000 iterations eve[, 1:2] # Select the first 2 events cbind2(eve[, 1:2], eve[, 3:4]) # Combine two MCMC objects sort(eve, decreasing = TRUE) # Sort events in descending order ## Phases (pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1)) pha[1:1000, , ] # Select the first 1000 iterations pha[, 1, , drop = FALSE] # Select the first phase
## Events (eve <- as_events(mcmc_events, calendar = CE(), iteration = 1)) eve[1:1000, ] # Select the first 1000 iterations eve[, 1:2] # Select the first 2 events cbind2(eve[, 1:2], eve[, 3:4]) # Combine two MCMC objects sort(eve, decreasing = TRUE) # Sort events in descending order ## Phases (pha <- as_phases(mcmc_phases, start = c(1, 3), calendar = CE(), iteration = 1)) pha[1:1000, , ] # Select the first 1000 iterations pha[, 1, , drop = FALSE] # Select the first phase
Calculates summary statistics of the output of the MCMC algorithm for multiple parameters. Results are given in calendar years (BC/AD).
## S4 method for signature 'MCMC' summary(object, level = 0.95, calendar = getOption("ArchaeoPhases.calendar")) ## S4 method for signature 'PhasesMCMC' summary(object, level = 0.95, calendar = getOption("ArchaeoPhases.calendar"))
## S4 method for signature 'MCMC' summary(object, level = 0.95, calendar = getOption("ArchaeoPhases.calendar")) ## S4 method for signature 'PhasesMCMC' summary(object, level = 0.95, calendar = getOption("ArchaeoPhases.calendar"))
object |
An |
level |
A length-one |
calendar |
A |
A data.frame
where the rows correspond to the chains of interest and
columns to the following statistics:
The mean of the MCMC chain.
The standard deviation of the MCMC chain.
Minimum value of the MCMC chain.
First quantile of the MCMC chain.
Median of the MCMC chain.
Third quantile of the MCMC chain.
Maximum value of the MCMC chain.
Lower boundary of the credible interval
of the MCMC chain at level
.
Upper boundary of the credible interval
of the MCMC chain at level
.
A. Philippe, M.-A. Vibet, T. S. Dye, N. Frerebeau
Other statistics:
interval_credible()
,
interval_hdr()
,
sensitivity()
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Summary summary(eve, calendar = CE()) summary(eve, calendar = BP()) ## Plot events plot(eve, calendar = CE(), interval = "credible", level = 0.68) plot(eve, calendar = BP(), interval = "hdr", level = 0.68) plot(eve[, 1], interval = "hdr") ## Compute phases pha <- phases(eve, groups = list(B = c(2, 4), A = c(1, 3))) ## Summary summary(pha, calendar = CE()) summary(pha, calendar = BP()) ## Plot phases plot(pha, calendar = BP()) plot(pha, succession = "hiatus") plot(pha, succession = "transition")
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) ## Summary summary(eve, calendar = CE()) summary(eve, calendar = BP()) ## Plot events plot(eve, calendar = CE(), interval = "credible", level = 0.68) plot(eve, calendar = BP(), interval = "hdr", level = 0.68) plot(eve[, 1], interval = "hdr") ## Compute phases pha <- phases(eve, groups = list(B = c(2, 4), A = c(1, 3))) ## Summary summary(pha, calendar = CE()) summary(pha, calendar = BP()) ## Plot phases plot(pha, calendar = BP()) plot(pha, succession = "hiatus") plot(pha, succession = "transition")
A statistical graphic designed for the archaeological study of rhythms of the long term that embodies a theory of archaeological evidence for the occurrence of events.
tempo(object, ...) ## S4 method for signature 'CumulativeEvents,missing' plot( x, calendar = getOption("ArchaeoPhases.calendar"), interval = c("credible", "gauss"), col.tempo = "#004488", col.interval = "grey", main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... ) ## S4 method for signature 'EventsMCMC' tempo( object, level = 0.95, count = FALSE, credible = TRUE, gauss = TRUE, from = min(object), to = max(object), grid = getOption("ArchaeoPhases.grid") )
tempo(object, ...) ## S4 method for signature 'CumulativeEvents,missing' plot( x, calendar = getOption("ArchaeoPhases.calendar"), interval = c("credible", "gauss"), col.tempo = "#004488", col.interval = "grey", main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... ) ## S4 method for signature 'EventsMCMC' tempo( object, level = 0.95, count = FALSE, credible = TRUE, gauss = TRUE, from = min(object), to = max(object), grid = getOption("ArchaeoPhases.grid") )
object |
An |
... |
Other graphical parameters may also be passed as arguments to this function. |
x |
A |
calendar |
A |
interval |
A |
col.tempo , col.interval
|
A specification for the plotting colors. |
main |
A |
sub |
A |
ann |
A |
axes |
A |
frame.plot |
A |
panel.first |
An an |
panel.last |
An |
level |
A length-one |
count |
A |
credible |
A |
gauss |
A |
from |
A length-one |
to |
A length-one |
grid |
A length-one |
The tempo plot is one way to measure change over time: it estimates the cumulative occurrence of archaeological events in a Bayesian calibration. The tempo plot yields a graphic where the slope of the plot directly reflects the pace of change: a period of rapid change yields a steep slope and a period of slow change yields a gentle slope. When there is no change, the plot is horizontal. When change is instantaneous, the plot is vertical.
tempo()
returns an CumulativeEvents
object.
plot()
is called it for its side-effects: it results in a graphic being
displayed (invisibly returns x
).
A. Philippe, M.-A. Vibet, T. S. Dye, N. Frerebeau
Dye, T. S. (2016). Long-term rhythms in the development of Hawaiian social stratification. Journal of Archaeological Science, 71: 1-9. doi:10.1016/j.jas.2016.05.006.
Other event tools:
activity()
,
elapse()
,
occurrence()
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Tempo plot tmp <- tempo(eve) plot(tmp) plot(tmp, interval = "credible", panel.first = grid()) plot(tmp, interval = "gauss", panel.first = grid()) ## Activity plot act <- activity(tmp) plot(act, panel.first = grid())
## Coerce to MCMC eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Tempo plot tmp <- tempo(eve) plot(tmp) plot(tmp, interval = "credible", panel.first = grid()) plot(tmp, interval = "gauss", panel.first = grid()) ## Activity plot act <- activity(tmp) plot(act, panel.first = grid())
Estimates the transition endpoints between two phases.
transition(x, y, ...) ## S4 method for signature 'numeric,numeric' transition(x, y, level = 0.95) ## S4 method for signature 'PhasesMCMC,missing' transition(x, level = 0.95)
transition(x, y, ...) ## S4 method for signature 'numeric,numeric' transition(x, y, level = 0.95) ## S4 method for signature 'PhasesMCMC,missing' transition(x, level = 0.95)
x , y
|
A |
... |
Currently not used. |
level |
A length-one |
The transition is the shortest interval that satisfies
.
This assumes that the phases are in temporal order constraint.
The endpoints of the transition interval for each pair of successive phases
(at a given level
).
transition(x = numeric, y = numeric)
: Returns a length-two numeric
vector
(terminal times of the transition interval).
transition(x = PhasesMCMC, y = missing)
: Returns a TimeRange
object.
A. Philippe, M.-A. Vibet, N. Frerebeau
Other time ranges:
boundaries()
,
hiatus()
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Compute min-max range by group pha <- phases(eve, groups = list(A = c(1, 3), B = c(2, 4))) ## Compute phase ranges bou <- boundaries(pha) as.data.frame(bou) ## Compute phase transition tra <- transition(pha) as.data.frame(tra) ## Compute phase hiatus hia <- hiatus(pha) as.data.frame(hia)
## Coerce to events eve <- as_events(mcmc_events, calendar = CE(), iteration = 1) eve <- eve[1:10000, ] ## Compute min-max range by group pha <- phases(eve, groups = list(A = c(1, 3), B = c(2, 4))) ## Compute phase ranges bou <- boundaries(pha) as.data.frame(bou) ## Compute phase transition tra <- transition(pha) as.data.frame(tra) ## Compute phase hiatus hia <- hiatus(pha) as.data.frame(hia)