Computes the shortest interval that satisfies $$P(PhaseMin < IntervalInf < IntervalSup < PhaseMax | M) = level$$ for each phase.

## Usage

boundaries(x, y, ...)

# S4 method for numeric,numeric
boundaries(x, y, level = 0.95)

# S4 method for PhasesMCMC,missing
boundaries(x, level = 0.95)

## Arguments

x, y

A numeric vector. If y is missing, x must be an PhasesMCMC object.

...

Currently not used.

level

A length-one numeric vector giving the confidence level.

## Value

A data.frame containing the endpoints (in years BC/AD) of the shortest time range (at a given level).

Other phase tools: duration(), phase(), transition()

## Author

A. Philippe, M.-A. Vibet, N. Frerebeau

## Examples

## Coerce to MCMC
eve <- as_events(events, calendar = "CE", iteration = 1)
eve <- eve[1:10000, ]

## Compute min-max range by group
## Unless otherwise specified, the phases are assumed to be unordered
pha <- phase(eve, groups = list(A = c(1, 3), B = c(2, 4)))

## Compute phase ranges
boundaries(pha)
#>       lower      upper
#> A -1046.091  -202.1504
#> B -1972.281 -1078.0925

## Compute phase transition
tra <- transition(pha)
as.data.frame(tra)
#>        lower     upper duration
#> B-A -1409.47 -501.6004 907.8698

## Compute phase hiatus
hia <- hiatus(pha)
as.data.frame(hia)
#>         lower     upper duration
#> B-A -1062.599 -1046.091 16.50864

## Compute phase duration
dur <- duration(pha)
summary(dur)
#>   mad mean  sd min  q1 median  q3  max lower upper
#> A 270  251 135   0 151    247 342  835     1   482
#> B 547  552 130   4 466    553 640 1156   291   800