DTWUMI_1gap_imputation: Imputation of a large gap based on DTW for multivariate...

View source: R/4_6DTWUMI_1gap.R

DTWUMI_1gap_imputationR Documentation

Imputation of a large gap based on DTW for multivariate signals

Description

Fills a gap of size 'gap_size' begining at the position 'begin_gap' within a multivariate signal using DTW.

Usage

DTWUMI_1gap_imputation(
  data,
  id_sequence,
  begin_gap,
  gap_size,
  DTW_method = "DTW",
  threshold_cos = 0.995,
  thresh_cos_stop = 0.8,
  step_threshold = 2,
  ...
)

Arguments

data

a multivariate signals containing gaps

id_sequence

id of the sequence containing the gap to fill (corresponding to the column number)

begin_gap

id of the begining of the gap to fill

gap_size

size of the gap to fill

DTW_method

DTW method used for imputation ("DTW", "DDTW", "AFBDTW"). By default "DTW"

threshold_cos

threshold used to define similar sequences to the query

thresh_cos_stop

Define the lowest cosine threshold acceptable to find a similar window to the query

step_threshold

step used within the loops determining the threshold and the most similar sequence to the query

...

additional arguments from dtw() function

Value

A list containing the following elements:

imputed_values

Imputated values.

id_imputation

Indices of the extracted imputation values.

id_sim_win

Indices of the window similar to the query.

id_gap

Indices of the gap being imputed.

id_query

Indices of the query.

Examples

data(dataDTWUMI)
dataDTWUMI_gap <- dataDTWUMI[["incomplete_signal"]]
t <- 207 ; T <- 40
imputation <- DTWUMI_1gap_imputation(dataDTWUMI_gap, id_sequence=1, t, T)
plot(dataDTWUMI_gap[, 1], type = "l", lwd = 2)
lines(y = imputation$imputed_values, x = imputation$id_gap, col = "red")
lines(y = dataDTWUMI_gap[imputation$id_query, 1], x = imputation$id_query, col = "green")
lines(y = dataDTWUMI_gap[imputation$id_sim_win, 1], x = imputation$id_sim_win, col = "blue")
lines(y = dataDTWUMI_gap[imputation$id_imputation, 1], x = imputation$id_imputation, col = "orange")

DTWUMI documentation built on Sept. 9, 2026, 9:08 a.m.