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.
  • momentum() and `momentum_…(): functions to assess variable contribution to dissimilarity in multivariate time series.
  • 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.

Dissimilarity Analysis

Tools to compare time series via dynamic time warping or lock-step methods.

distantia()
Dissimilarity Analysis of Time Series Lists
distantia_dtw()
Dynamic Time Warping Dissimilarity Analysis of Time Series Lists
distantia_dtw_plot()
Two-Way Dissimilarity Plots of Time Series Lists
distantia_ls()
Lock-Step Dissimilarity Analysis of Time Series Lists

Support Functions for Dissimilarity Analysis

Functions to enhance dissimilarity analyses with new capabilities, such as modelling, mapping, and clustering, among others.

distantia_aggregate()
Aggregate distantia() Data Frames Across Parameter Combinations
distantia_boxplot()
Distantia Boxplot
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_model_frame()
Dissimilarity Model Frame
distantia_spatial()
Spatial Representation of distantia() Data Frames
distantia_stats()
Stats of Dissimilarity Data Frame
distantia_time_delay()
Time Shift Between Time Series
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

Variable Importance Analysis

Tools to assess the contribution of individual variables to the dissimilarity between multivariate time series.

momentum()
Contribution of Individual Variables to Time Series Dissimilarity
momentum_dtw()
Dynamic Time Warping Variable Importance Analysis of Multivariate Time Series Lists
momentum_ls()
Lock-Step Variable Importance Analysis of Multivariate Time Series Lists

Support Functions for Variable Importance Analysis

Functions to enhance variable importance analyses.

momentum_aggregate()
Aggregate momentum() Data Frames Across Parameter Combinations
momentum_boxplot()
Momentum Boxplot
momentum_model_frame()
Dissimilarity Model Frame
momentum_spatial()
Spatial Representation of momentum() Data Frames
momentum_stats()
Stats of Dissimilarity Data Frame
momentum_to_wide()
Momentum Data Frame to Wide Format

C++ Backend

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

psi_dtw_cpp()
(C++) Psi Dissimilarity Score of Two Time-Series
psi_equation_cpp()
(C++) Equation of the Psi Dissimilarity Score
psi_ls_cpp()
(C++) Psi Dissimilarity Score of Two Aligned Time Series
psi_null_dtw_cpp()
(C++) Null Distribution of Dissimilarity Scores of Two Time Series
psi_null_ls_cpp()
(C++) Null Distribution of the Dissimilarity Scores of Two Aligned Time Series
importance_dtw_cpp()
(C++) Contribution of Individual Variables to the Dissimilarity Between Two Time Series (Robust Version)
importance_dtw_legacy_cpp()
(C++) Contribution of Individual Variables to the Dissimilarity Between Two Time Series (Legacy Version)
importance_ls_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_ls_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()
Least Cost Path
cost_path_diagonal_bandwidth_cpp()
(C++) Orthogonal and Diagonal Least Cost Path Restricted by Sakoe-Chiba band
cost_path_diagonal_cpp()
(C++) Orthogonal and Diagonal Least Cost Path
cost_path_orthogonal_bandwidth_cpp()
(C++) Orthogonal Least Cost Path
cost_path_orthogonal_cpp()
(C++) Orthogonal Least Cost Path
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_bray_curtis_cpp()
(C++) Bray-Curtis Distance Between Two Vectors
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
distance_sorensen_cpp()
(C++) Sørensen 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.

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_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

Distance Functions

Functions to compute distances between univariate or multivariate vectors and data frames.

distance()
Distance Between Two Numeric Vectors
distance_matrix()
Data Frame to Distance Matrix
distances
Distance Methods

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_burst()
Multivariate TSL to Univariate TSL
tsl_colnames_clean()
Clean Column Names in Time Series Lists
tsl_colnames_get()
Get Column Names from a Time Series Lists
tsl_colnames_prefix()
Append Prefix to Column Names of Time Series List
tsl_colnames_set()
Set Column Names in Time Series Lists
tsl_colnames_suffix()
Append Suffix to Column Names of Time Series List
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_join()
Join 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_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_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 Time Series List Over Time Periods
tsl_resample()
Resample Time Series Lists to a New Time
tsl_smooth()
Smoothing of Time Series Lists
tsl_stats()
Summary Statistics of Time Series Lists
tsl_transform()
Transform Values in Time Series Lists
f_binary()
Transform Zoo Object to Binary
f_clr()
Data Transformation: Rowwise Centered Log-Ratio
f_detrend_difference()
Data Transformation: Detrending and Differencing
f_detrend_linear()
Data Transformation: Linear Detrending of Zoo Time Series
f_detrend_poly()
Data Transformation: Polynomial Linear Detrending of Zoo Time Series
f_hellinger()
Data Transformation: Rowwise Hellinger Transformation
f_list()
Lists Available Transformation Functions
f_log()
Data Transformation: Log
f_percent()
Data Transformation: Rowwise Percentages
f_proportion()
Data Transformation: Rowwise Proportions
f_proportion_sqrt()
Data Transformation: Rowwise Square Root of Proportions
f_rescale_global()
Data Transformation: Global Rescaling of to a New Range
f_rescale_local()
Data Transformation: Local Rescaling of to a New Range
f_scale_global()
Data Transformation: Global Centering and Scaling
f_scale_local()
Data Transformation: Local Centering and Scaling
f_trend_linear()
Data Transformation: Linear Trend of Zoo Time Series
f_trend_poly()
Data Transformation: Polynomial 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_smooth_exponential()
Exponential Smoothing of Zoo Time Series
zoo_smooth_window()
Rolling Window Smoothing of Zoo Time Series
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

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_counties
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
honeycomb_climate
Rainfall and Temperature in The Americas
honeycomb_polygons
Hexagonal Grid

Time Series Simulation

Functions to generate simulated time series.

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

Plotting Helpers

Internal functions to help with plotting tasks.

color_continuous()
Default Continuous Color Palette
color_discrete()
Default Discrete Color Palettes
utils_color_breaks()
Auto Breaks for Matrix Plotting Functions
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_boxplot_common()
Common Boxplot Component of distantia_boxplot() and momentum_boxplot()
utils_check_args_distantia()
Check Input Arguments of distantia()
utils_check_args_matrix()
Checks Input Matrix
utils_check_args_momentum()
Check Input Arguments of momentum()
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_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