Example

suppressMessages(library(DTWUMI)) # Load package DTWBI
data(dataDTWUMI)
# Fill one gap
dataDTWUMI_gap <- dataDTWUMI[["incomplete_signal"]]
id_gaps <- Indexes_size_missing_multi(dataDTWUMI_gap)
id_gaps
## [[1]]
##      [,1] [,2]
## [1,]  577   40
## 
## [[2]]
##      [,1] [,2]
## [1,]  226   40
## 
## [[3]]
##      [,1] [,2]
## [1,]  392   40
t_gap <- 577 ; T_gap <- 40
imputation <- DTWUMI_1gap_imputation(dataDTWUMI_gap, id_sequence=1, t_gap, T_gap)
plot(dataDTWUMI_gap[, 1], type = "l", lwd = 2)

plot of chunk unnamed-chunk-4

plot(dataDTWUMI_gap[, 1], type = "l", lwd = 2)
lines(y = imputation$imputed_values, x = imputation$id_gap, col = "red")

plot of chunk unnamed-chunk-5

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")

plot of chunk unnamed-chunk-6

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 = "orange")

plot of chunk unnamed-chunk-7

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 = "orange")
lines(y = dataDTWUMI_gap[imputation$id_imputation, 1], x = imputation$id_imputation, col = "blue")

plot of chunk unnamed-chunk-8

#### Fill all gaps ####
dataDTWUMI_gap <- dataDTWUMI[["incomplete_signal"]]
imputation <- DTWUMI_imputation(dataDTWUMI_gap, gap_size_threshold = 10)
## [1] "DTW"
# Sequence 1
plot(dataDTWUMI_gap[, 1], type = "l", lwd = 2)

plot of chunk unnamed-chunk-10

plot(dataDTWUMI_gap[, 1], type = "l", lwd = 2)
lines(imputation$output[, 1], col = "red")

plot of chunk unnamed-chunk-11

# Sequence 2
plot(dataDTWUMI_gap[, 2], type = "l", lwd = 2)

plot of chunk unnamed-chunk-12

plot(dataDTWUMI_gap[, 2], type = "l", lwd = 2)
lines(imputation$output[, 2], col = "red")

plot of chunk unnamed-chunk-13

# Sequence 3
plot(dataDTWUMI_gap[, 3], type = "l", lwd = 2)

plot of chunk unnamed-chunk-14

plot(dataDTWUMI_gap[, 3], type = "l", lwd = 2)
lines(imputation$output[, 3], col = "red")

plot of chunk unnamed-chunk-15