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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jan 24 20:20:24 CET 2013


Author: ruckdeschel
Date: 2013-01-24 20:20:24 +0100 (Thu, 24 Jan 2013)
New Revision: 551

Added:
   branches/robast-0.9/pkg/RobExtremes/R/recomputeInterpolators.R
   branches/robast-0.9/pkg/RobExtremes/inst/AddMaterial/interpolation/
   branches/robast-0.9/pkg/RobExtremes/inst/AddMaterial/interpolation/interpolationscripts.R
   branches/robast-0.9/pkg/RobExtremes/man/internal-interpolate.Rd
Removed:
   branches/robast-0.9/pkg/RobExtremes/man/internal-interpolateLM.Rd
   branches/robast-0.9/pkg/RobExtremes/man/internal-interpolateSn.Rd
Modified:
   branches/robast-0.9/pkg/RobExtremes/R/WeibullFamily.R
   branches/robast-0.9/pkg/RobExtremes/R/interpolLM.R
   branches/robast-0.9/pkg/RobExtremes/R/interpolSn.R
   branches/robast-0.9/pkg/RobExtremes/R/sysdata.rda
   branches/robast-0.9/pkg/RobExtremes/man/interpolateSn.Rd
Log:
RobExtremes: re-did the interpolation grids (for GPareto, so far)

Modified: branches/robast-0.9/pkg/RobExtremes/R/WeibullFamily.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/WeibullFamily.R	2013-01-23 16:24:43 UTC (rev 550)
+++ branches/robast-0.9/pkg/RobExtremes/R/WeibullFamily.R	2013-01-24 19:20:24 UTC (rev 551)
@@ -101,7 +101,6 @@
     else if(is.matrix(trafo) & nrow(trafo) > 2)
            stop("number of rows of 'trafo' > 2")
            # code .define.tau.Dtau is in file GEVFamily.R
-    trafo <- def$trafo; tau <- def$tau; Dtau <- def$Dtau
 
 
     param <- ParamFamParameter(name = "theta", main = c(theta[1],theta[2]),

Modified: branches/robast-0.9/pkg/RobExtremes/R/interpolLM.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/interpolLM.R	2013-01-23 16:24:43 UTC (rev 550)
+++ branches/robast-0.9/pkg/RobExtremes/R/interpolLM.R	2013-01-24 19:20:24 UTC (rev 551)
@@ -34,13 +34,10 @@
       return(res)
 }
 
-
 .getLMGrid <- function(xiGrid = getShapeGrid(),
                       PFam = GParetoFamily(scale=1,shape=2),
-                      optFct = .RMXE.xi,
-                      withSmooth = TRUE,
-                      withPrint = FALSE, withCall = FALSE,
-                      GridFileName="LMGrid.Rdata"){
+                      optFct = .RMXE.xi, GridFileName="LMGrid.Rdata",
+                      withSmooth = TRUE, withPrint = FALSE, withCall = FALSE){
    print(match.call())
    call <- match.call()
    itLM <- 0
@@ -69,7 +66,7 @@
 
             })
    LMGrid <- sapply(xiGrid,getLM)
-   save(LMGrid, file=GridFileName)
+   if(GridFileName!="") save(LMGrid, file=GridFileName)
    res <- .MakeGridList(xiGrid, Y=t(LMGrid), withSmooth = withSmooth)
    print(res)
    return(list(grid = res$grid,
@@ -108,8 +105,8 @@
                warning("There have been xi-values out of range of the interpolation grid.")
             return(y1)
        }
-       environment(fctL) <- new.env()
-       assign("fct", fct, envir=environment(fctL))
+       environment(fctL[[i]]) <- new.env()
+       assign("fct",fct, envir=environment(fctL[[i]]))
    }
    if(ncol(LMGrid)==1) fctL <- fctL[[1]]
 
@@ -117,12 +114,15 @@
                fct = fctL))
 }
 
