| Title: | Dynamics Similarity Coefficient |
|---|---|
| Description: | Implements the quantile-graph based Dynamics Similarity Coefficient (DSC) for comparing intrinsic dynamics of time series. |
| Authors: | Chun-Xiao Nie [aut, cre] (ORCID: <https://orcid.org/0000-0002-7790-0803>) |
| Maintainer: | Chun-Xiao Nie <[email protected]> |
| License: | GPL-3 |
| Version: | 1.1 |
| Built: | 2026-05-24 07:55:22 UTC |
| Source: | https://github.com/cran/dynasim |
Multivariate DSC (MDSC) Input: X and Y are matrices where columns are components
cross_transition_matrix(x, y, n_s = 15, lag = 1)cross_transition_matrix(x, y, n_s = 15, lag = 1)
x |
Numeric vector, first component. |
y |
Numeric vector, second component. |
n_s |
Integer, number of states. |
lag |
Integer, lag order. |
Matrix of dimension n_s x n_s.
Quantile discretization and transition probability matrix
discretize_quantile(x, n_s = 15)discretize_quantile(x, n_s = 15)
x |
Numeric vector representing the time series. |
n_s |
Integer, number of states (quantile bins). Default is 15. |
Integer vector of state labels (1 to n_s).
x <- rnorm(1000) states <- discretize_quantile(x, n_s = 10)x <- rnorm(1000) states <- discretize_quantile(x, n_s = 10)
Compute Dynamics Similarity Coefficient (DSC) between two time series
dsc(x, y, n_s = 15, lag = 1, th_step = 0.005)dsc(x, y, n_s = 15, lag = 1, th_step = 0.005)
x |
Numeric vector, first time series. |
y |
Numeric vector, second time series. |
n_s |
Integer, number of states. Default 15. |
lag |
Integer, lag order. Default 1. |
th_step |
Numeric, threshold step size. Default 0.005. |
A numeric value between 0 and 1, where higher values indicate greater similarity of intrinsic dynamics.
Nie, Chun-Xiao. "Distinguishing time series generated by different intrinsic dynamics using quantile graphs." Communications in Nonlinear Science and Numerical Simulation (2026): 110002.
x <- arima.sim(model = list(ar = 0.5), n = 1000) y <- arima.sim(model = list(ar = -0.5), n = 1000) dsc(x, y, n_s = 15, lag = 1)x <- arima.sim(model = list(ar = 0.5), n = 1000) y <- arima.sim(model = list(ar = -0.5), n = 1000) dsc(x, y, n_s = 15, lag = 1)
Compute pairwise DSC matrix for a collection of time series
dsc_matrix(X, n_s = 15, lag = 1, th_step = 0.005, show_progress = FALSE)dsc_matrix(X, n_s = 15, lag = 1, th_step = 0.005, show_progress = FALSE)
X |
Matrix with time series in columns (rows = time points). |
n_s |
Integer, number of states. |
lag |
Integer, lag order. |
th_step |
Numeric, threshold step size. |
show_progress |
Logical, whether to show a progress bar. |
A symmetric matrix of DSC values between columns.
n <- 1000 X <- matrix(0,n,4) X[,1]=arima.sim(model = list(ar = 0.5), n = n) X[,2]=arima.sim(model = list(ar = 0.5), n = n) X[,3]=arima.sim(model = list(ar = -0.5), n = n) X[,4]=arima.sim(model = list(ar = -0.5), n = n) dsc_matrix(X, n_s = 10,lag=1,th_step = 0.005)n <- 1000 X <- matrix(0,n,4) X[,1]=arima.sim(model = list(ar = 0.5), n = n) X[,2]=arima.sim(model = list(ar = 0.5), n = n) X[,3]=arima.sim(model = list(ar = -0.5), n = n) X[,4]=arima.sim(model = list(ar = -0.5), n = n) dsc_matrix(X, n_s = 10,lag=1,th_step = 0.005)
Global DSC (GDSC) across multiple lags
gdsc(x, y, n_s = 15, lags = 1:5, th_step = 0.005)gdsc(x, y, n_s = 15, lags = 1:5, th_step = 0.005)
x |
Numeric vector, first time series. |
y |
Numeric vector, second time series. |
n_s |
Integer, number of states. |
lags |
Vector of lag orders to include. |
th_step |
Numeric, threshold step size. |
Numeric, average DSC over specified lags.
Nie, Chun-Xiao. "Distinguishing time series generated by different intrinsic dynamics using quantile graphs." Communications in Nonlinear Science and Numerical Simulation (2026): 110002.
x <- arima.sim(model = list(ar = c(0.5, -0.3)), n = 1000) y <- arima.sim(model = list(ar = c(0.5, -0.3)), n = 1000) gdsc(x, y, n_s = 15, lags = 1:3)x <- arima.sim(model = list(ar = c(0.5, -0.3)), n = 1000) y <- arima.sim(model = list(ar = c(0.5, -0.3)), n = 1000) gdsc(x, y, n_s = 15, lags = 1:3)
Compute pairwise GDSC matrix for a collection of series
gdsc_matrix(X, n_s = 15, lags = 1:5, th_step = 0.005, show_progress = FALSE)gdsc_matrix(X, n_s = 15, lags = 1:5, th_step = 0.005, show_progress = FALSE)
X |
Matrix with time series in columns (rows = time points). |
n_s |
Integer, number of states. |
lags |
Vector of lag orders. |
th_step |
Numeric, threshold step size. |
show_progress |
Logical. |
Matrix of GDSC values between columns.
n <- 1000 X <- matrix(0,n,4) X[,1]=arima.sim(model = list(ar = 0.5), n = n) X[,2]=arima.sim(model = list(ar = 0.5), n = n) X[,3]=arima.sim(model = list(ar = -0.5), n = n) X[,4]=arima.sim(model = list(ar = -0.5), n = n) gdsc_matrix(X, n_s = 10,lags=1:3,th_step = 0.005)n <- 1000 X <- matrix(0,n,4) X[,1]=arima.sim(model = list(ar = 0.5), n = n) X[,2]=arima.sim(model = list(ar = 0.5), n = n) X[,3]=arima.sim(model = list(ar = -0.5), n = n) X[,4]=arima.sim(model = list(ar = -0.5), n = n) gdsc_matrix(X, n_s = 10,lags=1:3,th_step = 0.005)
Compute Multivariate Dynamics Similarity Coefficient (MDSC)
mdsc(X, Y, n_s = 15, lag = 1, th_step = 0.005)mdsc(X, Y, n_s = 15, lag = 1, th_step = 0.005)
X |
Matrix or data.frame, each column is a component time series. |
Y |
Matrix or data.frame, each column is a component time series. |
n_s |
Integer, number of states. |
lag |
Integer, lag order. |
th_step |
Numeric, threshold step size. |
Numeric, MDSC value.
Nie, Chun-Xiao. "Distinguishing time series generated by different intrinsic dynamics using quantile graphs." Communications in Nonlinear Science and Numerical Simulation (2026): 110002.
X <- matrix(rnorm(3000), ncol = 3) Y <- matrix(rnorm(3000), ncol = 3) mdsc(X, Y, n_s = 10)X <- matrix(rnorm(3000), ncol = 3) Y <- matrix(rnorm(3000), ncol = 3) mdsc(X, Y, n_s = 10)
Compute state transition probability matrix for a given lag
transition_matrix(x, n_s = 15, lag = 1)transition_matrix(x, n_s = 15, lag = 1)
x |
Numeric vector, the time series. |
n_s |
Integer, number of states (quantile bins). Default 15. |
lag |
Integer, lag order for transition. Default 1. |
A matrix of dimension n_s x n_s with row-wise transition probabilities.
x <- arima.sim(model = list(ar = 0.5), n = 1000) P <- transition_matrix(x, n_s = 15, lag = 1)x <- arima.sim(model = list(ar = 0.5), n = 1000) P <- transition_matrix(x, n_s = 15, lag = 1)