sbegueria/SPEI

Problem in spei() when there are NA in the data

Closed this issue · 1 comments

As reported by email by a user:

Hi Santiago,

I’m using the SPEI R package for my research and I wanted to ask you about dealing with missing values.

I have a time series with quite a lot of missing values (see attached figure). The package seems to work fine when the scale is set to 1 (and na.rm=TRUE). However, I noticed for scales >1, the code replaces the missing values with some climatological value. Presumably the code then uses these values in the calculation as in my case, the code doesn’t produce any negative SPI values using scale=6. By definition, this shouldn’t really be possible.

If you have a fix to this problem, would you be able to kindly let me know?

Many thanks,
Anna

SPI_examples

This has been solved in the new version of the spei() function, which is now under development (expected in release 1.8).