SAVING RETURN LEVELS FROM fEXTREME PACKAGE BY GROUPD

Peter Maclean pmaclean2011 at yahoo.com
Mon Jul 4 01:38:00 CEST 2011


#I hope you will be able to help me out.
#My interest is how to save the returned quantiles in qmax (below) and how to 
use the "gevrlevelPlot" function to #plot and save the return level with 
confidence intervals.
#Example
n <- c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,3)
y <- c(2,3,2,3,4,5,6,1,4,1,2,6, 2, 1, 2, 0,9,3)
z <- data.frame(n=factor(n),y=y)
z <- split(z, z$n)
library(fExtremes)
res2 <- lapply(z, function(x){
              m <- as.numeric(x$y)
              gevFit(m, block = 1, type = c("pwm"))
               })

res3 <- data.frame(n = names(res2), t(sapply(res2, function(l) l at fit$par.ests)))
res4 <- split(res3, res3$n) 
qmax <- lapply(res4, function(x) {
                        a <- x$xi 
                        b <- x$mu 
                        c <- x$beta
                        qgev(0.95, xi = a, mu = b, beta = c, lower.tail = TRUE)
})
#Did not work
gmax1 <- data.frame(n = names(qmax), t(sapply(qmax, function(l) l at fit$n)))
 Peter Maclean




More information about the Rmetrics-core mailing list