asl / rssa

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

Default "groups" parameter when I try plot(s, type = "wcor") is wrong in the case of column.projector='centering' #188

Closed furiousbean closed 8 years ago

furiousbean commented 9 years ago

Hi!

Today I'd tried to make a "wcor" figure, and received an error. By default, it uses first 50 ET to make the figure, and if the series are noisy, then everything is OK. When the series are shorter than 100 points, it takes #of ET <= min(L, K), and everything remains OK. But in the case of column.projector='centering' it adds 1 ET. For example, if the series are larger than 100, it makes picture with 51 ET, and it works, but it doesn't work for length <= 100, despite it tries to reduce the number of ET.

For example, when N = 100, then (by default) L = 50, K = 51, it tries to make picture using 51 ET, and obviously fails with "Cannot decompose that much, desired elementary series index is too huge" or "In calc.v.pssa(x, i) : some sigmas are equal to zero. The corresponding vectors will be zeroed" because rank of trajectory matrix is equal to 50.

Code to reproduce error: http://pastebin.com/WVq8Rr6s

eodus commented 9 years ago

Dear Nikita!

It's known behavior. wcor is undefined for zero components (because of 0/0 = NaN). You can just try

ss <- ssa(1:100) plot(wcor(ss))

Thus, it's not feature of projection-ssa.

@asl, we can fix it by definition wcor for zero components as zero. I remember, that we have already discuss this issue but I can not remember our decision. Probably we concluded that it's correct behavior.

furiousbean commented 9 years ago

@eodus , I know that wcor is undefined for zero components. So, it won't work for finite-rank series (we need to limit the number of ETs). But by default it tries to make a figure using number of ET's that could not be achieved by definition, and yes, it changes its behavior in the case of centering projection. That's what I try to point as the error, not my misunderstanding of wcor.

eodus commented 9 years ago

M, I see... We can fix YOUR issue by reducing default neig value by the number of special triples (or more precisely, by max(nPL, nPR) in decompose.pssa.

I'll do it.