Skip to contents

Naming Conventions

The package follows these naming conventions:

  • distantia() and distantia_...(): functions to assess time series dissimilarity via dynamic time warping or lock-step methods.
  • psi_...(): step-by-step demonstration of how psi dissimilarity scores are computed.
  • tsl_...(): functions to generate, process, and explore time series lists (TSLs).
  • f_...(): transformation functions used as input arguments for other functions.
  • zoo_...(): functions to manage zoo time series.
  • utils_...(): internal functions and helpers.
  • ..._cpp(): C++ core functions built via Rcpp for efficient dissimilarity analysis.

Example Time Series

Time series datasets from different disciplines.

albatross
Flight Path Time Series of Albatrosses in The Pacific
cities_coordinates
Coordinates of 100 Major Cities
cities_temperature
Long Term Monthly Temperature in 20 Major Cities
covid_coordinates
County Coordinates of the Covid Prevalence Dataset
covid_prevalence
Time Series of Covid Prevalence in California Counties
eemian_coordinates
Site Coordinates of Nine Interglacial Sites in Central Europe
eemian_pollen
Pollen Counts of Nine Interglacial Sites in Central Europe
fagus_coordinates
Site Coordinates of Fagus sylvatica Stands
fagus_dynamics
Time Series Data from Three Fagus sylvatica Stands

Time Series Simulation

Functions to generate simulated time series.

tsl_simulate()
Simulate a Time Series List
zoo_simulate()
Simulate a Zoo Time Series

Core Functions for Time Series Dissimilarity Analysis

Functions to compare time series and assess the partial contribution of individual variables to dissimilarity.

distantia()
Dissimilarity Analysis of Time Series Lists
distantia_importance()
Contribution of Individual Variables to Dissimilarity in Time Series Lists

Support Functions for Dissimilarity Analysis

These functions use the output of distantia() or distantia_importance() to enhance dissimilarity analysis by adding plotting, clustering, and mapping capabilities.

distantia_aggregate()
Aggregate Dissimilarity Analysis Data Frames Across Parameter Combinations
distantia_boxplot()
Boxplot of Dissimilarity Analysis Data Frames
distantia_cluster_hclust()
Hierarchical Clustering of Dissimilarity Analysis Data Frames
distantia_cluster_kmeans()
K-Means Clustering of Dissimilarity Analysis Data Frames
distantia_matrix()
Convert Dissimilarity Analysis Data Frame to Distance Matrix
distantia_plot()
Two-Way Dissimilarity Plots of Time Series Lists
distantia_to_sf()
Convert Dissimilarity Analysis Data Frames to Spatial Dissimilarity Networks
utils_block_size()
Default Block Size for Restricted Permutation in Dissimilarity Analyses
utils_cluster_hclust_optimizer()
Optimize the Silhouette Width of Hierarchical Clustering Solutions
utils_cluster_kmeans_optimizer()
Optimize the Silhouette Width of K-Means Clustering Solutions
utils_cluster_silhouette()
Compute Silhouette Width of a Clustering Solution
utils_importance_df_to_wide()
Data Frame with Contribution of Individual Variables to Dissimilarity to Wide Format

C++ Backend for Dissimilarity Analysis

These functions, designed to boost the computational efficiency of the package, implement all dissimilarity methods available in distantia() and distantia_importance().

