diss: TSclust Dissimilarity Computation

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/diss.R

Description

Computes the dissimilarity matrix of the given numeric matrix, list, data.frame or mts object using the selected TSclust dissimilarity method.

Usage

1
diss(SERIES, METHOD, ...)

Arguments

SERIES

Numeric matrix, list, data.frame or mts object. Numeric matrices are interpreted row-wise (one series per row) meanwhile data.frame and mts objects are interpredted column-wise.

METHOD

the dissimilarity measure to be used. This must be one of "ACF", "AR.LPC.CEPS", "AR.MAH", "AR.PIC", "CDM", "CID", "COR", "CORT", "DTWARP", "DWT", "EUCL", "FRECHET", INT.PER", "NCD", "PACF", "PDC", PER", "PRED", "MINDIST.SAX", "SPEC.LLR", "SPEC.GLK" or "SPEC.ISD". Any unambiguous substring can be given. See details for individual usage.

...

Additional arguments for the selected method.

Details

SERIES argument can be a numeric matrix, with one row per series, a list object with one numeric vector per element, a data.frame or a mts object. Some methods can have additional arguments. See the individual help page for each dissimilarity method, detailed below. Methods that have arguments that require one value per time series in series must provide so using a vector, a matrix (in the case of a multivalued argument) or a list when appropiate. In the case of a matrix, the values are conveyed row-wise. See the AR.LPC.CEPS example below.

Value

dist

A dist object with the pairwise dissimilarities between series.

Some methods produce additional output, see their respective documentation pages for more information.

Author(s)

Pablo Montero Manso, José Antonio Vilar.

References

Montero, P and Vilar, J.A. (2014) TSclust: An R Package for Time Series Clustering. Journal of Statistical Software, 62(1), 1-43. http://www.jstatsoft.org/v62/i01/.

See Also

pdc, dist

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data(electricity)
diss(electricity, METHOD="INT.PER", normalize=FALSE)

## Example of multivalued, one per series argument
## The AR.LPC.CEPS dissimilarity allows the specification of the ARIMA model for each series
## Create three sample time series and a mts object
x <- arima.sim(model=list(ar=c(0.4,-0.1)), n =100, n.start=100)
y <- arima.sim(model=list(ar=c(0.9)), n =100, n.start=100)
z <- arima.sim(model=list(ar=c(0.5, 0.2)), n =100, n.start=100)
seriests <- rbind(x,y,z)

## If we want to provide the ARIMA order for each series
## and use it with AR.LPC.CEPS, we create a matrix with the row-wise orders
orderx <- c(2,0,0) 
ordery <- c(1,0,0)
orderz <- c(2,0,0)
orders = rbind(orderx, ordery, orderz)

diss( seriests, METHOD="AR.LPC.CEPS", k=30, order= orders )

##other examples
diss( seriests, METHOD="MINDIST.SAX", w=10, alpha=4 )
diss( seriests, METHOD="PDC" )

Example output

Loading required package: wmtsa
Loading required package: pdc
Loading required package: cluster
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
            H1         H2         H3         H4         H5         H6
H2    994.5329                                                       
H3   1828.2394  1688.9145                                            
H4   5776.5579  4796.1143  4105.4534                                 
H5   7801.2038  6806.6709  6130.0993  2024.6459                      
H6   6096.6543  5102.1214  4425.5498   393.7324  1745.1878           
H7   6461.8366  5467.3037  4790.7321  2352.6167  2831.8113  1979.5745
H8  14426.8555 13432.3226 12755.7510  8650.2976  6625.6517  8330.2012
H9  15034.2728 14039.7399 13363.1683  9257.7149  7233.0691  8937.6186
H10 18330.2062 17335.6734 16659.1018 12553.6484 10529.0025 12233.5520
H11 22302.9829 21308.4500 20631.8784 16526.4250 14501.7791 16206.3286
H12 23927.9553 22933.4224 22256.8508 18151.3974 16126.7515 17831.3010
H13 28991.9060 27997.3731 27320.8015 23215.3481 21190.7023 22895.2517
H14 29451.2339 28456.7010 27780.1294 23674.6760 21650.0301 23354.5796
H15 23863.8493 22869.3164 22192.7448 18087.2914 16062.6455 17767.1950
H16 21463.0068 20468.4739 19791.9023 15686.4489 13661.8031 15366.3526
H17 26163.8247 25169.2919 24492.7203 20387.2669 18362.6210 20067.1705
H18 33097.5059 32102.9730 31426.4014 27320.9480 25296.3021 27000.8516
H19 55440.4270 54445.8942 53769.3226 49663.8692 47639.2233 49343.7728
H20 64974.8172 63980.2843 63303.7127 59198.2593 57173.6134 58878.1629
H21 53023.8451 52029.3122 51352.7406 47247.2872 45222.6413 46927.1908
H22 25104.6839 24110.1510 23433.5794 19328.1260 17303.4801 19008.0296
H23 18947.0301 17952.4972 17275.9256 13170.4722 11145.8263 12850.3758
H24  6353.4183  5358.8854  4682.3138  1986.9202  2689.6643  1634.0095
            H7         H8         H9        H10        H11        H12
