You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an issue while calculating SPEI for time periods of < 5 years. When I tried to debug with simulation datasets, I find that SPEI only returns correct values when the number of years is >= 5. Specifically:
For 1, 2, or 3 years, SPEI returns all NAs.
For 4 years, it seems mostly correct, but I still observe NA values for January and February in all years.
In my examples, the frequency is set to 12 (monthly data), and the scale is set to 3. Below is the original code used for calculation:
years <- 3 # Try 1, 2, 3, or 4 years
n_months <- years * 12
tave <- runif(n_months, -5, 25) # Simulate temperature data
ppt <- runif(n_months, 0, 200) # Simulate precipitation data
latitude <- 40 # Set latitude
pet_thor <- thornthwaite(tave, latitude)
wb <- ppt - pet_thor
spei_values <- spei(wb, scale = 3)$fitted
The text was updated successfully, but these errors were encountered:
I encountered an issue while calculating SPEI for time periods of < 5 years. When I tried to debug with simulation datasets, I find that SPEI only returns correct values when the number of years is >= 5. Specifically:
For 1, 2, or 3 years, SPEI returns all NAs.
For 4 years, it seems mostly correct, but I still observe NA values for January and February in all years.
In my examples, the frequency is set to 12 (monthly data), and the scale is set to 3. Below is the original code used for calculation:
The text was updated successfully, but these errors were encountered: