Specify time series clustering via dtwclust

lcMethodDtwclust(
  response,
  time = getOption("latrend.time"),
  id = getOption("latrend.id"),
  nClusters = 2,
  ...
)

Arguments

response

The name of the response variable.

time

The name of the time variable.

id

The name of the trajectory identifier variable.

nClusters

Number of clusters.

...

Arguments passed to dtwclust::tsclust. The following arguments are ignored: series, k, trace.

References

sardaespinosa2019timelatrend

Examples

data(latrendData)

if (require("dtwclust")) {
  method <- lcMethodDtwclust("Y", id = "Id", time = "Time", nClusters = 3)
  model <- latrend(method, latrendData)
}
#> Loading required package: dtwclust
#> Loading required package: proxy
#> 
#> Attaching package: ‘proxy’
#> The following objects are masked from ‘package:stats’:
#> 
#>     as.dist, dist
#> The following object is masked from ‘package:base’:
#> 
#>     as.matrix
#> Loading required package: dtw
#> Loaded dtw v1.23-1. See ?dtw for help, citation("dtw") for use in publication.
#> dtwclust:
#> Setting random number generator to L'Ecuyer-CMRG (see RNGkind()).
#> To read the included vignettes type: browseVignettes("dtwclust").
#> See news(package = "dtwclust") after package updates.
#> 
#> 	Precomputing distance matrix...
#> 
#> Iteration 1: Changes / Distsum = 200 / 399.6059
#> Iteration 2: Changes / Distsum = 10 / 348.9926
#> Iteration 3: Changes / Distsum = 0 / 348.9926
#> 
#> 	Elapsed time is 5.946 seconds.
#>