-.myFolder <- "C:/rtest/RobASt/branches/robast-0.9/pkg/ROptEst/R"
-.svInt <- function(optF = .RMXE.xi, nam = ".RMXE")
-             .saveInterpGrid(xiGrid = getShapeGrid(500,
-                  cutoff.at.0=0.005),
-                  PFam = GParetoFamily(shape=1,scale=2),
-                  sysRdaFolder=.myFolder, optFct = optF,
-                  nameInSysdata = nam, getFun = .getLMGrid,
+.svInt <- function(optF = .RMXE.xi, nam = ".RMXE",
+                   xiGrid = getShapeGrid(500, cutoff.at.0=0.005),
+                   sysRdafolder, PFam = GParetoFamily(shape=1,scale=2)){
+             if(missing(sysRdafolder))
+                sysRdafolder <- "C:/rtest/RobASt/branches/robast-0.9/pkg/RobExtremesBuffer"
+             .saveInterpGrid(xiGrid = xiGrid,
+                  PFam = PFam, sysRdaFolder=sysRdafolder, optFct = optF,
+                  nameInSysdata = nam, getFun =  .getLMGrid,
                   withSmooth = TRUE, withPrint = TRUE)
+}
 
+

Modified: branches/robast-0.9/pkg/RobExtremes/R/interpolSn.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/interpolSn.R	2013-01-23 16:24:43 UTC (rev 550)
+++ branches/robast-0.9/pkg/RobExtremes/R/interpolSn.R	2013-01-24 19:20:24 UTC (rev 551)
@@ -58,8 +58,8 @@
 }
 
 getSnGrid <- function(xiGrid = getShapeGrid(), PFam=GParetoFamily(), low=0,
-                      upp=1.01, accuracy = 10000, withSmooth = TRUE,
-                      withPrint = FALSE, withCall = FALSE){
+                      upp=1.01, accuracy = 10000, GridFileName="SnGrid.Rdata",
+                      withSmooth = TRUE, withPrint = FALSE, withCall = FALSE){
    call <- match.call()
    itSn <- 0
    getSn <- function(xi){
@@ -69,6 +69,7 @@
                return(Sn(x=distr, accuracy = accuracy, low=low, upp = upp))
                }
    SnGrid <- sapply(xiGrid,getSn)
+   if(GridFileName!="") save(SnGrid, file=GridFileName)
    rm(PFam)
    iNA <- is.na(SnGrid)
    SnGrid <- SnGrid[!iNA]
@@ -92,6 +93,8 @@
              warning("There have been xi-values out of range of the interpolation grid.")
           return(y1)
    }
+   environment(fct) <- new.env()
+   assign("fct0",fct0, envir=environment(fct))
    return(list(grid = cbind(xi=xiGrid,Sn=SnGrid),
                fct = fct, call = if(withCall) call else NULL))
 }
