
Last chance! 50% off unlimited learning
Sale ends in
Pad and unpad changepoint sets with boundary points
pad_tau(tau, n)unpad_tau(padded_tau)
is_valid_tau(tau, n)
regions_tau(tau, n)
validate_tau(tau, n)
pad_tau()
: an integer
vector that starts with 0 and ends in
unpad_tau()
: an integer
vector stripped of its first and last entries.
is_valid_tau()
: a logical
if all of the entries are between 2 and
regions_tau()
: A base::factor()
validate_tau()
: an integer
vector with only the base::unique()
entries between 2 and
a numeric vector of changepoint indices
the length of the original time series
Output from pad_tau()
If a time series contains
pad_tau()
ensures that 1 and
unpad_tau()
removes 1 and
is_valid_tau()
checks to see if the supplied set of changepoints is valid
validate_tau()
removes duplicates and boundary values.
# Anything less than 2 is not allowed
is_valid_tau(0, length(DataCPSim))
is_valid_tau(1, length(DataCPSim))
# Duplicates are allowed
is_valid_tau(c(42, 42), length(DataCPSim))
is_valid_tau(826, length(DataCPSim))
# Anything greater than \eqn{n} (in this case 1096) is not allowed
is_valid_tau(1096, length(DataCPSim))
is_valid_tau(1097, length(DataCPSim))
# Always return a factor with half-open intervals on the right
regions_tau(c(42, 330), 1096)
# Anything less than 2 is not allowed
validate_tau(0, length(DataCPSim))
validate_tau(1, length(DataCPSim))
validate_tau(826, length(DataCPSim))
# Duplicates are removed
validate_tau(c(826, 826), length(DataCPSim))
# Anything greater than \eqn{n} (in this case 1096) is not allowed
validate_tau(1096, length(DataCPSim))
validate_tau(1097, length(DataCPSim))
# Fix many problems
validate_tau(c(-4, 0, 1, 4, 5, 5, 824, 1096, 1097, 182384), length(DataCPSim))
Run the code above in your browser using DataLab