H2                                                                   
H3                                                                   
H4                                                                   
H5                                                                   
H6                                                                   
H7                                                                   
H8   7971.7588                                                       
H9   8592.4687   723.1394                                            
H10 11873.1384  3903.3508  3295.9334                                 
H11 15841.1463  7876.1274  7268.7101  3972.7767                      
H12 17466.1187  9501.0998  8893.6825  5597.7490  1624.9724           
H13 22530.0694 14565.0505 13957.6332 10661.6998  6688.9231  5063.9507
H14 22989.3973 15024.3784 14416.9611 11121.0277  7148.2510  5523.2786
H15 17402.0127  9436.9938  8829.5765  5533.6431  1560.8664   387.8042
H16 15001.1702  7036.1513  6428.7340  3132.8006   911.4519  2497.1351
H17 19701.9882 11736.9693 11129.5519  7833.6185  3860.8418  2235.8695
H18 26635.6693 18670.6504 18063.2331 14767.2997 10794.5230  9169.5506
H19 48978.5905 41013.5716 40406.1542 37110.2208 33137.4441 31512.4718
H20 58512.9806 50547.9617 49940.5443 46644.6109 42671.8343 41046.8619
H21 46562.0085 38596.9896 37989.5723 34693.6389 30720.8622 29095.8898
H22 18642.8473 10677.8284 10070.4111  6774.4777  2801.7010  1191.3747
H23 12485.1935  4520.1746  3912.7572   745.3083  3403.6173  5006.4268
H24   469.6939  8076.7738  8697.4838 11978.1535 15949.5646 17574.5370
           H13        H14        H15        H16        H17        H18
H2                                                                   
H3                                                                   
H4                                                                   
H5                                                                   
H6                                                                   
H7                                                                   
H8                                                                   
H9                                                                   
H10                                                                  
H11                                                                  
H12                                                                  
H13                                                                  
H14   459.3279                                                       
H15  5128.0567  5587.3846                                            
H16  7528.8992  7988.2271  2400.8425                                 
H17  2861.6808  3302.2374  2299.9754  4700.8179                      
H18  4105.5999  3646.2720  9233.6566 11634.4991  6933.6812           
H19 26448.5210 25989.1932 31576.5778 33977.4202 29276.6023 22342.9212
H20 35982.9112 35523.5833 41110.9679 43511.8103 38810.9924 31877.3113
H21 24031.9391 23572.6112 29159.9958 31560.8383 26860.0204 19936.4869
H22  3887.2221  4346.5500  1292.2739  3688.5098  1060.6784  7992.8220
H23 10044.8759 10504.2038  4916.8192  2515.9768  7216.7947 14150.4758
H24 22638.4877 23097.8156 17510.4310 15109.5885 19810.4064 26744.0876
           H19        H20        H21        H22        H23
H2                                                        
H3                                                        
H4                                                        
H5                                                        
H6                                                        
H7                                                        
H8                                                        
H9                                                        
H10                                                       
H11                                                       
H12                                                       
H13                                                       
H14                                                       
H15                                                       
H16                                                       
H17                                                       
H18                                                       
H19                                                       
H20  9547.4716                                            
H21  2425.1197 11950.9721                                 
H22 30335.7432 39870.1333 27919.1612                      
H23 36493.3970 46027.7871 34076.8150  6197.8015           
H24 49087.0087 58621.3988 46670.4268 18751.2656 12593.6117
          x         y
y 0.6147099          
z 0.5347802 1.0301534
         x        y
y 3.694333         
z 0.000000 2.132924
          x         y
y 0.4806243          
z 0.2695998 0.3742622

TSclust documentation built on Nov. 17, 2017, 7:24 a.m.