Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

pam_cent

Centroid for partition around medoids


Description

Extract the medoid time series based on a distance measure.

Usage

pam_cent(
  series,
  distance,
  ids = seq_along(series),
  distmat = NULL,
  ...,
  error.check = TRUE
)

Arguments

series

The time series in one of the formats accepted by tslist().

distance

A character indicating which distance to use. Only needed if distmat is NULL. The distance must be registered in proxy::pr_DB().

ids

Integer vector indicating which of the series should be considered.

distmat

Optionally, a pre-computed cross-distance matrix of all series.

...

Any extra parameters for the distance function that may be used.

error.check

Logical indicating whether the function should try to detect inconsistencies and give more informative errors messages. Also used internally to avoid repeating checks.

Details

The medoid's index is determined by taking the arg min of the distmat's row-sums (considering only the rows in ids). The distance matrix is calculated if needed.

Value

The medoid time series.

Examples

# Computes the distance matrix for all series
pam_cent(CharTraj, "dtw_basic", ids = 6L:10L, window.size = 15L) # series_id = 7L

# Computes the distance matrix for the chosen subset only
pam_cent(CharTraj[6L:10L], "dtw_basic", window.size = 15L) # series_id = 2L

dtwclust

Time Series Clustering Along with Optimizations for the Dynamic Time Warping Distance

v5.5.10
GPL-3
Authors
Alexis Sarda-Espinosa
Initial release
2022-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.