null_psi_dynamic_time_warping_cpp()
(C++) Null Distribution of Dissimilarity Scores of Two Time Series
null_psi_lock_step_cpp()
(C++) Null Distribution of the Dissimilarity Scores of Two Aligned Time Series
psi_dynamic_time_warping_cpp()
(C++) Psi Dissimilarity Score of Two Time-Series
psi_equation_cpp()
(C++) Equation of the Psi Dissimilarity Score
psi_lock_step_cpp()
(C++) Psi Dissimilarity Score of Two Aligned Time Series
importance_dynamic_time_warping_legacy_cpp()
(C++) Contribution of Individual Variables to the Dissimilarity Between Two Time Series (Legacy Version)
importance_dynamic_time_warping_robust_cpp()
(C++) Contribution of Individual Variables to the Dissimilarity Between Two Time Series (Robust Version)
importance_lock_step_cpp()
(C++) Contribution of Individual Variables to the Dissimilarity Between Two Aligned Time Series
permute_free_by_row_cpp()
(C++) Unrestricted Permutation of Complete Rows
permute_free_cpp()
(C++) Unrestricted Permutation of Cases
permute_restricted_by_row_cpp()
(C++) Restricted Permutation of Complete Rows Within Blocks
permute_restricted_cpp()
(C++) Restricted Permutation of Cases Within Blocks
cost_matrix_diagonal_cpp()
(C++) Compute Orthogonal and Diagonal Least Cost Matrix from a Distance Matrix
cost_matrix_diagonal_weighted_cpp()
(C++) Compute Orthogonal and Weighted Diagonal Least Cost Matrix from a Distance Matrix
cost_matrix_orthogonal_cpp()
(C++) Compute Orthogonal Least Cost Matrix from a Distance Matrix
distance_lock_step_cpp()
(C++) Sum of Pairwise Distances Between Cases in Two Aligned Time Series
distance_matrix_cpp()
(C++) Distance Matrix of Two Time Series
auto_distance_cpp()
(C++) Sum Distances Between Consecutive Samples in a Time Series
auto_sum_cpp()
(C++) Sum Distances Between Consecutive Samples in Two Time Series
auto_sum_full_cpp()
(C++) Sum Distances Between All Consecutive Samples in Two Time Series
auto_sum_path_cpp()
(C++) Sum Distances Between All Consecutive Samples in the Least Cost Path Between Two Time Series
subset_matrix_by_rows_cpp()
(C++) Subset Matrix by Rows
cost_path_cpp()
Find Least Cost Path within a Least Cost Matrix
cost_path_diagonal_cpp()
(C++) Find Orthogonal And Diagonal Least Cost Path within a Least Cost Matrix
cost_path_orthogonal_cpp()
(C++) Find Orthogonal Least Cost Path within a Least Cost Matrix
cost_path_slotting_cpp()
(C++) Least Cost Path for Sequence Slotting
cost_path_sum_cpp()
(C++) Sum Distances in a Least Cost Path
cost_path_trim_cpp()
(C++) Remove Blocks from a Least Cost Path
distance_canberra_cpp()
(C++) Canberra Distance Between Two Binary Vectors
distance_chebyshev_cpp()
(C++) Chebyshev Distance Between Two Vectors
distance_chi_cpp()
(C++) Normalized Chi Distance Between Two Vectors
distance_cosine_cpp()
(C++) Cosine Dissimilarity Between Two Vectors
distance_euclidean_cpp()
(C++) Euclidean Distance Between Two Vectors
distance_hamming_cpp()
(C++) Hamming Distance Between Two Binary Vectors
distance_hellinger_cpp()
(C++) Hellinger Distance Between Two Vectors
distance_jaccard_cpp()
(C++) Jaccard Distance Between Two Binary Vectors
distance_manhattan_cpp()
(C++) Manhattan Distance Between Two Vectors
distance_russelrao_cpp()
(C++) Russell-Rao Distance Between Two Binary Vectors

Psi Demo Functions

Step-by-step demonstration of Psi dissimilarity scores. These functions are R wrappers of several key C++ functions above.

distance()
Distance Between Numeric Vectors
distances
Distance Methods
psi_auto_distance()
Cumulative Sum of Distances Between Consecutive Cases in a Time Series
psi_auto_sum()
Auto Sum
psi_cost_matrix()
Cost Matrix
psi_cost_path()
Least Cost Path
psi_cost_path_ignore_blocks()
Trims Blocks from a Least Cost Path
psi_cost_path_sum()
Sum of Distances in Least Cost Path
psi_distance_lock_step()
Lock-Step Distance
psi_distance_matrix()
Distance Matrix
psi_equation()
Normalized Dissimilarity Score

Create Time Series Lists

Transform raw time series data into time series lists (TSLs hereafter). TSLs are lists of zoo time series objects used within the package for data management and analysis.

tsl_initialize() tsl_init()
Transform Raw Time Series Data to Time Series List

Manage Time Series Lists

Functions manage, diagnose, repair TSLs.

tsl_colnames_clean()
Clean Column Names in Time Series Lists
tsl_colnames_get()
Get Column Names from a Time Series Lists
tsl_colnames_set()
Set Column Names in Time Series Lists
tsl_count_NA()
Count NA Cases in Time Series Lists
tsl_diagnose()
Diagnose Issues in Time Series Lists
tsl_handle_NA() tsl_Inf_to_NA() tsl_NaN_to_NA()
Handle NA Cases in Time Series Lists
tsl_names_clean()
Clean Time Series Names in a Time Series List
tsl_names_get()
Get Time Series Names from a Time Series Lists
tsl_names_set()
Set Time Series Names in a Time Series List
tsl_names_test()
Tests Naming Issues in Time Series Lists
tsl_ncol()
Get Number of Columns in Time Series Lists
tsl_nrow()
Get Number of Rows in Time Series Lists
tsl_repair()
Repair Issues in Time Series Lists
tsl_split()
Splits Multivariate Time Series Lists to Univariate TSLs
tsl_subset()
Subset Time Series Lists by Time Series Names, Time, and/or Column Names
tsl_time() tsl_time_summary()
Time Features of Time Series Lists
tsl_time_class_set()
Coerce Elements of Time Series List to same Time Class
tsl_to_df()
Transform Time Series List to Data Frame

Plot Time Series Lists

Main function to plot TSLs and its helpers.

