Open ghost opened 6 years ago
Hi Katharina. I'm the author of libeemd
, which Rlibeemd uses under the hood. The floor(log2(N))
value is taken from the literature, but I'm not surprised that sometimes one more would be appropriate. The tricky thing is that libeemd
allocates memory for the output array in the beginning of the computation, so it's not easy to make the number of output IMFs conditional on properties of the residual. What we could do is allocate memory for ceil(log2(N))
IMFs, and not return the last one if it is zero. I currently have little time to work on libeemd, so some help would be appreciated.
Meanwhile, I think you could work around this issue by checking the number of interior extrema in the residual and decompose it further if needed.
I came across an issue with the
ceemdan()
function parameter settingnum_imfs
. In the documentation, the default values ofnum_imfs=0
is said to correspond to a. However, depending on other parameter settings (e.g.
noise_strength
), this is not necessarily the case. A residual with two non-edge extrema, which could be further decomposed, is possible. Then (for N>3), notnum_imfs=emd_num_imfs(N)
(which seems to takefloor(log2(N))
as thenum_imfs
-value), but the smallest integer which is not less than log2(N), thus,num_imfs=ceiling(log2(N))
, appears to correspond to the maximal number of IMFs (meaning the residual has maximum one non-edge extremum). Whetherfloor(log2(N))
orceiling(log2(N))
corresponds to the maximal number of IMFs depends on other parameter settings such asnoise_strength
. Maybe the number of non-edge extrema should be checked to decide on eitherfloor(log2(N))
orceiling(log2(N))
fornum_imfs
.Attached I provide an example. An NDVI (Normalised Difference Vegetation Index) time series of length 340 (example_NDVI.txt). It is decomposed in R using
ceemdan()
(ceemdan_issue.txt). When setting anoise_strength=0.3
, the default setting ofnum_imfs=0
results in a residual with two non-edge extrema.I hope I am not missing anything/getting wrong and this information is of help. In case it is a bug, an edit would be appreciated.
These are my sessionInfo:
R version 3.4.4 (2018-03-15) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)
Best, Katharina