Create surrogate time series with the same short-term time correlation and overall temporal pattern as the original time series using the Markov process described by Cazelles and Stones (2003)
surrogate.ts (ts, distr.ts = NULL, trans.ts = NULL, nbreaks = 10)
time series in matrix format (n
rows x 2 columns). The first column should contain the time
steps and the second column should contain the values. If ts
is a column vector
instead of a matrix, then it will be automatically converted to a matrix with
column 1 corresponding to a time index ranging from 1 to the length of ts
binning of time series values. This parameter must be specified
if trans.ts
is not set to NULL
. Default is NULL
.
transition matrix from bin \(i\) to bin \(j\). Default is NULL
.
number of bins to use to group the time series values. Default is 10
.
Returns a named list containing:
surrogate time series in matrix format
transition matrix \(M_{ij}\)
binning of time series values
The values of the time series \(x_n\) are grouped into nbreak
equally-sized bins.
The transition matrix \(M_{ij}\) describing the probability of \(x_{n+1}\) belonging to
bin \(j\) based on \(x_n\) belonging to bin \(i\) is defined using the relative
frequencies of the data such that:
\(M_{ij}=Pr(x_{n+1} \in b_{j} | x_{n} \in b_{i})\). The surrogate time series is then constructed
by randomly selecting a starting value and randomly selecting the next value from the proper bin
based on the transition matrix. This process is repeated until the surrogate time series has
the same length as the original time series.
Cazelles, B., and L. Stone. 2003. Detection of imperfect population synchrony in an uncertain world. Journal of Animal Ecology 72:953-968.
# NOT RUN {
t1=runif(100)
surr.t1=surrogate.ts(ts=t1)
plot(t1, t="l")
lines(surr.t1$surr.ts, col="red")
# }
Run the code above in your browser using DataLab