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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 18 20:47:50 CET 2013


Author: ruckdeschel
Date: 2013-01-18 20:47:49 +0100 (Fri, 18 Jan 2013)
New Revision: 542

Added:
   branches/robast-0.9/pkg/RobExtremes/R/bdpPickands.R
Log:
bdpPickands committed

Added: branches/robast-0.9/pkg/RobExtremes/R/bdpPickands.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/bdpPickands.R	                        (rev 0)
+++ branches/robast-0.9/pkg/RobExtremes/R/bdpPickands.R	2013-01-18 19:47:49 UTC (rev 542)
@@ -0,0 +1,51 @@
+bdpPickands <- function(a=2,xi=0.7,orig=TRUE,pr=T, GEVD=T){
+## compute BDP of Pickands model
+### orig: use original defintion or ours for beta
+### pr output as print
+### GEVD: TRUE => GEVD FALSE => GPD
+   d <- (2*a^xi-1)^(-1/xi)
+   if(GEVD){
+      p1 <-  exp(-1/a)
+      p2 <-  exp(-1/a^2)
+      d1 <- exp(-d)
+   }else{
+      p1 <- 1-1/a
+      p2 <- 1-1/a^2
+      d1 <- 1-d
+   }
+   pd <-if (orig) d1 else p1
+   if (pr) print(c(a, p1,p2,p2-p1))
+   min(p1, 1-p2, p2-pd)
+}
+if(FALSE){
+###GPD:
+###### original definition
+bdpPickands(a=2,GEVD=F)
+##optimal:
+ao <- optimize(bdpPickands, interval=c(1,6),
+              pr=F, GEVD=F, maximum=TRUE)$max
+bdpPickands(a=ao, GEVD=F)
+###### new definition
+bdpPickands(a=2, orig=F, GEVD=F)
+##optimal:
+ao <- optimize(bdpPickands, interval=c(1,6),
+              orig=F, pr=F, GEVD=F, maximum=TRUE)$max
+bdpPickands(a=ao, orig=F, GEVD=F)
+
+##GEVD:
+###### original definition
+bdpPickands(a=2)
+bdpPickands(a=1/log(2))
+##optimal:
+ao <- optimize(bdpPickands, interval=c(1,6),
+              pr=F, maximum=TRUE)$max
+bdpPickands(a=ao)
+###### new definition
+bdpPickands(a=2, orig=F)
+bdpPickands(a=1/log(2), orig=F)
+##optimal:
+ao <- optimize(bdpPickands, interval=c(1,6),
+              orig=F, pr=F, maximum=TRUE)$max
+bdpPickands(a=ao, orig=F)
+
+}
\ No newline at end of file



More information about the Robast-commits mailing list