x: A binary string that encodes a changepoint set. See GA::gabin_Population().
tau: a numeric vector of changepoint indices
n: the length of the original time series
Returns
binary2tau(): an integer vector
tau2binary(): an integer vector of length n
Details
In order to use GA::ga() in a genetic algorithm, we need to encoude a changepoint set as a binary string.
binary2tau() takes a binary string representation of a changepoint set and converts it into a set of changepoint indices.
tau2binary() takes a set of changepoint indices the number of observations in the time series and converts them into a binary string representation of that changepoint set.
Examples
# Recover changepoint set indices from binary stringsbinary2tau(c(0,0,1,0,1))binary2tau(round(runif(10)))# Recover binary strings from changepoint set indicestau2binary(c(7,17), n =24)tau2binary(binary2tau(c(0,0,1,1,0,1)), n =6)