tsl_plot()
Plot Time Series List

Processing Time Series Lists

Functions to transform, rescale, and aggregate TSLs.

tsl_aggregate()
Aggregate Cases in Time Series Lists
tsl_resample()
Resample Time Series Lists to a New Time
tsl_stats()
Summary Statistics of Time Series Lists
tsl_transform()
Transform Values in Time Series Lists
f_center()
Data Transformation: Data Centering by Column
f_detrend_difference()
Data Transformation: Differencing Detrending of Zoo Time Series
f_detrend_linear()
Data Transformation: Linear Detrending of Zoo Time Series
f_hellinger()
Data Transformation: Hellinger Transformation by Rows
f_list()
Lists Available Transformation Functions
f_pca()
Data Transformation: Principal Components of Zoo Time Series
f_percentage()
Data Transformation: Convert Values to Percentages by Row
f_proportion()
Data Transformation: Convert Values to Proportions by Row
f_rescale()
Data Transformation: Rescaling Values of Zoo Time Series to a New Range
f_scale()
Data Transformation: Data Centering and Scaling by Column
f_slope()
Data Transformation: Slope of Linear Regression with Time
f_smooth_window()
Data Transformation: Moving Window Smoothing of Zoo Time Series
f_trend_linear()
Data Transformation: Linear Trend of Zoo Time Series
utils_drop_geometry()
Removes Geometry Column from SF Data Frames
utils_global_scaling_params()
Global Centering and Scaling Parameters of Time Series Lists
utils_optimize_loess()
Optimize Loess Models for Time Series Resampling
utils_optimize_spline()
Optimize Spline Models for Time Series Resampling
utils_rescale_vector()
Rescale Numeric Vector to a New Data Range

Zoo Functions

Functions to Manage, Plot, and Transform Zoo Time Series

zoo_aggregate()
Aggregate Cases in Zoo Time Series
zoo_name_clean()
Clean Name of a Zoo Time Series
zoo_name_get()
Get Name of a Zoo Time Series
zoo_name_set()
Set Name of a Zoo Time Series
zoo_permute()
Random or Restricted Permutation of Zoo Time Series
zoo_plot()
Plot Zoo Time Series
zoo_resample()
Resample Zoo Objects to a New Time
zoo_time()
Get Time Features from Zoo Objects
zoo_to_tsl()
Convert Individual Zoo Objects to Time Series List
zoo_vector_to_matrix()
Coerce Coredata of Univariate Zoo Time Series to Matrix

Plotting Helpers

Internal functions to help with plotting tasks.

utils_color_breaks()
Auto Breaks for Matrix Plotting Functions
utils_color_continuous_default()
Default Continuous Color Palette
utils_color_discrete_default()
Default Discrete Color Palettes
utils_line_color()
Handles Line Colors for Sequence Plots
utils_line_guide()
Guide for Time Series Plots
utils_matrix_guide()
Color Guide for Matrix Plot
utils_matrix_plot()
Plot Distance or Cost Matrix and Least Cost Path

Time Handling Helpers

Internal functions to handle time.

utils_as_time()
Ensures Correct Class for Time Arguments
utils_coerce_time_class()
Coerces Vector to a Given Time Class
utils_is_time()
Title
utils_new_time() utils_new_time_type()
New Time for Time Series Aggregation
utils_time_keywords()
Valid Aggregation Keywords
utils_time_keywords_dictionary()
Dictionary of Time Keywords
utils_time_keywords_translate()
Translates The User's Time Keywords Into Valid Ones
utils_time_units()
Data Frame with Supported Time Units

Other Internal Functions

Internal functions to check arguments and other miscellany tasks.

utils_check_args_distantia()
Check Input Arguments to distantia()
utils_check_args_matrix()
Checks Input Matrix
utils_check_args_path()
Checks Least Cost Path
utils_check_args_tsl()
Structural Check for Time Series Lists
utils_check_args_zoo()
Checks Argument x
utils_check_distance_args()
Check Distance Argument
utils_check_list_class()
Checks Classes of List Elements Against Expectation
utils_clean_names()
Clean Character Vector of Names
utils_digits()
Number of Decimal Places
utils_distantia_df_split()
Split Dissimilarity Analysis Data Frames by Combinations of Arguments
utils_distantia_df_to_matrix()
Data Frame to Matrix
utils_prepare_df()
Convert Data Frame to a List of Data Frames
utils_prepare_matrix()
Convert Matrix to Data Frame
utils_prepare_matrix_list()
Convert List of Matrices to List of Data Frames
utils_prepare_time()
Handles Time Column in a List of Data Frames
utils_prepare_vector_list()
Convert List of Vectors to List of Data Frames
utils_prepare_zoo_list()
Convert List of Data Frames to List of Zoo Objects
utils_tsl_pairs()
Data Frame with Pairs of Time Series in Time Series Lists