### Install and Load tseriesChaos Package Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Installs the tseriesChaos package from CRAN and loads it along with its dependencies. The scatterplot3d package is optional for 3D visualization. ```r install.packages("tseriesChaos") library(tseriesChaos) library(deSolve) # For 3D visualization (optional) install.packages("scatterplot3d") library(scatterplot3d) ``` -------------------------------- ### Simulate Continuous Dynamical Systems with sim.cont Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Simulates continuous dynamical systems defined by ODEs using numerical integration. Requires specifying the ODE system function, time parameters, initial conditions, and parameters. An observation function can be provided to extract specific components or derived quantities. ```r # Simulate the Rossler system rossler_sim <- sim.cont( syst = rossler.syst, # ODE system function start.time = 0, # start time end.time = 650, # end time dt = 0.1, # time step between observations start.x = c(0, 0, 0), # initial conditions (x, y, z) parms = c(0.15, 0.2, 10), # parameters (a, b, c) obs.fun = function(x) x[1] # observe first component ) # Result is a time series object print(rossler_sim) plot(rossler_sim, main = "Rossler System - X Component") # Simulate the Lorenz system with Euclidean norm observation lorenz_sim <- sim.cont( syst = lorenz.syst, start.time = 0, end.time = 100, dt = 0.05, start.x = c(5, 5, 5), parms = c(10, 28, -8/3), # sigma, rho, beta obs.fun = function(x) sqrt(sum(x^2)) # observe ||(x,y,z)|| ) plot(lorenz_sim, main = "Lorenz System - Euclidean Norm") # Simulate Duffing oscillator duffing_sim <- sim.cont( syst = duffing.syst, start.time = 0, end.time = 500, dt = 0.05, start.x = c(0, 0, 0), parms = c(0.2, 0.3, 1.0) # damping, forcing amplitude, forcing frequency ) plot(duffing_sim, main = "Duffing Oscillator") ``` -------------------------------- ### ODE Systems and Datasets Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Access pre-defined ODE systems (lorenz.syst, rossler.syst, duffing.syst) and pre-computed sample datasets (lorenz.ts, rossler.ts). ```APIDOC ## ODE Systems and Datasets ### Description Provides access to classic chaotic attractor ODE definitions and pre-computed time series data for analysis. ### Available Systems - **lorenz.syst** - Lorenz attractor system - **rossler.syst** - Rossler attractor system - **duffing.syst** - Duffing oscillator system ### Available Datasets - **lorenz.ts** - Pre-computed Lorenz time series - **rossler.ts** - Pre-computed Rossler time series ``` -------------------------------- ### Complete Nonlinear Time Series Analysis Workflow Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Demonstrates a full analysis pipeline for nonlinear time series, including parameter estimation for embedding (delay and dimension) and phase space reconstruction. Requires `tseriesChaos` and `scatterplot3d` libraries. ```r library(tseriesChaos) library(scatterplot3d) # Step 1: Generate or load time series data(lorenz.ts) plot(lorenz.ts, main = "Step 1: Raw Time Series") # Step 2: Determine optimal time delay using mutual information ami <- mutual(lorenz.ts, lag.max = 30, plot = TRUE) # First minimum suggests d = 2 d_opt <- 2 # Step 3: Determine embedding dimension using false nearest neighbors fn <- false.nearest(lorenz.ts, m = 8, d = d_opt, t = 40, rt = 10) plot(fn) # Fraction drops near zero at m = 3 m_opt <- 3 # Step 4: Verify parameters with space-time separation plot stplot(lorenz.ts, m = m_opt, d = d_opt, mdt = 100) # Confirms Theiler window t ≈ 40 is appropriate # Step 5: Reconstruct phase space embedded <- embedd(lorenz.ts, m = m_opt, d = d_opt) scatterplot3d(embedded, type = "l", color = "darkblue", main = "Reconstructed Attractor") # Step 6: Estimate correlation dimension d2_out <- d2(lorenz.ts, m = 6, d = d_opt, t = 40, eps.min = 1) plot(d2_out) # D2 ≈ 2.05 for Lorenz attractor ``` -------------------------------- ### sim.cont - Simulate Continuous Dynamical Systems Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Simulates continuous dynamical systems defined by ODEs using numerical integration (lsoda from deSolve package). ```APIDOC ## sim.cont ### Description Simulates continuous dynamical systems defined by ODEs using numerical integration. ### Parameters #### Request Body - **syst** (function) - Required - ODE system function - **start.time** (numeric) - Required - Start time of simulation - **end.time** (numeric) - Required - End time of simulation - **dt** (numeric) - Required - Time step between observations - **start.x** (vector) - Required - Initial conditions (x, y, z) - **parms** (vector) - Required - Parameters for the ODE system - **obs.fun** (function) - Optional - Observation function to apply to the state vector ### Response #### Success Response (200) - **result** (ts) - A time series object representing the simulated system. ``` -------------------------------- ### Lyapunov Exponent Estimation (lyap_k and lyap) Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Estimates the maximal Lyapunov exponent using Kantz's algorithm. A positive Lyapunov exponent indicates chaotic behavior. ```APIDOC ## lyap_k and lyap - Lyapunov Exponent Estimation ### Description Estimates the maximal Lyapunov exponent using Kantz's algorithm. A positive Lyapunov exponent indicates chaotic behavior - nearby trajectories diverge exponentially. ### Method `lyap_k` computes the stretching factor over time. `lyap` fits a linear regression to the scaling region of the `lyap_k` output to estimate the exponent. ### Parameters for `lyap_k` - **lorenz.ts** (time series) - The input time series data. - **m** (integer) - Embedding dimension. - **d** (integer) - Time delay. - **s** (integer) - Number of iterations to follow neighbors. - **t** (integer) - Theiler window. - **ref** (integer) - Number of reference points. - **k** (integer) - Number of neighbors to consider. - **eps** (numeric) - Search radius for neighbors. ### Parameters for `lyap` - **output** (numeric) - Output from `lyap_k`. - **start** (numeric) - Start time bound for the linear region. - **end** (numeric) - End time bound for the linear region. ### Request Example (R) ```r # Load Lorenz time series data(lorenz.ts) # Compute stretching factor output <- lyap_k(lorenz.ts, m = 3, d = 2, s = 200, t = 40, ref = 1700, k = 2, eps = 4) # Fit linear regression to estimate Lyapunov exponent lyap_estimate <- lyap(output, start = 0.73, end = 2.47) # The slope (second coefficient) is the Lyapunov exponent print(lyap_estimate) cat("Maximal Lyapunov exponent:", lyap_estimate[2], "\n") ``` ### Response - **lyap_estimate** (numeric vector) - Contains the intercept and the estimated Lyapunov exponent (lambda). ``` -------------------------------- ### Estimate Maximal Lyapunov Exponent using lyap_k and lyap Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Use lyap_k to compute the stretching factor over time and lyap to fit a linear regression to the scaling region for estimating the maximal Lyapunov exponent. Positive values indicate chaotic dynamics. ```r # Load Lorenz time series data(lorenz.ts) # Step 1: Compute the stretching factor over time using lyap_k # m: embedding dimension # d: time delay # s: number of iterations to follow neighbors # t: Theiler window # ref: number of reference points # k: number of neighbors to consider # eps: search radius for neighbors output <- lyap_k(lorenz.ts, m = 3, d = 2, s = 200, t = 40, ref = 1700, k = 2, eps = 4) #> Finding nearests #> Keeping 1687 reference points #> Following points # Plot the logarithm of stretching factor vs time plot(output, main = "Lyapunov Exponent Estimation", xlab = "Time", ylab = "log(stretching factor)") # Step 2: Fit linear regression to the scaling region # Identify the linear portion of the curve visually # start/end: time bounds for the linear region lyap_estimate <- lyap(output, start = 0.73, end = 2.47) # The slope (second coefficient) is the Lyapunov exponent print(lyap_estimate) #> (Intercept) lambda #> -0.123456 0.905678 # Positive value (~0.9 for Lorenz) confirms chaotic dynamics cat("Maximal Lyapunov exponent:", lyap_estimate[2], "\n") #> Maximal Lyapunov exponent: 0.905678 # Add regression line to plot abline(lyap_estimate[1], lyap_estimate[2], col = "red", lwd = 2) ``` -------------------------------- ### ODE Systems for Chaotic Attractors Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Provides pre-defined ODE systems for classic chaotic attractors like Lorenz, Rossler, and Duffing. These systems are intended for use with the `sim.cont` function for simulation. ```r # Lorenz system: dx/dt = a(y-x), dy/dt = x(b-z)-y, dz/dt = xy+cz # Classic parameters: a=10 (sigma), b=28 (rho), c=-8/3 (beta) # Generate Lorenz attractor lorenz_data <- sim.cont(lorenz.syst, 0, 50, 0.01, start.x = c(1, 1, 1), parms = c(10, 28, -8/3), obs.fun = function(x) x) # observe all components # Note: obs.fun returning vector gives multivariate output # For 3D visualization, use the built-in sample data data(lorenz.ts) # Rossler system: dx/dt = -(y+z), dy/dt = x+ay, dz/dt = b+z(x-c) # Classic parameters: a=0.15, b=0.2, c=10 data(rossler.ts) # Pre-computed sample plot(rossler.ts, main = "Rossler Time Series") # Duffing oscillator (forced nonlinear oscillator) # Used for studying driven chaotic oscillations duffing_ts <- sim.cont(duffing.syst, 0, 200, 0.05, start.x = c(0.1, 0, 0), parms = c(0.25, 0.3, 1.0)) ``` -------------------------------- ### Sample Datasets: Lorenz and Rossler Time Series Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Provides pre-computed time series data from the Lorenz and Rossler systems. These datasets are useful for immediate analysis and demonstrating package functionalities. They are standard R time series objects. ```r # Load Lorenz sample data # Euclidean norm observation of Lorenz system # Generated with: parms = c(10, 28, -8/3), dt = 0.05, duration = 100 data(lorenz.ts) summary(lorenz.ts) #> Min. 1st Qu. Median Mean 3rd Qu. Max. #> 8.123 28.456 34.567 33.890 40.123 52.345 plot(lorenz.ts, main = "Lorenz Time Series (Norm)") # Load Rossler sample data # First component observation of Rossler system # Generated with: parms = c(0.15, 0.2, 10), dt = 0.1, duration = 650 data(rossler.ts) summary(rossler.ts) #> Min. 1st Qu. Median Mean 3rd Qu. Max. #> -9.1234 -5.6789 -1.2345 -0.5678 4.3210 9.8765 plot(rossler.ts, main = "Rossler Time Series (X component)") # Both datasets are time series objects with proper time attributes tsp(lorenz.ts) # start, end, frequency #> [1] 0.00 100.00 20.00 tsp(rossler.ts) #> [1] 0.0 650.0 10.0 ``` -------------------------------- ### Estimate Lyapunov Exponent and Visualize Recurrence Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Computes the Lyapunov exponent for a time series and generates a recurrence plot to analyze system dynamics. ```R lyap_out <- lyap_k(lorenz.ts, m = m_opt, d = d_opt, s = 200, t = 40, ref = 1500, k = 2, eps = 4) plot(lyap_out) lyap_coef <- lyap(lyap_out, 0.5, 2.5) cat("Lyapunov exponent:", lyap_coef[2], "\n") # λ ≈ 0.9 confirms chaotic dynamics # Step 8: Visualize recurrence structure recurr(lorenz.ts, m = m_opt, d = d_opt, start.time = 20, end.time = 25) ``` -------------------------------- ### Compute Average Mutual Information (AMI) Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Estimates the average mutual information of a time series to determine the optimal time delay for phase space reconstruction. The 'plot = TRUE' argument visualizes the AMI, and the results are returned invisibly. Custom plotting is also supported. ```r # Load sample Lorenz time series data data(lorenz.ts) # Compute average mutual information for lags 0-20 # partitions: number of bins for histogram estimation (default 16) # lag.max: maximum lag to compute (default 20) ami_result <- mutual(lorenz.ts, partitions = 16, lag.max = 20, plot = TRUE) # The AMI values for each lag are returned invisibly print(ami_result) #> 0 1 2 3 4 5 #> 2.4891320 2.2234567 1.9876543 1.7654321 1.5432109 1.3456789 #> ... # First minimum indicates optimal time delay # Look for the first local minimum in the plot # In this case, d = 2 is often a good choice for Lorenz data # Compute AMI without plotting ami_silent <- mutual(lorenz.ts, lag.max = 30, plot = FALSE) # Custom plotting plot(ami_silent, main = "AMI for Lorenz System") ``` -------------------------------- ### Determine Embedding Dimension with False Nearest Neighbors Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Implements the false nearest neighbors method to find the optimal embedding dimension. Requires the time delay parameter 'd' from AMI analysis. The 'rt' and 'eps' parameters control the escape factor threshold and neighborhood diameter, respectively. Results are returned as a matrix showing the fraction of false neighbors and total neighbors for each dimension. ```r # Load sample Rossler time series data(rossler.ts) # Compute false nearest neighbors # m: maximum embedding dimension to test # d: time delay parameter (from mutual information analysis) # t: Theiler window (minimum temporal separation) # rt: escape factor threshold (default 10) # eps: neighborhood diameter (default sd(series)/10) fn_result <- false.nearest(rossler.ts, m = 6, d = 8, t = 180, eps = 1, rt = 3) # View results - matrix with: # Row 1: Fraction of false neighbors for each dimension # Row 2: Total number of neighbors found print(fn_result) #> 1 2 3 4 5 6 #> [1,] 0.9876543 0.5432109 0.0234567 0.0012345 0.0001234 0.0000123 #> [2,] 1500 1423 1356 1298 1245 1198 # Plot the false nearest neighbors ratio plot(fn_result) # The embedding dimension where false neighbors drops to near zero # is the optimal choice (typically m = 3 for Rossler system) ``` -------------------------------- ### Embed Time Series for Phase Space Reconstruction Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Reconstructs phase space by embedding a univariate or multivariate time series using time-delay coordinates. The 'm' parameter specifies the embedding dimension and 'd' the time delay. Custom lags can also be provided. The function returns a matrix of lagged series, suitable for visualization of attractors. ```r # Load Rossler time series data(rossler.ts) # Window the data to exclude transient behavior x <- window(rossler.ts, start = 90) # Embed with dimension m=3 and delay d=8 # Returns a matrix with m columns of lagged series xyz <- embedd(x, m = 3, d = 8) # View the embedded matrix structure head(xyz) #> V1/0 V1/8 V1/16 #> [1,] -6.234567 -8.123456 2.345678 #> [2,] -6.345678 -7.890123 3.456789 #> [3,] -6.456789 -7.654321 4.567890 #> ... # Visualize the reconstructed attractor in 3D library(scatterplot3d) scatterplot3d(xyz, type = "l", color = "blue", main = "Rossler Attractor (Reconstructed)", xlab = "x(t)", ylab = "x(t+d)", zlab = "x(t+2d)") # Custom lags can be specified directly custom_embed <- embedd(x, lags = c(0, 5, 10, 15)) # Embedding multivariate time series series <- cbind(seq(1, 50), seq(101, 150)) colnames(series) <- c("X", "Y") mv_embed <- embedd(series, m = 6, d = 1) head(mv_embed) #> X/0 Y/0 X/1 Y/1 X/2 Y/2 X/3 Y/3 X/4 Y/4 X/5 Y/5 #> [1,] 1 101 2 102 3 103 4 104 5 105 6 106 #> ... ``` -------------------------------- ### Sample Correlation Integral (C2) Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Computes the correlation integral at a single length scale. For comprehensive analysis, use `d2()` instead which evaluates multiple scales efficiently. ```APIDOC ## C2 - Sample Correlation Integral (Single Scale) ### Description Computes the correlation integral at a single length scale. For comprehensive analysis, use `d2()` instead which evaluates multiple scales efficiently. ### Parameters - **lorenz.ts** (time series) - The input time series data. - **m** (integer) - Embedding dimension. - **d** (integer) - Time delay. - **t** (integer) - Theiler window. - **eps** (numeric) - The specific length scale at which to compute the correlation integral. ### Request Example (R) ```r # Load Lorenz data data(lorenz.ts) # Compute correlation integral at specific length scale c2_value <- C2(lorenz.ts, m = 3, d = 2, t = 40, eps = 5) print(c2_value) # Compare at different scales scales <- c(1, 2, 5, 10, 20) c2_values <- sapply(scales, function(e) C2(lorenz.ts, m = 3, d = 2, t = 40, eps = e)) names(c2_values) <- scales print(c2_values) ``` ### Response - **c2_value** (numeric) - The fraction of point pairs closer than `eps`. ``` -------------------------------- ### Space-Time Separation Plot (stplot) Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Creates a space-time separation plot to determine the optimal Theiler window parameter. Shows probability contours of point distances as a function of temporal separation. ```APIDOC ## stplot - Space-Time Separation Plot ### Description Creates a space-time separation plot to determine the optimal Theiler window parameter. Shows probability contours of point distances as a function of temporal separation. ### Parameters - **rossler.ts** (time series) - The input time series data. - **m** (integer) - Embedding dimension. - **d** (integer) - Time delay. - **idt** (integer) - Observation steps per iteration. - **mdt** (integer) - Number of time iterations. ### Request Example (R) ```r # Load Rossler time series data(rossler.ts) # Generate space-time separation plot stplot(rossler.ts, m = 3, d = 8, idt = 1, mdt = 250) ``` ### Response Generates a plot visualizing probability contours. The Theiler window `t` should be chosen where lines become approximately horizontal, indicating decayed temporal correlations. ``` -------------------------------- ### Generate Recurrence Plot using recurr Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Generates a recurrence plot showing the distance matrix of embedded vectors, revealing structural patterns and periodicities in the dynamics. Warning: Memory usage scales as n^2 for n points. Diagonal patterns indicate deterministic structure, while vertical/horizontal lines indicate laminar states. ```r # Load Lorenz time series data(lorenz.ts) # Generate recurrence plot # m: embedding dimension # d: time delay # start.time/end.time: time window (in time units) # Warning: Memory usage scales as n^2 for n points recurr(lorenz.ts, m = 3, d = 2, start.time = 15, end.time = 20) # Color scale: white = maximum distance, black = minimum distance # Diagonal patterns indicate deterministic structure # Vertical/horizontal lines indicate laminar states # For longer time series, use a smaller window recurr(lorenz.ts, m = 3, d = 2, start.time = 10, end.time = 12) ``` -------------------------------- ### Generate Space-Time Separation Plot using stplot Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Creates a space-time separation plot to determine the optimal Theiler window parameter. The plot shows probability contours of point distances as a function of temporal separation. Choose the Theiler window where temporal correlations have decayed (lines become horizontal). ```r # Load Rossler time series data(rossler.ts) # Generate space-time separation plot # m: embedding dimension # d: time delay # idt: observation steps per iteration # mdt: number of time iterations stplot(rossler.ts, m = 3, d = 8, idt = 1, mdt = 250) # The plot shows iso-probability lines at 10%, 20%, ..., 100% # The Theiler window t should be chosen where lines become approximately # horizontal (temporal correlations have decayed) # For Rossler system, t ≈ 180 is typically appropriate ``` -------------------------------- ### false.nearest - False Nearest Neighbors Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Implements the method of false nearest neighbors to determine the optimal embedding dimension for a time series. ```APIDOC ## false.nearest ### Description Implements the method of false nearest neighbors to determine the optimal embedding dimension. Points that appear as neighbors in low-dimensional embeddings but diverge in higher dimensions are considered "false" neighbors. ### Parameters - **series** (numeric vector) - Required - The time series data. - **m** (integer) - Required - Maximum embedding dimension to test. - **d** (integer) - Required - Time delay parameter. - **t** (integer) - Required - Theiler window (minimum temporal separation). - **eps** (numeric) - Optional - Neighborhood diameter (default sd(series)/10). - **rt** (numeric) - Optional - Escape factor threshold (default 10). ### Request Example fn_result <- false.nearest(rossler.ts, m = 6, d = 8, t = 180, eps = 1, rt = 3) ``` -------------------------------- ### Recurrence Plot (recurr) Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Generates a recurrence plot showing the distance matrix of embedded vectors. Reveals structural patterns and periodicities in the dynamics. ```APIDOC ## recurr - Recurrence Plot ### Description Generates a recurrence plot showing the distance matrix of embedded vectors. Reveals structural patterns and periodicities in the dynamics. ### Parameters - **lorenz.ts** (time series) - The input time series data. - **m** (integer) - Embedding dimension. - **d** (integer) - Time delay. - **start.time** (numeric) - Start time window (in time units). - **end.time** (numeric) - End time window (in time units). ### Request Example (R) ```r # Load Lorenz time series data(lorenz.ts) # Generate recurrence plot for a specific window recurr(lorenz.ts, m = 3, d = 2, start.time = 15, end.time = 20) # Generate recurrence plot for a different window recurr(lorenz.ts, m = 3, d = 2, start.time = 10, end.time = 12) ``` ### Response Generates a recurrence plot. The color scale ranges from white (maximum distance) to black (minimum distance). Diagonal patterns indicate deterministic structure, while vertical/horizontal lines suggest laminar states. ``` -------------------------------- ### embedd - Time Series Embedding Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Reconstructs phase space by embedding a univariate or multivariate time series using time-delay coordinates. ```APIDOC ## embedd ### Description Reconstructs phase space by embedding a univariate time series using time-delay coordinates. Supports both univariate and multivariate time series. ### Parameters - **x** (numeric vector/matrix) - Required - The time series data. - **m** (integer) - Optional - Embedding dimension. - **d** (integer) - Optional - Time delay. - **lags** (vector) - Optional - Custom lags to be specified directly. ### Request Example xyz <- embedd(x, m = 3, d = 8) ``` -------------------------------- ### Compute Sample Correlation Integral at Single Scale using C2 Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Computes the correlation integral at a single length scale, returning the fraction of point pairs closer than eps. For dimension estimation, d2() is more appropriate as it evaluates multiple scales efficiently. ```r # Load Lorenz data data(lorenz.ts) # Compute correlation integral at specific length scale # Returns fraction of point pairs closer than eps c2_value <- C2(lorenz.ts, m = 3, d = 2, t = 40, eps = 5) print(c2_value) #> [1] 0.1234567 # Useful for quick checks or specific scale analysis # For dimension estimation, d2() is more appropriate # Compare at different scales scales <- c(1, 2, 5, 10, 20) c2_values <- sapply(scales, function(e) C2(lorenz.ts, m = 3, d = 2, t = 40, eps = e)) names(c2_values) <- scales print(c2_values) #> 1 2 5 10 20 #> 0.01234567 0.04567890 0.12345678 0.34567890 0.67890123 ``` -------------------------------- ### mutual - Average Mutual Information Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Estimates the average mutual information (AMI) index of a time series to determine the optimal time delay parameter for phase space reconstruction. ```APIDOC ## mutual ### Description Estimates the average mutual information (AMI) index of a time series for a specified number of lags. The first minimum of the AMI is commonly used to determine the optimal time delay parameter for phase space reconstruction. ### Parameters - **series** (numeric vector) - Required - The time series data. - **partitions** (integer) - Optional - Number of bins for histogram estimation (default 16). - **lag.max** (integer) - Optional - Maximum lag to compute (default 20). - **plot** (logical) - Optional - Whether to plot the results (default TRUE). ### Request Example ami_result <- mutual(lorenz.ts, partitions = 16, lag.max = 20, plot = TRUE) ``` -------------------------------- ### Correlation Dimension (d2) Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Computes the sample correlation integral over multiple length scales and embedding dimensions. The slope in the scaling region of the log-log plot estimates the correlation dimension. ```APIDOC ## d2 - Correlation Dimension ### Description Computes the sample correlation integral over multiple length scales and embedding dimensions. The slope in the scaling region of the log-log plot estimates the correlation dimension. ### Parameters - **lorenz.ts** (time series) - The input time series data. - **m** (integer) - Maximum embedding dimension. - **d** (integer) - Time delay. - **t** (integer) - Theiler window. - **eps.min** (numeric) - Minimum length scale. - **neps** (integer, optional) - Number of length scales (default 100). ### Request Example (R) ```r # Load Lorenz time series data(lorenz.ts) # Compute correlation integral d2_result <- d2(lorenz.ts, m = 6, d = 2, t = 4, eps.min = 2) # Plot in log-log scale plot(d2_result) ``` ### Response - **d2_result** (matrix) - A matrix where: - Column 1: length scales (epsilon) - Columns 2 to m+1: correlation integral C(eps) for dimensions 1 to m. ``` -------------------------------- ### Compute Correlation Dimension using d2 Source: https://context7.com/antoniofabio/tserieschaos/llms.txt Computes the sample correlation integral over multiple length scales and embedding dimensions. The slope in the log-log plot estimates the correlation dimension. Use d2() for comprehensive analysis as it evaluates multiple scales efficiently. ```r # Load Lorenz time series data(lorenz.ts) # Compute correlation integral # m: maximum embedding dimension # d: time delay # t: Theiler window # eps.min: minimum length scale # neps: number of length scales (default 100) d2_result <- d2(lorenz.ts, m = 6, d = 2, t = 4, eps.min = 2) # Result is a matrix: # Column 1: length scales (epsilon) # Columns 2 to m+1: correlation integral C(eps) for dimensions 1 to m head(d2_result) #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] #> [1,] 2.000000 0.001234567 0.000123456 0.000012345 0.000001234 0.000000123 0.000000012 #> [2,] 2.123456 0.001345678 0.000134567 0.000013456 0.000001345 0.000000134 0.000000013 #> ... # Plot in log-log scale # Lines should converge to a common slope at intermediate scales plot(d2_result) # The correlation dimension D2 ≈ 2.05 for the Lorenz attractor # Estimated from the slope of the linear scaling region ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.