@@ -99,10 +102,13 @@
 .saveInterpGrid <- function(xiGrid = getShapeGrid(), PFam = GParetoFamily(),
                         sysRdaFolder, getFun = getSnGrid,
                         ..., nameInSysdata = ".SnGrids",
-                        withSmooth = TRUE, withPrint = TRUE,
+                        GridFileName, withSmooth = TRUE, withPrint = TRUE,
+                        withCall = FALSE,
                         Y = NULL, elseFun = NULL){
   if(missing(sysRdaFolder)) stop("You must specify argument 'sysRdaFolder'.")
 
+  if(missing(GridFileName))
+    GridFileName <- paste(sub("^\\.(.+)","\\1"),".Rdata",sep="")
   newEnv <- new.env()
   sysdataFile <- file.path(sysRdaFolder,"sysdata.rda")
   cat("sysdataFile = ", sysdataFile, "\n")
@@ -134,7 +140,8 @@
        if(ans==1){
           if(is.null(Y)) {
               InterpGrids[[name(PFam)]] <- getFun(xiGrid = xiGrid, PFam = PFam,
-                         ..., withSmooth = withSmooth, withPrint = withPrint)
+                         ..., withSmooth = withSmooth, withPrint = withPrint,
+                         withCall = withCall, GridFileName = GridFileName)
           }else{ if(!is.null(elseFun)){
                    InterpGrids[[name(PFam)]] <- elseFun(xiGrid, Y,
                                                       withSmooth = withSmooth)
@@ -154,7 +161,8 @@
   if(l.ng>0){
      if(is.null(Y)) {
            InterpGrids[[l.ng]] <- getFun(xiGrid = xiGrid, PFam = PFam,
-                         ..., withSmooth = withSmooth, withPrint = withPrint)
+                         ..., withSmooth = withSmooth, withPrint = withPrint,
+                         withCall = withCall, GridFileName = GridFileName)
      }else{ if(!is.null(elseFun)){
                InterpGrids[[l.ng]] <- elseFun(xiGrid, Y, withSmooth = withSmooth)
             }else return(NULL)

Added: branches/robast-0.9/pkg/RobExtremes/R/recomputeInterpolators.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/recomputeInterpolators.R	                        (rev 0)
+++ branches/robast-0.9/pkg/RobExtremes/R/recomputeInterpolators.R	2013-01-24 19:20:24 UTC (rev 551)
@@ -0,0 +1,172 @@
+.recomputeInterpolators <- function(sysdataFiles, sysRdaFolder = ".",
+                                   others = FALSE, onlyothers = FALSE,
+                                   overwrite = TRUE, integrateto = FALSE,
+                                   onlyCurrent = FALSE, withPrint =TRUE,
+                                   withSmooth = TRUE,
+                                   debug = FALSE){
+
+  wprint <- function(...){ if (withPrint) print(...)}
+
+  sam <- new.env()
+  for(File in sysdataFiles) load(File, envir = sam)
+
+  keep <- if(getRversion()>="2.16") "N" else "O"
+  todo <- if(getRversion()>="2.16") "O" else "N"
+
+  whatIsThereAlready <-  ls(all.names=TRUE, envir=sam)
+  whatIsThereAlready.N <- grep(paste("^\\..+\\.",keep,"$",sep=""),
+                              whatIsThereAlready,value=T)
+
+  whatIsThereAlready.O <- grep(paste("^\\..+\\.",todo,"$",sep=""),
+                             whatIsThereAlready,value=T)
+  whatIsThereAlready.E <- setdiff(setdiff(whatIsThereAlready,
+                                 whatIsThereAlready.N),whatIsThereAlready.O)
+  
+  wprint(whatIsThereAlready.N)
+
+  only.grid <- new.env()
+
+  if(others){
+     wprint("recomputed anew from neither .O nor .N architecture")
+
+     for(what in whatIsThereAlready.E){
+       wprint(what)
+       what.to <- paste(what,".",keep,sep="")
+       vec <- get(what, envir=sam)
+       for(Fam in names(vec)){
+             wprint(Fam)
+             grid <- vec[[Fam]]$grid
+             wprint(head(grid))
+             a0 <- .MakeGridList(grid[,1], Y=grid[,-1,drop=FALSE],
+                                 withSmooth = withSmooth)
+             vec[[Fam]] <- a0
+       }
+       assign(what.to, vec, envir=only.grid)
+     }
+     lsA <- ls(all.names=T,envir=only.grid)
+     wprint(lsA)
+  }
+
+  if(!onlyothers){
+
+    wprint("copied/recomputed anew from from current architecture")
+
+    for(what in whatIsThereAlready.N){
+      wprint(what)
+      vec <- get(what, envir=sam)
+      if(overwrite){
+         for(Fam in names(vec)){
+            wprint(Fam)
+            grid <- vec[[Fam]]$grid
+            wprint(head(grid))
+            a0 <- .MakeGridList(grid[,1], Y=grid[,-1,drop=FALSE],
+                                withSmooth = withSmooth)
+            vec[[Fam]] <- a0
+         }
+      }
+      if(integrateto){
+         vec.E <- get(what, envir = only.grid)
+         for(Fam in names(vec)){
+            wprint(Fam)
+            grid.E <- vec.E[[Fam]]$grid
+            grid <- vec[[Fam]]$grid
+            grid.0 <- rbind(grid.E, grid)
+            oI <- order(grid.0[,1])
+            wI <- !duplicated(grid.0[oI,1])
+            grid <- grid.0[wI,]
+            wprint(head(grid))
+            a0 <- .MakeGridList(grid[,1], Y=grid[,-1,drop=FALSE],
+                                withSmooth = withSmooth)
+            vec[[Fam]] <- a0
+         }
+      }
+      assign(what, vec, envir=only.grid)
+    }
+    lsA <- ls(all.names=T,envir=only.grid)
+    wprint(lsA)
+
+    if(!onlyCurrent){
+       wprint("copy foreign architecture")
+       for(what in whatIsThereAlready.O){
+           wprint(what)
+           assign(what, get(what, envir=sam), envir=only.grid)
+           }
+    }
+    lsA <- ls(all.names=T,envir=only.grid)
+    wprint(lsA)
+
+    for(what in whatIsThereAlready.O){
+        wprint("translating foreign to current architecture")
+        what.N <- sub(paste("\\.", todo, "$", sep=""),
+                      paste(".", keep, sep=""),what)
+        wprint(c(from=what, to=what.N))
+
+        wG <- get(what, envir=sam)
+        anyFam <- FALSE
+        vec <- NULL
+        if(onlyCurrent) if(what.N %in% whatIsThereAlready.N)
+                           vec <- get(what.N,envir=sam)
+        for(Fam in names(wG)){
+            wprint(Fam)
+            if(! Fam %in% names(vec)){
+               anyFam <- TRUE
+               grid <- wG[[Fam]]$grid
+               wprint(head(grid))
+               a0 <- .MakeGridList(grid[,1], Y=grid[,-1,drop=FALSE],
+                                withSmooth = withSmooth)
+               vec[[Fam]] <- a0
+            }
+        }
+        if(integrateto){
+            vec.E <- get(what, envir = only.grid)
+            anyFam <- TRUE
+            for(Fam in names(wG)){
+               wprint(Fam)
+               grid.E <- vec.E[[Fam]]$grid
+               grid <- wG[[Fam]]$grid
+               grid.0 <- rbind(grid.E, grid)
+               oI <- order(grid.0[,1])
+               wI <- !duplicated(grid.0[oI,1])
+               grid <- grid.0[wI,]
+               wprint(head(grid))
+               a0 <- .MakeGridList(grid[,1], Y=grid[,-1,drop=FALSE],
+                                withSmooth = withSmooth)
+               vec[[Fam]] <- a0
+            }
+        }
+        if(anyFam) assign(what.N, vec, envir=only.grid)
+    }
+    lsA <- ls(all.names=T,envir=only.grid)
+    wprint(lsA)
+  }
+
+  sysFile <- file.path(sysRdaFolder,"sysdata.rda")
+
+  if(!debug){
+     save(list=lsA, envir=only.grid, file=sysFile)
+     tools::resaveRdaFiles(sysRdaFolder)
+  }else{
+     print(paste("save(list=lsA, envir=only.grid, file=", sysFile,")", sep=""))
+  }
+}
+
+if(FALSE){
+  source("makegridlist.R")
+ .myFolder <- "C:/rtest/RobASt/branches/robast-0.9/pkg"
+  source(file.path(.myFolder,"RobExtremes/R","recomputeinterpolators.R"))
+ .myfiles1 <- file.path(.myFolder,
+               c("ROptEst/R", "RobExtremes/R", "RobExtremesBuffer"),
+               "sysdata.rda")
+
+ .myfiles <- file.path(.myFolder, "RobExtremes/R/sysdata.rda")
+ 
+ .recomputeInterpolators(file.path(.myFolder,"RobExtremes/R/sysdata.rda"),
+        sysRdaFolder = file.path(.myFolder,"RobExtremes/R"), debug = TRUE)
+
+  wha <- c(".OMSE",".RMXE",".MBRE",".SnGrids")
+  for(w in wha) assign(w,get(w, envir=asNamespace("RobExtremes")),envir=nE)
+  save(list=wha,envir=nE, file="sysdata-oold.rda")
+
+ .recomputeInterpolators(c("sysdata-ooold.rda","sysdata-0.rda"), others = TRUE, onlyothers = FALSE,    sysRdaFolder = ".", integrateto = TRUE)
+
+}
\ No newline at end of file

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

Added: branches/robast-0.9/pkg/RobExtremes/inst/AddMaterial/interpolation/interpolationscripts.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/inst/AddMaterial/interpolation/interpolationscripts.R	                        (rev 0)
+++ branches/robast-0.9/pkg/RobExtremes/inst/AddMaterial/interpolation/interpolationscripts.R	2013-01-24 19:20:24 UTC (rev 551)
@@ -0,0 +1,33 @@
+require(RobExtremes)
+
+.myFolder <- "C:/rtest/RobASt/branches/robast-0.9/pkg/RobExtremesBuffer"
+.myFolder1 <- "C:/rtest/RobASt/branches/robast-0.9/pkg/RobExtremes/R"
+.myFolder2 <- "C:/rtest/RobASt/branches/robast-0.9/pkg/RobExtremes"
+
+### produce Sn grid
+.saveInterpGrid <- RobExtremes:::.saveInterpGrid
+.saveInterpGrid(getShapeGrid(gridsize=500, cutoff.at.0=0.005),
+                sysRdaFolder = .myFolder, accuracy = 5000,upp=10)
+
+### produce LM grids
+.svInt <- RobExtremes:::.svInt
+.OMSE.xi <- RobExtremes:::.OMSE.xi
+.MBRE.xi <- RobExtremes:::.MBRE.xi
+.RMXE.xi <- RobExtremes:::.RMXE.xi
+.svInt(.OMSE.xi, ".OMSE", sysRdaFolder = .myFolder)
+.svInt(.MBRE.xi, ".MBRE", sysRdaFolder = .myFolder)
+.svInt(.RMXE.xi, ".RMXE", sysRdaFolder = .myFolder)
+
+#### now this is still much too large.
+#### therefore, in a first step, we only use the saved grids
+### and by .MakeGridList, separately for R<2.16 and R>2.16, we thin out
+### the references
+
+ .myfiles <- file.path(.myFolder, "sysdata.rda")
+
+ .myfiles1 <- file.path(.myFolder1, "RobExtremes/R/sysdata.rda")
+
+ ## on R-3.0.0
+RobExtremes:::.recomputeInterpolators(.myfiles, sysRdaFolder = .myFolder)
+ ## on R-2.15.2
+RobExtremes:::.recomputeInterpolators(.myfiles1, sysRdaFolder = .myfolder2)

Copied: branches/robast-0.9/pkg/RobExtremes/man/internal-interpolate.Rd (from rev 546, branches/robast-0.9/pkg/RobExtremes/man/internal-interpolateLM.Rd)
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/man/internal-interpolate.Rd	                        (rev 0)
+++ branches/robast-0.9/pkg/RobExtremes/man/internal-interpolate.Rd	2013-01-24 19:20:24 UTC (rev 551)
@@ -0,0 +1,167 @@
+\name{internal_interpolate_helpers_for_RobExtremes}
+\alias{internal_interpolate_helpers_for_RobExtremes}
+\alias{.modify.xi.PFam.call}
+\alias{.RMXE.xi}
+\alias{.OMSE.xi}
+\alias{.MBEE.xi}
+\alias{.getLMGrid}
+\alias{.MakeGridList}
+\alias{.saveInterpGrid}
+\alias{.recomputeInterpolators}
+\alias{.svInt}
+
+\title{Internal helper functions for generating interpolation grids for
+       speed up in package RobExtremes}
+
+\description{
+These functions are used internally to generate interpolation grids,
+for Lagrange multipliers or LDEstimators in package \pkg{RobExtremes},
+to be stored in the
+respective \file{sysdata.rda} file. }
+
+\usage{
+.modify.xi.PFam.call(xi, PFam)
+
+.RMXE.xi(xi, PFam)
+.MBRE.xi(xi, PFam)
+.OMSE.xi(xi, PFam)
+
+.getLMGrid(xiGrid = getShapeGrid(), PFam = GParetoFamily(scale=1,shape=2),
+           optFct = .RMXE.xi, GridFileName="LMGrid.Rdata", withSmooth = TRUE,
+           withPrint = FALSE, withCall = FALSE)
+
+.MakeGridList(xiGrid, Y, withSmooth = TRUE)
+
+.saveInterpGrid(xiGrid = getShapeGrid(), PFam = GParetoFamily(),
+            sysRdaFolder, getFun = getSnGrid, ...,
+            nameInSysdata = ".SnGrids", GridFileName, withSmooth = TRUE,
+            withPrint = TRUE, withCall = FALSE, Y = NULL, elseFun = NULL)
+
+.svInt(optF = .RMXE.xi, nam = ".RMXE",
+       xiGrid = getShapeGrid(500, cutoff.at.0=0.005),
+       sysRdafolder, PFam = GParetoFamily(shape=1,scale=2))
+
+.recomputeInterpolators(sysdataFiles, sysRdaFolder = ".", others = FALSE,
+                      onlyothers = FALSE, overwrite = TRUE, integrateto = FALSE,
+                      onlyCurrent = FALSE, withPrint =TRUE, withSmooth = TRUE,
+                      debug = FALSE)
+}
+
+\arguments{
+  \item{xi}{numeric of length 1; shape value. }
+  \item{PFam}{an object of class \code{"ParamFamily"}, the parametric family
+              at which to evaluate the Lagrange multipliers or LDEstimators;
+              in our use case, it is a shape-scale model, hence the respective
+              (main) parameter must contain \code{"scale"} and \code{"shape"}. }
+  \item{withSmooth}{logical of length 1: shall a smoothing spline be used?}
+  \item{withPrint}{logical of length 1: shall current shape value be printed out?}
+  \item{xiGrid}{numeric; grid of shape values. }
+  \item{Y}{in case \code{.MakeGridList}: array or matrix; in case
+           \code{.saveInterpGrid} array or \code{NULL}; if non-null,
+           contains precomputed y-values, so that call to \code{getFun}
+           resp. \code{optFct} can be omitted. }
+  \item{optFct, optF}{function with arguments \code{xi} and \code{PFam};
+                determines the Lagrange multipliers. }
+  \item{GridFileName}{character; if \code{GridFileName!=""}, the pure
+            y-grid values are saved under this filename. }
+  \item{withCall}{logical of length 1: shall the call be saved, too?}
+  \item{xiGrid}{numeric; grid of shape values. }
+  \item{sysRdaFolder}{the folder where \pkg{RobExtremes}
+       (or the respective package) is being developed; must not be missing. }
+  \item{getFun}{function with first argument \code{xi}, and second argument
+                \code{PFam} and last arguments \code{GridFileName},
+                \code{withSmooth}, \code{withPrint}, and \code{withCall};
+                produces the y-values for the interpolation grid. }
+  \item{\dots}{further arguments to be passed on to \code{getFun}. }
+  \item{nameInSysdata, nam}{name under which the list of interpolated grids is stored
+                       in file \file{sysdata.rda}. }
+  \item{elseFun}{function or \code{NULL}; if \code{Y} is non-null, contains
+           function to transform \code{Y} to desired return value. }
+
+  \item{sysdataFiles}{character; filenames of \file{sysdata.rda} files from
+                      where to extract the interpolation grids}
+  \item{overwrite}{logical; if \code{TRUE} existing interpolation functions
+      for the current R version get recomputed.}
+  \item{others}{logical; if \code{TRUE} and in the \file{sysdata.rda} files
+       to be modified, there are grids not ending to \code{.N} (for R>2.16)
+       or \code{.O} (for R<2.16), we also recompute the interpolation
+       functions for these grids. }
+  \item{onlyothers}{logical; if \code{TRUE}, only the interpolation functions
+  for \code{others}-grids (see argument \code{others}) are recomupted. }
+ \item{onlyCurrent}{logical; if \code{TRUE} existing interpolation functions
+      for the foreign R version are not included in the new \file{sysdata.rda}
+      file.}
+  \item{integrateto}{logical; if \code{TRUE} and there are grids with
+    ending \code{.N}, \code{.O} and ``others'', these are merged. }
+  \item{debug}{logical; if \code{TRUE} the \file{sysdata.rda} file is not
+     created/overwritten in the end. }
+}
+\details{
+  \code{.MBRE.xi} computes the Lagrange multipliers for the MBRE estimator,
+  \code{.OMSE.xi} for the OMSE estimator at radius \code{r=0.5},
+  and \code{.RMXE.xi} the RMXE estimator.
+  
+  \code{.MakeGridList} transforms the return values of the preceding functions
+  gathered in matrices in respective grids and can also be used for
+  Lagrange multiplier matrices already computed otherwise.
+  
+  \code{.saveInterpGrid} is the utility to do the actual computation.
+   More specifically, the code first loads the contents of file
+   \file{sysdata.rda} into an environment which is particularly created
+   for this purpose (if this file exists). It then looks up whether a
+   respective entry for family \code{PFam} already exists in
+   \file{sysdata.rda}-object \code{nameInSysdata}.
+   If this is the case the developer is asked whether he wants to overwrite
+   the respective entry, and if so he does so with the results of a respective
+   call to \code{getFun}.
+
+   In case there has not been an \file{sysdata.rda}-object \code{nameInSysdata}
+   so far, the code creates one and writes the results of a respective
+   call to \code{getFun} to it.
+
+   \code{.svInt} is a short form for \code{.saveInterpGrid} for LM interpolation.
+
+   \code{.recomputeInterpolators} recomputes the interpolating functions from
+     grids in existing \file{sysdata.rda} files -- either to translate them
+     to another R version, or to shrink the respective file.
+}
+\note{These functions are only meant for the developers of package \pkg{RobExtremes}
+      (or respective packages).
+      They can be used to speed up things by interpolation.
+      Our use case is a speed up for further scale-shape families (or enhance
+      existing speed-ups) such that the respective grids are stored in
+      the \file{sysdata.rda} file of this package and can be used in
+      (exported) new particular methods for functional \code{Sn}.
+      Special attention has to be paid for R-versions pre and post R-2.16.
+      So if interpolation functions are desired for both alternatives,
+      
+      }
+\value{
+  \item{.modify.xi.PFam.call}{A call to evaluate the parametric
+            family at the new parameter value. }
+  \item{.MBRE.xi}{A list with items \code{b} (a number; clipping height),
+                  \code{a} (a 2-vector; outer centering),
+                  \code{a.w} (a 2-vector; inner centering, in
+                   the weight), \code{A} (a 2x2 matrix; outer standardization),
+                  \code{A.w} (a 2x2 matrix; inner standardization, in the weight).
+                  }
+  \item{.OMSE.xi}{as \code{.MBRE.xi}. }
+  \item{.RMXE.xi}{as \code{.MBRE.xi}. }
+  \item{.getLMGrid}{A list with items \code{grid}, a matrix with the interpolation
+                    grid and \code{fct} a function in \code{x} (the shape)
+                    and \code{i} deciding on the Lagrange multiplier. }
+  \item{.MakeGridList}{A list with items \code{grid} and \code{fct} as
+                       in the return value of \code{.getLMGrid}. }
+  \item{.saveInterpGrid}{  \code{invisible(NULL)}}
+  \item{.svInt}{  \code{invisible(NULL)}}
+}
+\seealso{\code{\link{interpolateSn}}}
+\examples{
+\dontrun{
+### code to produce grid for GPareto:
+  .saveInterpGrid(sysRdaFolder = "C:/rtest/RobASt/branches/RobASt-0.9/pkg/RobExtremes/R",
+              accuracy = 800)
+}
+}
+\keyword{internal}
+\concept{utilities}

Deleted: branches/robast-0.9/pkg/RobExtremes/man/internal-interpolateLM.Rd
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/man/internal-interpolateLM.Rd	2013-01-23 16:24:43 UTC (rev 550)
+++ branches/robast-0.9/pkg/RobExtremes/man/internal-interpolateLM.Rd	2013-01-24 19:20:24 UTC (rev 551)
@@ -1,97 +0,0 @@
-\name{internal_interpolateLM_helpers_for_RobExtremes}
-\alias{internal_interpolateLM_helpers_for_RobExtremes}
-\alias{.modify.xi.PFam.call}
-\alias{.RMXE.xi}
-\alias{.OMSE.xi}
-\alias{.MBEE.xi}
-\alias{.getLMGrid}
-\alias{.MakeGridList}
-
-\title{Internal helper functions for generating interpolation grids for
-       Lagrange Multipliers in package RobExtremes}
-
-\description{
-These functions are used internally to generate interpolation grids,
-for Lagrange multipliers in package \pkg{RobExtremes}, to be stored in the
-respective \file{sysdata.rda} file. }
-
-\usage{
-.modify.xi.PFam.call(xi, PFam)
-
-.RMXE.xi(xi, PFam)
-.MBRE.xi(xi, PFam)
-.OMSE.xi(xi, PFam)
-
-.getLMGrid(xiGrid = getShapeGrid(),
-                      PFam = GParetoFamily(scale=1, shape=2),
-                      optFct = .RMXE.xi,
-                      withSmooth = TRUE,
-                      withPrint = FALSE, withCall = FALSE)
-
-.MakeGridList(xiGrid, Y, withSmooth = TRUE)
-}
-
-\arguments{
-  \item{xi}{numeric of length 1; shape value. }
-  \item{PFam}{an object of class \code{"ParamFamily"}, the parametric family
-              at which to evaluate the Lagrange multipliers; in our use case,
-              it is a shape-scale model, hence the respective (main) parameter
-              must contain \code{"scale"} and \code{"shape"}. }
-  \item{withSmooth}{logical of length 1: shall a smoothing spline be used?}
-  \item{withPrint}{logical of length 1: shall current shape value be printed out?}
-  \item{xiGrid}{numeric; grid of shape values. }
-  \item{Y}{array or matrix; contains precomputed y-values. }
-  \item{optFct}{function with arguments \code{xi} and \code{PFam};
-                determines the Lagrange multipliers. }
-  \item{withCall}{logical of length 1: shall the call be saved, too?}
-}
-\details{
-  \code{.MBRE.xi} computes the Lagrange multipliers for the MBRE estimator,
-  \code{.OMSE.xi} for the OMSE estimator at radius \code{r=0.5},
-  and \code{.RMXE.xi} the RMXE estimator.
-  
-  \code{.MakeGridList} transforms the return values of the preceding functions
-  gathered in matrices in respective grids and can also be used for
-  Lagrange multiplier matrices already computed otherwise.
-  
-  The actual computation can be done with \code{\link{.saveInterpGrid}}.
-  
-  Instead of \code{.getSnGrid} in our case this will call \code{.getLMGrid}
-  to compute the Lagrange multipliers.
-}
-\note{These functions are only meant for the developers of package \pkg{RobExtremes}
-      (or respective packages).
-      They can be used to speed up things by interpolation.
-      Our use case is a speed up for further scale-shape families (or enhance
-      existing speed-ups) such that the respective grids are stored in
-      the \file{sysdata.rda} file of this package and can be used in
-      (exported) new particular methods for functional \code{Sn}.}
-\value{
-  \item{.modify.xi.PFam.call}{A call to evaluate the parametric
-            family at the new parameter value. }
-  \item{.MBRE.xi}{A list with items \code{b} (a number; clipping height),
-                  \code{a} (a 2-vector; outer centering),
-                  \code{a.w} (a 2-vector; inner centering, in
-                   the weight), \code{A} (a 2x2 matrix; outer standardization),
-                  \code{A.w} (a 2x2 matrix; inner standardization, in the weight).
-                  }
-  \item{.OMSE.xi}{as \code{.MBRE.xi}. }
-  \item{.RMXE.xi}{as \code{.MBRE.xi}; in addition \code{r}, the least favorable
-                  radius.
-                  }
-  \item{.getLMGrid}{A list with items \code{grid}, a matrix with the interpolation
-                    grid and \code{fct} a function in \code{x} (the shape)
-                    and \code{i} deciding on the Lagrange multiplier. }
-  \item{.MakeGridList}{A list with items \code{grid} and \code{fct} as
-                       in the return value of \code{.getLMGrid}. }
-}
-\seealso{\code{\link{interpolateSn}}}
-\examples{
-\dontrun{
-### code to produce grid for GPareto:
-  .saveInterpGrid(sysRdaFolder = "C:/rtest/RobASt/branches/RobASt-0.9/pkg/RobExtremes/R",
-              accuracy = 800)
-}
-}
-\keyword{internal}
-\concept{utilities}

Deleted: branches/robast-0.9/pkg/RobExtremes/man/internal-interpolateSn.Rd
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/man/internal-interpolateSn.Rd	2013-01-23 16:24:43 UTC (rev 550)
+++ branches/robast-0.9/pkg/RobExtremes/man/internal-interpolateSn.Rd	2013-01-24 19:20:24 UTC (rev 551)
@@ -1,76 +0,0 @@
-\name{internal_interpolateSn_helpers_for_distrMod}
-\alias{internal_interpolateSn_helpers_for_distrMod}
-\alias{.saveInterpGrid}
-
-\title{Internal helper functions for generating interpolation grids for Sn in
-       package distrMod}
-
-\description{
-This function is used internally to generate interpolation grids,
-for example for Sn in package ``distrMod'', to be stored in the
-respective \file{sysdata.rda} file. }
-
-\usage{
-.saveInterpGrid(xiGrid = getShapeGrid(), PFam = GParetoFamily(),
-            sysRdaFolder, getFun = getSnGrid,
-            ..., nameInSysdata = ".SnGrids",
-            withSmooth = TRUE, withPrint = TRUE, Y = NULL, elseFun = NULL)
-}
-
-\arguments{
-  \item{xiGrid}{numeric; grid of shape values. }
-  \item{PFam}{an object of class \code{"ParamFamily"}. In our use case,
-              it is the parametric family at which to evaluate the LDEstimator;
-              hence the respective (main) parameter must contain \code{"scale"}
-              and \code{"shape"}. }
-  \item{sysRdaFolder}{the folder where \pkg{distrMod} (or the respective package)
-                      is being developed; must not be missing. }
-  \item{getFun}{function with first argument \code{xi}, and second argument
-                \code{PFam} and last arguments \code{withSmooth} and
-                \code{withPrint}; produces the
-                y-value for the interpolation grid; in our case the Sn-value. }
-  \item{\dots}{further arguments to be passed on to \code{getFun}. }
-  \item{nameInSysdata}{name under which the list of interpolated grids is stored
-                       in file \file{sysdata.rda}. }
-  \item{withSmooth}{logical of length 1: shall a smoothing spline be used?}
-  \item{withPrint}{logical of length 1: shall current shape value be printed out?}
-  \item{Y}{array or \code{NULL}; if non-null, contains precomputed y-values, so
-           that call to \code{getFun} can be omitted. }
-  \item{elseFun}{function or \code{NULL}; if \code{Y} is non-null, contains
-           function to transform \code{Y} to desired return value. }
-}
-\details{
-  The code first loads the contents of file \file{sysdata.rda} into an
-  environment which is particularly created for this purpose (if this
-  file exists). It then looks up whether a respective entry for family
-  \code{PFam} already exists in \file{sysdata.rda}-object \code{nameInSysdata}.
-  If this is the case the developer is asked whether he wants to overwrite
-  the respective entry, and if so he does so with the results of a respective
-  call to \code{getFun}.
-  
-  In case there has not been an \file{sysdata.rda}-object \code{nameInSysdata}
-  so far, the code creates one and writes the results of a respective
-  call to \code{getFun} to it.
-}
-\note{This function is only meant for the developers of package \pkg{distrMod}
-      (or respective packages).
-      It can be used to speed up things by interpolation.
-      Our use case is a speed up for further scale-shape families (or enhance
-      existing speed-ups) such that the respective grids are stored in
-      the \file{sysdata.rda} file of this package and can be used in
-      (exported) new particular methods for functional \code{Sn}.}
-\value{
-  \code{invisible(NULL)}
-}
-\seealso{\code{\link{interpolateSn}}}
-\examples{
-\dontrun{
-### code to produce grid for GPareto:
-RobExtremes:::.saveInterpGrid(getShapeGrid(gridsize=500,
-                  cutoff.at.0=0.005),sysRdaFolder =
-        "C:/rtest/RobASt/branches/robast-0.9/pkg/RobExtremes/R",
-              accuracy = 5000,upp=10)
-}
-}
-\keyword{internal}
-\concept{utilities}

Modified: branches/robast-0.9/pkg/RobExtremes/man/interpolateSn.Rd
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/man/interpolateSn.Rd	2013-01-23 16:24:43 UTC (rev 550)
+++ branches/robast-0.9/pkg/RobExtremes/man/interpolateSn.Rd	2013-01-24 19:20:24 UTC (rev 551)
@@ -16,8 +16,9 @@
              withPos=TRUE, cutoff.at.0=1e-4, fac = 2)
 
 getSnGrid(xiGrid = getShapeGrid(), PFam=GParetoFamily(), low=0,
-                      upp=1.01, accuracy = 10000, withSmooth= TRUE,
-                      withPrint = FALSE, withCall = FALSE)
+                      upp=1.01, accuracy = 10000, GridFileName="SnGrid.Rdata",
+                      withSmooth= TRUE, withPrint = FALSE,
+                      withCall = FALSE)
 }
 \arguments{
   \item{gridsize}{integer; the size of the grid to be created. }
@@ -34,6 +35,8 @@
   \item{low}{numeric; argument for \code{\link{Sn}}. }
   \item{upp}{numeric; argument for \code{\link{Sn}}. }
   \item{accuracy}{numeric; argument for \code{\link{Sn}}. }
+  \item{GridFileName}{character; if \code{GridFileName!=""}, the pure
+  y-grid values are saved under this filename. }
   \item{withSmooth}{logical of length 1: shall a smoothing spline be used?}
   \item{withPrint}{logical of length 1: shall current shape value be printed out?}
   \item{withCall}{logical of length 1: shall the call be saved, too?}
@@ -77,8 +80,6 @@
 getShapeGrid(50)
 head(getShapeGrid(withPos=FALSE))
 
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/robast -r 551


More information about the Robast-commits mailing list