[Robast-commits] r581 - in branches/robast-0.9/pkg/RobExtremes: R inst/AddMaterial/interpolation

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jan 31 20:09:59 CET 2013


Author: ruckdeschel
Date: 2013-01-31 20:09:59 +0100 (Thu, 31 Jan 2013)
New Revision: 581

Added:
   branches/robast-0.9/pkg/RobExtremes/inst/AddMaterial/interpolation/checkSn.R
Modified:
   branches/robast-0.9/pkg/RobExtremes/R/sysdata.rda
   branches/robast-0.9/pkg/RobExtremes/inst/AddMaterial/interpolation/interpolationsmanipulations.R
Log:
RobExremes: had to fix a little thing in Sn-GEV-grid; (xi values were wrong...); still open: is Sn discontinuous at xi=1 at GEV? acc. to plots in checkSn.R it seems so.

Modified: branches/robast-0.9/pkg/RobExtremes/R/sysdata.rda
===================================================================
(Binary files differ)

Added: branches/robast-0.9/pkg/RobExtremes/inst/AddMaterial/interpolation/checkSn.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/inst/AddMaterial/interpolation/checkSn.R	                        (rev 0)
+++ branches/robast-0.9/pkg/RobExtremes/inst/AddMaterial/interpolation/checkSn.R	2013-01-31 19:09:59 UTC (rev 581)
@@ -0,0 +1,45 @@
+require(RobExtremes)
+
+checkSn <- function(xi, PdG=GPareto){
+  dist <- PdG(shape=xi, scale= 1)
+  s1 <- system.time(Sn1 <- Sn(dist))
+  dist2 <- as(dist,"AbscontDistribution")
+  s2 <- system.time(Sn2 <- Sn(dist2))
+  c(Sn1,Sn2,Sn2-Sn1,(Sn2/Sn1-1)*100,s1[3],s2[3])
+}
+
+xiv <- c(0.001,0.2,0.7, 1.0, 2.0,5.0, 10.0,15)
+system.time(sapply(xiv, function(xi){
+       res <- rbind(GPD=checkSn(xi,GPareto),
+                    GEV=checkSn(xi,GEV),
+                    Gamma=checkSn(xi,Gammad),
+                    Weibull= checkSn(xi,Weibull))
+       colnames(res) <- c("Sn-int.", "Sn-ex.", "DeltaSn", "relDel",
+                          "Time-int", "Time-ex.")
+       cat("\nxi=",xi,":\n")
+       print(round(res,4))
+       return(invisible(NULL))
+       }))
+
+gSn <- function(xi, PF) Sn(PF(shape=xi,scale=1))
+gSna <- function(xi, PF) Sn(as(PF(shape=xi,scale=1),"AbscontDistribution"))
+xig <- seq(0.01,10,by=0.05)
+system.time({ S1g <- sapply(xig, gSn, GPareto)
+  S2g <- sapply(xig, gSn, GEV)
+  S3g <- sapply(xig, gSn, Gammad)
+  S4g <- sapply(xig, gSn, Weibull)
+})
+system.time({S1ga <- sapply(xig, gSna, GPareto)
+S2ga <- sapply(xig, gSna, GEV)
+S3ga <- sapply(xig, gSna, Gammad)
+S4ga <- sapply(xig, gSna, Weibull)})
+par(mfrow=c(2,2))
+plot(xig, S1g, type="l")
+lines(xig, S1ga, col="red")
+plot(xig, S2g, type="l")
+lines(xig, S2ga, col="red")
+plot(xig, S3g, type="l")
+lines(xig, S3ga, col="red")
+plot(xig, S4g, type="l")
+lines(xig, S4ga, col="red")
+par(mfrow=c(1,1))
\ No newline at end of file

Modified: branches/robast-0.9/pkg/RobExtremes/inst/AddMaterial/interpolation/interpolationsmanipulations.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/inst/AddMaterial/interpolation/interpolationsmanipulations.R	2013-01-31 19:03:44 UTC (rev 580)
+++ branches/robast-0.9/pkg/RobExtremes/inst/AddMaterial/interpolation/interpolationsmanipulations.R	2013-01-31 19:09:59 UTC (rev 581)
@@ -117,6 +117,7 @@
 fna <- file.path(.myFolderA,"sysdata-1.rda")
 #fn2=file.path(.myFoldera,"sysdata-1.rda")
 #RobExtremes:::.recomputeInterpolators(c(fn01,fn02, fn1), sysRdaFolder = .myFolderA, overwrite=TRUE, translate=FALSE)
+#RobExtremes:::.copyGrid(grid = g0,  gridnam = ".SnGrids.N", namOld = nam, namNew = nam, rdafileOld = fna, rdafileNew = fnA)
 file.copy(fnA,fna, overwrite=T)
 #RobExtremes:::.recomputeInterpolators(fna, sysRdaFolder = .myFolderA, overwrite=TRUE, translate=FALSE)
 RobExtremes:::.recomputeInterpolators(c(fna,fn1), sysRdaFolder = .myFolderA, overwrite=TRUE, translate=FALSE)



More information about the Robast-commits mailing list