infer_unknown_changepoints {BCT}R Documentation

Inferring the number of change-points and their locations.

Description

This function implements the Metropolis-Hastings sampling algorithm for inferring the number of change-points and their locations.

Usage

infer_unknown_changepoints(
  input_data,
  l_max,
  depth,
  alphabet,
  iters,
  fileName = NULL
)

Arguments

input_data

the sequence to be analysed.

l_max

maximum number of change-points.

depth

maximum memory length.

alphabet

symbols appearing in the sequence.

iters

number of iterations; for more information see Lungu et al. (2022).

fileName

file path for storing the results.

Value

return a list object which includes:

number_changes

sampled number of change-points.

positions

sampled locations of the change-points.

acceptance_prob

the empirical acceptance ratio.

See Also

infer_fixed_changepoints

Examples

# Use as an example the three_changes dataset.
# Run the function with 5 change-points, a maximum depth of 5 and the [0,1,2] alphabet.
# The sampler is run for 100 iterations
output <- infer_unknown_changepoints(three_changes, 5, 5, c("012"), 100, fileName = NULL)

# If the fileName is not set to NULL, 
# the output file will contain on each line the sampled number of change-points 
# and the associated sampled locations of the change-points.

[Package BCT version 1.2 Index]