[Robast-commits] r660 - branches/robast-0.9/pkg/RobExtremes/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 13 14:13:10 CEST 2013


Author: ruckdeschel
Date: 2013-05-13 14:13:10 +0200 (Mon, 13 May 2013)
New Revision: 660

Modified:
   branches/robast-0.9/pkg/RobExtremes/R/GEVFamily.R
Log:
RobExtremes: fixed bug in btq, bDq, btes, bDes, btel, bDel in GEVFamily.R 
found by Gerald (had to replace 1-p0 by p0)

Modified: branches/robast-0.9/pkg/RobExtremes/R/GEVFamily.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/GEVFamily.R	2013-05-06 09:04:09 UTC (rev 659)
+++ branches/robast-0.9/pkg/RobExtremes/R/GEVFamily.R	2013-05-13 12:13:10 UTC (rev 660)
@@ -161,19 +161,19 @@
 
     btq <- bDq <- btes <- bDes <- btel <- bDel <- NULL
     if(!is.null(p)){
-       btq <- substitute({ q <- loc0 + theta[1]*((-log(1-p0))^(-theta[2])-1)/theta[2]
+       btq <- substitute({ q <- loc0 + theta[1]*((-log(p0))^(-theta[2])-1)/theta[2]
                            names(q) <- "quantile"
                            }, list(loc0 = loc, p0 = p))
 
        bDq <- substitute({ scale <- theta[1];  shape <- theta[2]
-                        D1 <- ((-log(1-p0))^(-shape)-1)/shape
-                        D2 <- -scale/shape*(D1 + log(-log(1-p0))*(-log(1-p0))^(-shape))
+                        D1 <- ((-log(p0))^(-shape)-1)/shape
+                        D2 <- -scale/shape*(D1 + log(-log(p0))*(-log(p0))^(-shape))
                         D <- t(c(D1, D2))
                         rownames(D) <- "quantile"; colnames(D) <- NULL
                         D }, list(p0 = p))
        btes <- substitute({ if(theta[2]>=1L) es <- NA else {
                             pg <- pgamma(-log(p0),1-theta[2], lower.tail = TRUE)
-                            es <- theta[1] * (gamma(1-theta[2]) * pg/ (1-p0) - 1 )/
+                            es <- theta[1] * (gamma(1-theta[2]) * pg/ p0 - 1 )/
                                    theta[2]  + loc0 }
                             names(es) <- "expected shortfall"
                             es }, list(loc0 = loc, p0 = p))
@@ -182,9 +182,9 @@
                             pg <- pgamma(-log(p0), 1-theta[2], lower.tail = TRUE)
                             dd <- ddigamma(-log(p0),1-theta[2])
                             g0 <- gamma(1-theta[2])
-                            D1 <- (g0*pg/(1-p0)-1)/theta[2]
+                            D1 <- (g0*pg/p0-1)/theta[2]
                             D21 <- theta[1]*D1/theta[2]
-                            D22 <- theta[1]*dd/(1-p0)/theta[2]
+                            D22 <- theta[1]*dd/p0/theta[2]
                             D2 <- -D21+D22}
                             D <- t(c(D1, D2))
                             rownames(D) <- "expected shortfall"



More information about the Robast-commits mailing list