asl / rssa

R package for Singular Spectrum Analysis
55 stars 27 forks source link

Errors in using ssa() #233

Closed mjwang1010 closed 7 years ago

mjwang1010 commented 7 years ago

All messages shown: "Error in ssa(temp_flux) : Nothing to decompose: the given field shape is empty In addition: Warning messages: 1: In eval(expr, envir, enclos) : Some field elements were not covered by shaped window. 355 elements will be omitted 2: In eval(expr, envir, enclos) : Nothing to decompose: the given field shape is empty"

where 'temp_flux' contains a 365-element signal with several 'NA' in it. I'm not sure if it is the 'NA' that makes the issue, because if I just replaced one element with 'NA' and others were filled, ssa function could still work. I would like to know when the message 'Nothing to decompose: the given field shape is empty"' would come out. Thanks!

R version: 3.3.2 (2016-10-31) OS version: macOS Sierra 10.12.5 Here is the 'temp_flux' data: [1] -0.33048900 -0.60093900 -0.45003300 -0.06064790 -0.27416600 -0.03863250 -0.05475110 [8] -0.30302200 -0.19522100 0.13889400 0.05308510 0.14727700 -0.07211410 -0.00173611 [15] 0.10371500 0.21894200 -0.11002400 -0.34419800 -0.14970300 -0.29472300 -0.22831700 [22] -0.49722400 -0.21726500 -0.24969400 -0.23196000 -0.36161800 -0.54316200 -0.42922000 [29] -0.37095900 -0.26793500 -0.20361800 0.06708320 -0.67245900 -0.14070600 0.31531800 [36] -0.32452300 0.15196500 -0.20118600 0.18621700 0.19266100 -0.56595300 0.55157500 [43] 0.63956400 0.54902900 0.74983500 0.19203900 0.12002600 -0.45292300 0.04498490 [50] 0.08156540 0.27684400 0.18473700 -0.04313000 0.12236900 0.20125800 -0.26253100 [57] 0.17641300 0.63042400 0.05558610 -0.29238000 0.09438600 0.25581700 0.38536600 [64] 0.01250350 -0.17172500 0.09688550 0.04741160 -0.16602500 0.09653910 0.50546500 [71] -0.21541500 -0.14379200 -0.23381500 0.19761200 -0.33533400 -0.35403700 -0.04475850 [78] -0.53540500 0.18188500 0.15229700 -0.14790300 -0.09901470 -0.34023100 -0.73295200 [85] -0.31245900 -0.16590800 0.30161000 0.48815200 0.15348800 0.25716600 0.15031200 [92] 0.44755100 0.13814500 0.83437300 -0.07526770 0.95053100 0.42674500 -0.68858500 [99] 0.18456200 0.15583300 0.30397900 0.86750100 2.38816000 1.68251000 0.79800200 [106] 1.01323000 0.52374900 3.38262000 1.86203000 2.16487000 1.83910000 2.63224000 [113] 2.30614000 3.91913000 4.49027000 4.18262000 5.27145000 5.27707000 4.90921000 [120] 4.01705000 5.05058000 NA NA 9.00813000 10.78210000 9.35661000 [127] 8.91107000 8.85816000 9.22500000 10.20730000 9.91651000 NA 10.44340000 [134] 8.52870000 9.87120000 10.89150000 8.40310000 5.58741000 9.50533000 12.56690000 [141] 6.60795000 9.45001000 9.83474000 9.82283000 8.20740000 8.51629000 11.13370000 [148] 12.18960000 13.62900000 14.45650000 8.46960000 9.07054000 11.75380000 12.03650000 [155] 4.02284000 7.69182000 12.49210000 12.80170000 14.77040000 14.97690000 14.65430000 [162] 14.37900000 13.99280000 13.49450000 12.97410000 7.95938000 14.32320000 14.97290000 [169] 14.84370000 13.76280000 12.31380000 7.47332000 13.76020000 13.84790000 14.45070000 [176] 14.14500000 13.27730000 14.07880000 11.91830000 NA NA 8.64833000 [183] 12.10620000 5.99858000 9.15690000 11.58720000 12.12220000 7.84921000 10.20350000 [190] 10.36370000 8.51687000 9.43046000 9.78220000 11.67920000 11.61040000 12.20100000 [197] NA NA NA NA NA 12.41350000 16.07770000 [204] 15.91440000 15.74690000 14.94860000 7.99789000 15.20760000 10.05520000 13.30020000 [211] 15.67740000 14.87980000 13.64250000 12.36190000 13.05850000 11.68910000 11.97660000 [218] 13.06180000 12.89630000 12.84350000 10.39630000 12.17960000 12.53980000 12.45170000 [225] 12.25960000 12.08710000 12.63830000 8.14957000 12.79410000 12.34290000 12.37210000 [232] 13.75240000 16.40150000 13.07600000 12.70420000 13.51230000 10.97200000 12.39440000 [239] 14.75320000 12.22670000 13.29950000 14.02280000 11.93460000 11.71680000 12.70590000 [246] 12.26390000 11.68330000 12.34610000 12.67700000 8.98826000 9.90430000 5.84786000 [253] 9.06122000 10.52650000 9.62547000 9.45795000 7.30802000 7.25077000 7.98561000 [260] 8.10798000 6.19300000 5.62506000 9.80243000 7.63994000 9.49352000 9.46954000 [267] 7.61605000 5.81953000 6.21006000 7.09423000 5.34154000 6.10297000 6.19397000 [274] 6.31203000 6.03585000 5.85412000 6.47387000 0.01279670 4.31405000 4.56158000 [281] 4.79289000 4.80527000 3.32935000 1.20633000 4.46545000 -0.12429600 3.45431000 [288] 4.13255000 2.23370000 2.05609000 2.50917000 2.31919000 2.32288000 2.59350000 [295] 2.32517000 0.65833700 0.39899700 0.20456900 0.08522650 -0.36637200 0.06723000 [302] 0.48170700 0.82083100 0.33274400 0.06876310 -0.82575400 -0.05207360 -0.04177720 [309] -0.10712800 -0.11414900 0.06207190 -0.18351700 -0.43398600 -0.40477900 0.09355000 [316] -0.69938400 0.00756471 0.36192000 0.06408420 0.39508800 0.00927436 0.03867550 [323] -0.18943700 -1.18361000 -0.33078400 0.02598040 -0.19299700 -0.21230300 0.20462600 [330] 0.19032700 -0.06786000 0.02543600 -0.07658750 -0.22535500 -0.36159500 -0.62838600 [337] -0.19510300 -0.37437100 -0.30860700 0.59733500 -0.18082100 0.26423000 -0.16168700 [344] -0.17533200 -0.25559800 0.67852100 1.07640000 0.23398900 0.07754840 0.28015300 [351] 0.66030600 0.24500300 0.15333400 0.37622000 0.09039830 -0.32991900 0.05702000 [358] -0.30819900 -0.26836200 -0.00927665 0.08403990 0.21397400 -0.16157400 -0.45682400 [365] -0.02410980

neg99 commented 7 years ago

Hi! Your series contains exactly 355 non-NA observations. The message means that all of them are not covered by the chosen window. The default window length L is equal to the half of the time series length: L = (N + 1) %/% 2 = 366/2 = 183. There are no subseries of such length, which are called lagged vectors, with no NA. Therefore, it is impossible to construct the trajectory matrix, which is constructed from lagged vectors of length L. If you need a decomposition of a series with NA, then it is recommended to choose a smaller window length to get a sufficient number of the lagged vectors: say, ssa(temp_flux, L = 60).

mjwang1010 commented 7 years ago

Hi, Nina. Thanks for your help! (I just want to check my point) So, that means NA values are allowed in the analysis. I should have to fill this values before I do SSA. I am not sure whether filling values or methods would affect results of SSA (I guess so). Anyway, smaller window size could make it work. Thanks!

Mengjie