I am trying to calculate return values for minimal temperature, which is negative and I got a warning message:
In log(z): NaNs produced
It is very strange, because I got warning messages only for some vectors (21 of 95). I tried to restart R and do not know what else to do. Use is.nan
? But I do not know where to incorporate it...
My data is:
mmm <- c(-18.78, -16.81, -15.92, -14.03, -12.58, -25.26 ,-22.57, -27.86, -15.39, -13.32, -8.37, -15.10, -14.33, -14.50, -21.93, -17.75, -24.64, -24.96, -17.91, -17.68, -15.43, -18.16, -19.35, -27.34, -18.60, -14.34, -24.10, -13.75, -12.18, -17.02, -21.08, -21.14, -23.85, -17.80, -18.22, -11.15, -16.44, -15.20, -17.51, -12.33, -4.10)
Code:
library(extRemes)
library(xts)
mle <- fevd(mmm, method = "MLE", type = "GEV")
rl <- return.level(mle, conf=0.05, return.period=c(10, 20, 50, 100))
rl
The result is:
fevd(x = mmm, type = "GEV", method = "MLE")
get(paste("return.level.fevd.", newcl, sep = ""))(x = x,
return.period = return.period, conf = 0.05)
GEV model fitted to mmm
Data are assumed to be stationary
[1] "Return Levels for period units in years"
10-year level 20-year level 50-year level
1.998987e+67 3.880116e+88 1.393228e+116
100-year level
6.205119e+136
I found an answer to my question, maybe it will help someone. Working with negative values (e.g. Tmin in C), the normal process in GEV analysis is to convert them by multiplying with * (-1), such that positive records are analyzed. Also, you can convert them to Kelvins. Once the GEV is fitted, you can easily back transform the result.