[Robast-commits] r1032 - in pkg/RobAStRDA: . R inst inst/AddMaterial/interpolation man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jul 23 22:17:25 CEST 2018
Author: ruckdeschel
Date: 2018-07-23 22:17:24 +0200 (Mon, 23 Jul 2018)
New Revision: 1032
Added:
pkg/RobAStRDA/inst/CITATION
Removed:
pkg/RobAStRDA/inst/CITATION
Modified:
pkg/RobAStRDA/DESCRIPTION
pkg/RobAStRDA/R/sysdata.rda
pkg/RobAStRDA/inst/AddMaterial/interpolation/WriteUp-Interpolators.txt
pkg/RobAStRDA/inst/AddMaterial/interpolation/interpolationscripts.R
pkg/RobAStRDA/inst/NEWS
pkg/RobAStRDA/man/0RobRDA-package.Rd
Log:
[RobAStRDA] merged branch 1.1 to trunk
Modified: pkg/RobAStRDA/DESCRIPTION
===================================================================
--- pkg/RobAStRDA/DESCRIPTION 2018-07-23 20:15:10 UTC (rev 1031)
+++ pkg/RobAStRDA/DESCRIPTION 2018-07-23 20:17:24 UTC (rev 1032)
@@ -1,25 +1,25 @@
Package: RobAStRDA
-Version: 1.0.3
-Date: 2016-09-04
+Version: 1.1.0
+Date: 2018-07-18
Title: Interpolation Grids for Packages of the 'RobASt' - Family of Packages
Description: Includes 'sysdata.rda' file for packages of the 'RobASt' - family of packages; is
currently used by package 'RobExtremes' only.
-Depends: R (>= 3.3.0)
-Authors at R: c(person("Matthias", "Kohl", role=c("aut", "cph")),
- person("Bernhard", "Spangl",role="ctb", comment="contributed smoothed grid values of
- the Lagrange multipliers"),
- person("Sascha", "Desmettre", role="ctb", comment="contributed smoothed grid values of
- the Lagrange multipliers"),
- person("Eugen", "Massini", role="ctb", comment="contributed an interactive smoothing routine for smoothing the Lagrange multipliers and smoothed
- grid values of the Lagrange multipliers"),
- person("Mykhailo", "Pupashenko", role="ctb", comment="helped with manual smoothing of the interpolators"),
- person("Daria", "Pupashenko", role="ctb", comment="helped with manual smoothing of the interpolators"),
- person("Gerald", "Kroisandt", role="ctb", comment="helped with manual smoothing of the interpolators"),
- person("Peter", "Ruckdeschel", role=c("cre", "cph", "aut"), email="peter.ruckdeschel at uni-oldenburg.de"))
+Depends: R (>= 2.3.0)
+Authors at R: c(person("Matthias", "Kohl", role=c("aut", "cph")), person("Bernhard",
+ "Spangl",role="ctb", comment="contributed smoothed grid values of the Lagrange
+ multipliers"), person("Sascha", "Desmettre", role="ctb", comment="contributed smoothed
+ grid values of the Lagrange multipliers"), person("Eugen", "Massini", role="ctb",
+ comment="contributed an interactive smoothing routine for smoothing the Lagrange
+ multipliers and smoothed grid values of the Lagrange multipliers"), person("Mykhailo",
+ "Pupashenko", role="ctb", comment="helped with manual smoothing of the interpolators"),
+ person("Daria", "Pupashenko", role="ctb", comment="helped with manual smoothing of the
+ interpolators"), person("Gerald", "Kroisandt", role="ctb", comment="helped with manual
+ smoothing of the interpolators"), person("Peter", "Ruckdeschel", role=c("cre", "cph",
+ "aut"), email="peter.ruckdeschel at uni-oldenburg.de"))
LazyData: yes
ByteCompile: yes
License: LGPL-3
URL: http://robast.r-forge.r-project.org/
LastChangedDate: {$LastChangedDate: 2011-09-30 11:10:33 +0200 (Fr, 30 Sep 2011) $}
LastChangedRevision: {$LastChangedRevision: 453 $}
-SVNRevision: 874
+VCS/SVNRevision: 940
Modified: pkg/RobAStRDA/R/sysdata.rda
===================================================================
(Binary files differ)
Modified: pkg/RobAStRDA/inst/AddMaterial/interpolation/WriteUp-Interpolators.txt
===================================================================
--- pkg/RobAStRDA/inst/AddMaterial/interpolation/WriteUp-Interpolators.txt 2018-07-23 20:15:10 UTC (rev 1031)
+++ pkg/RobAStRDA/inst/AddMaterial/interpolation/WriteUp-Interpolators.txt 2018-07-23 20:17:24 UTC (rev 1032)
@@ -1,24 +1,26 @@
WRITE-UP:
Interpolation Grids in R-Packages
-Peter Ruckdeschel, Jan 27 2013 revised Mar 12 2013
+Peter Ruckdeschel, Jan 27 2013 revised Mar 12 2013 revised Jul 18 2018
1. Starting Point:
-Computation of optimally robust ICs in our R pkgs works well, but may be slow,
-in particular in case of lack of invariance---like in scale-shape models, when
-we cannot move the IC from one parameter value theta to the next by invariance.
+Computation of optimally robust influence curves [=opt-rob ICs] in our R pkgs
+works well, but may be slow, in particular in case of lack of invariance---like
+in scale-shape models, when we cannot move the IC from one parameter value theta
+to the next by invariance.
Then we have to recompute the IC for each theta anew.
-As the opt-rob ICs are given through Lagrange multipliers LMs) which are continuous
-in theta as shown by Matthias Kohl, we may compute opt-rob ICs for a grid of
-theta values offline and then, for a new theta value use interpolation.
-The same strategy applies to speed up evaluation of scale functional Sn (Croux)
-for Shape-Scale-models.
+As the opt-rob ICs are given through Lagrange multipliers [=LMs]) which are
+continuous in theta as shown by Matthias Kohl (see his PhD thesis), we may
+compute opt-rob ICs for a grid of theta values offline and then, for a new
+theta value use interpolation.
+The same strategy applies to speed up evaluation of scale functional Sn
+(Croux, Rousseeuw) for Shape-Scale-models.
2. Problem when passing from R-2.15 to R-3.0
From R-2.15 to R-3.0 Brian Ripley (R-Core) has changed some non-exported
-interfaces to C-code. This affects approxfun and splinefun which we
-are using for interpolation because saving the results of approxfun and
+interfaces to C-code. This affects approxfun and splinefun which we are
+using for interpolation because saving the results of approxfun and
splinefun comes up much faster (experiments by Matthias) than using approx
resp. spline. Now approxfun, splinefun from R-3.0 on return functions
whose body contains R code which is not yet interpretable with R-2.15
@@ -28,6 +30,13 @@
one with suffix ".N" for >2.16, and at run time determine the current
R version and take the suitable one.
+[added Jul 2018]: In principle, this could be solved now, requiring
+R >= 3.3 (which is no longer "too new"), but for compatibility, we
+leave it as is (the respective sysdata.rda file containing functions
+for both R >= 3.0 and R <= 2.15 only grows by less than 50 KB) and
+indicated how to use this for R <= 2.15 in a file HowTo in the
+package main folder.
+
3. Size of packages
With CRAN getting larger (>4000 pkgs) people from CRAN have set up some
@@ -54,36 +63,41 @@
5. Datastructure
As we deal with several robust optimality criteria (MSE, RMX, MBR)
-and several models (GPD, GEVD, Gamma, Weibull), our grids are stored
-in nested lists. Debatable, but done so for the moment.
+and several models---currently: GPD, GEVD (with and without knowing
+mu), Gamma, Weibull---, our grids are stored in nested lists.
+Debatable, but done so for the moment. Similarly, we store---for
+the same models---fast interpolators for the Sn estimator for scale.
-After a discussion with Gerald Kroisandt, we now have a more sparse
+After a discussion with Gerald Kroisandt, we now have a sparser
data structure.
Let's use the following notation for describing the list structure:
-Each layer in the hierarchie gives one ">" and an item is inserted
+Each layer in the hierarchy gives one ">" and an item is inserted
below the item next left to it with number of ">" by 1 smaller than
its own. I-fct denotes the interpolating function to the grid left
-to it (named "fun"). {} denote optional entries and capture that one may want
-to smooth out the original interpolation grids in entries 'grid',
-giving smoothed grids written into entries 'gridS'.
+to it (named "fun"). {} denote optional entries and capture that one
+may want to smooth out the original interpolation grids in
+entries 'grid', giving smoothed grids written into entries 'gridS'.
OptCrit for the time being is either in ".OMSE", ".MBRE", ".RMXE" or ".Sn".
Models for the time being are GPD, GEVD, Gamma, Weibull.
Then our structure goes as follows:
-[OptCrit], >[model1], >>[grid], {>>[gridS],} >>[I-fct.O], >>[I-Fct.N],
->[model2], >>[grid], {>>[gridS],} >>[I-fct.O], >>[I-Fct.N], ...
+[model1], >[OptCrit1], >>[grid], {>>[gridS],} >>[I-fct.O], >>[I-Fct.N],
+[model1], >[OptCrit2], >>[grid], {>>[gridS],} >>[I-fct.O], >>[I-Fct.N],
+...
+[model1], >Sn, >>[grid], {>>[gridS],} >>[I-fct.O], >>[I-Fct.N],
+[model2], >[OptCrit1], >>[grid], {>>[gridS],} >>[I-fct.O], >>[I-Fct.N], ...
-For instance, to get the clipping height "b" in OMSE for "GEV" at
-theta = (xi=0.3) for >R-2.16, we may write
- .OMSE[["GEVFamily"]][["fun.N"]][[1]](0.3)
+For instance, to get the clipping height "b" in OMSE for "GEV" with
+known parameter mu at theta = (xi=0.3) for >R-2.16, we may write
+ .GEV[["OMSE"]][["fun.N"]][[1]](0.3)
-
6. Namespace issue
It is absolutely necessary that functions I-fct (or I-fct.O, I-fct.N)
be generated _in_ the namespace of the pkg; otherwise conflicts arise,
as namespaces have to be loaded twice (and hence pkg installation already
fails)
+
Finding this out took me quite some time!
My initial idea w.r.t to point 3. was to save the grids to some rda file
@@ -102,13 +116,16 @@
non-exported functions .RMXE.th, .MBRE.th, .OMSE.th and .getLMGrid to compute
Lagrange multipliers for "OMSE"-, "MBR"-, "RMX"-ICs, .generateInterpGrid to
produce the grid and .saveGridToCSV, and .readGridFromCSV to read grids from
-files and write grids to files.
+files and write grids to files (all in file interpolLM.R).
-Infrastructure particular for scale-shape models is maintained in pkg 'RobExtremes',
-i.e. non-exported functions .RMXE.xi, .OMSE.xi, .MBEE.xi, .modify.xi.PFam.call,
+Infrastructure particular for scale-shape models is maintained in pkg 'RobExtremes'.
+I.e. non-exported functions .RMXE.xi, .OMSE.xi, .MBEE.xi, .modify.xi.PFam.call,
.getLMGrid to compute respective Lagrante multipliers, and .svInt and
-.generateInterpGridSn to generate the grids for LM's and Sn. Finally, .getPsi
-to given set of interpolators generates an optimally robust IC.
+.generateInterpGridSn to generate the grids for LM's and Sn (all in file interpolLM.R).
+The respective infrastructure for the grids for Sn is provided through functions
+getShapeGrid, getSnGrid, .generateInterpGridSn (all in file interpolSn.R)
+Finally, .getPsi (in file internal-getpsi.R) to given set of interpolators generates
+an optimally robust IC, and .Sn.intp accesses the interpolator for Sn (in file SnQn.R)
Actual code to produce the interpolators and to manipulate the grids
(including smoothing grids out) is maintained in pkg 'RobAStRDA' which
@@ -147,7 +164,8 @@
9. Exports
As this is functionality which should not bother the standard user of
-RobExtremes, basicall all infrastructure in 6. and 8. is not exported.
+'RobExtremes', basically all infrastructure mentioned in sections 6
+and 8 of this write-up is not exported.
OTOH, these functions could be of interest to the user wanting to generate
new interpolators for new scale shape families or, say simply for the
95% VaR, each function remains in the R folder of the pkgs and is
@@ -167,4 +185,4 @@
hence they are available after pkg installation in the library as
RobAStRDA\AddMaterial\interpolation resp. Robextremes\AddMaterial\interpolation
-Comments & Suggestions are welcome.
\ No newline at end of file
+Comments & Suggestions are welcome.
Modified: pkg/RobAStRDA/inst/AddMaterial/interpolation/interpolationscripts.R
===================================================================
--- pkg/RobAStRDA/inst/AddMaterial/interpolation/interpolationscripts.R 2018-07-23 20:15:10 UTC (rev 1031)
+++ pkg/RobAStRDA/inst/AddMaterial/interpolation/interpolationscripts.R 2018-07-23 20:17:24 UTC (rev 1032)
@@ -13,7 +13,7 @@
#####
oldwd <- getwd()
-.basepath <- "C:/rtest/RobASt/branches/robast-1.0/pkg"
+.basepath <- "C:/rtest/RobASt/branches/robast-1.1/pkg"
.myFolderFrom <- file.path(.basepath,"RobExtremesBuffer")
myRDA0 <- file.path(.basepath,"RobExtremesBuffer/sysdata.rda")
#myRDA <- file.path(.basepath,"RobExtremesBuffer/sysdata.rda")
@@ -26,3 +26,114 @@
withPrint = TRUE, withSmooth = TRUE, df = NULL)
##
.computeInterpolators(myRDA0, myRDA,withSmoothFct = TRUE)
+###
+
+if(FALSE){
+#---------------------------------------------------------
+# (1) load package in R>3.0
+#---------------------------------------------------------
+ if(getRversion()>"3.0"){
+ require(RobAStRDA)
+ .basepath <- "C:/rtest/RobASt/branches/robast-1.1/pkg"
+ .myFolderFrom <- file.path(.basepath,"RobExtremesBuffer")
+ (myRDAg30 <- file.path(.basepath,"RobExtremesBuffer/sysdataOnlyGridsOnlyR-3.5.1rc.rda"))
+ (myRDAg3 <- file.path(.basepath,"RobExtremesBuffer/sysdataWithInterpOnlyR-3.5.1rc.rda"))
+ file.remove(myRDAg3)
+ file.remove(myRDAg30)
+ CSVFiles <- grep("\\.csv$", dir(.myFolderFrom), value=TRUE)
+ (CSVFiles <- paste(.myFolderFrom, CSVFiles, sep="/"))
+ RobAStRDA:::.saveGridToRda(CSVFiles, toFileRDA = myRDAg30, withMerge = FALSE,
+ withPrint = TRUE, withSmooth = TRUE, df = NULL)
+ RobAStRDA:::.computeInterpolators(myRDAg30, myRDAg3,withSmoothFct = TRUE)
+ ###
+ nEg3 <- new.env()
+ load(myRDAg3,env=nEg3)
+ nEg3L <- ls(all=TRUE,env=nEg3)
+ for(nam in nEg3L){
+ loc <- get(nam,env=nEg3)
+ namU <- names(loc)
+ for(nams in namU){
+ print(c(nam,nams,names(loc[[nams]])))
+ }
+ }
+ }
+#---------------------------------------------------------
+# (2) load package in R<2.15
+#---------------------------------------------------------
+ if(getRversion()<"2.16"){
+ require(RobAStRDA)
+ .basepath <- "C:/rtest/RobASt/branches/robast-1.1/pkg"
+ .myFolderFrom <- file.path(.basepath,"RobExtremesBuffer")
+ myRDAs30 <- file.path(.basepath,"RobExtremesBuffer/sysdataOnlyGridsOnlyR-2.15.1.rda")
+ myRDAs3 <- file.path(.basepath,"RobExtremesBuffer/sysdataWithInterpOnlyR-2.15.1.rda")
+ file.remove(myRDAs3)
+ file.remove(myRDAs30)
+ CSVFiles <- grep("\\.csv$", dir(.myFolderFrom), value=TRUE)
+ CSVFiles <- paste(.myFolderFrom, CSVFiles, sep="/")
+ RobAStRDA:::.saveGridToRda(CSVFiles, toFileRDA = myRDAs30, withMerge = FALSE,
+ withPrint = TRUE, withSmooth = TRUE, df = NULL)
+ RobAStRDA:::.computeInterpolators(myRDAs30, myRDAs3,withSmoothFct = TRUE)
+ ###
+ nEs3 <- new.env()
+ load(myRDAs3,env=nEs3)
+ nEs3L <- ls(all=TRUE,env=nEs3)
+ for(nam in nEs3L){
+ loc <- get(nam,env=nEs3)
+ namU <- names(loc)
+ for(nams in namU){
+ print(c(nam,nams,names(loc[[nams]])))
+ }
+ }
+ }
+#---------------------------------------------------------
+# (3) back in R>3.0 merge grids
+#---------------------------------------------------------
+ if(getRversion()>"3.0"){
+ myRDAs30 <- file.path(.basepath,"RobExtremesBuffer/sysdataOnlyGridsOnlyR-2.15.1.rda")
+ myRDAs3 <- file.path(.basepath,"RobExtremesBuffer/sysdataWithInterpOnlyR-2.15.1.rda")
+ nEs3 <- new.env()
+ mergeE <- new.env()
+ load(myRDAs3,env=nEs3)
+ (nEs3L <- ls(all=TRUE,env=nEs3))
+ names(get(".Gamma", env = nEs3)$MBRE)
+
+ for(nam in nEg3L){
+ loc <- get(nam,env=nEg3)
+ namU <- names(loc)
+ for(nams in namU){
+ print(c(nam,nams,names(loc[[nams]])))
+ loc[[nams]]$fun.O <- get(nam,env=nEs3)[[nams]][["fun.O"]]
+ }
+ assign(nam,loc,env=mergeE)
+ }
+ (mergeEL <- ls(all=TRUE,env=mergeE))
+
+ for(nam in mergeEL){
+ loc <- get(nam,env=mergeE)
+ namU <- names(loc)
+ for(nams in namU){
+ print(c(nam,nams,names(loc[[nams]])))
+ }
+ }
+ }
+#---------------------------------------------------------
+# (4) save merged files and zip them
+#---------------------------------------------------------
+ if(getRversion()>"3.0"){
+
+ myRDAmerge <- file.path(.basepath,"RobExtremesBuffer/sysdataWithInterpMerge.rda")
+ myRDAmergeZip <- file.path(.basepath,"RobExtremesBuffer/sysdataWithInterpMergeZip.rda")
+ myRDA <- file.path(.basepath,"RobAStRDA/R/sysdata.rda")
+
+
+ mergeEL <- ls(all=TRUE,env=mergeE)
+ save(list=mergeEL,envir=mergeE,file=myRDAmerge)
+ file.copy(from = myRDAmerge, to = myRDAmergeZip, overwrite = TRUE)
+ tools::resaveRdaFiles(myRDAmergeZip)
+ file.copy(from = myRDAmergeZip, to = myRDA, overwrite = TRUE)
+ }
+
+#---------------------------------------------------------
+# end of if(FALSE)
+#---------------------------------------------------------
+}
\ No newline at end of file
Deleted: pkg/RobAStRDA/inst/CITATION
===================================================================
--- pkg/RobAStRDA/inst/CITATION 2018-07-23 20:15:10 UTC (rev 1031)
+++ pkg/RobAStRDA/inst/CITATION 2018-07-23 20:17:24 UTC (rev 1032)
@@ -1,23 +0,0 @@
-if(!exists("meta") || is.null(meta)) meta <- packageDescription("RobAStRDA")
-year <- sub("-.*", "", meta$Date)
-note <- sprintf("R package version %s", meta$Version)
-
-citHeader("To cite package RobAStRDA in publications use:")
-
-citEntry(entry="Manual",
- title = "RobAStRDA: Interpolation Grids for Packages of the 'RobASt' - Family of Packages",
- author = personList(as.person("P. Ruckdeschel"),
- as.person("M. Kohl")),
- language = "English",
- year = year,
- note = paste("Contributions by", "S. Desmettre, G. Kroisandt, E. Massini, D. Pupashenko, M. Pupashenko, and B. Spangl; ",
- note),
- type = "R package",
- url = "http://robast.r-forge.r-project.org/",
- textVersion = paste("Ruckdeschel, P., Kohl, M.",
- sprintf("(%s).", year),
- "RobAStRDA: Interpolation Grids for Packages of the 'RobASt' - Family of Packages",
- paste("Contributions by",
- "S. Desmettre, G. Kroisandt, E. Massini, D. Pupashenko, M. Pupashenko, and B. Spangl;"),
- paste(note, ".", sep = ""),
- "URL http://robast.r-forge.r-project.org/"))
Copied: pkg/RobAStRDA/inst/CITATION (from rev 1031, branches/robast-1.1/pkg/RobAStRDA/inst/CITATION)
===================================================================
--- pkg/RobAStRDA/inst/CITATION (rev 0)
+++ pkg/RobAStRDA/inst/CITATION 2018-07-23 20:17:24 UTC (rev 1032)
@@ -0,0 +1,23 @@
+if(!exists("meta") || is.null(meta)) meta <- packageDescription("RobAStRDA")
+year <- sub("-.*", "", meta$Date)
+note <- sprintf("R package version %s", meta$Version)
+
+citHeader("To cite package RobAStRDA in publications use:")
+
+citEntry(entry="Manual",
+ title = "RobAStRDA: Interpolation Grids for Packages of the 'RobASt' - Family of Packages",
+ author = personList(as.person("P. Ruckdeschel"),
+ as.person("M. Kohl")),
+ language = "English",
+ year = year,
+ note = paste("Contributions by", "S. Desmettre, G. Kroisandt, E. Massini, D. Pupashenko, M. Pupashenko, and B. Spangl; ",
+ note),
+ type = "R package",
+ url = "http://robast.r-forge.r-project.org/",
+ textVersion = paste("Ruckdeschel, P., Kohl, M.",
+ sprintf("(%s).", year),
+ "RobAStRDA: Interpolation Grids for Packages of the 'RobASt' - Family of Packages",
+ paste("Contributions by",
+ "S. Desmettre, G. Kroisandt, E. Massini, D. Pupashenko, M. Pupashenko, and B. Spangl;"),
+ paste(note, ".", sep = ""),
+ "URL http://robast.r-forge.r-project.org/"))
Modified: pkg/RobAStRDA/inst/NEWS
===================================================================
--- pkg/RobAStRDA/inst/NEWS 2018-07-23 20:15:10 UTC (rev 1031)
+++ pkg/RobAStRDA/inst/NEWS 2018-07-23 20:17:24 UTC (rev 1032)
@@ -8,6 +8,16 @@
information)
#######################################
+version 1.1
+#######################################
+
+user-visible CHANGES:
++ DESCRIPTION tag SVNRevision changed to VCS/SVNRevision
+
+under the hood:
++ recreated RDA file as it was no longer loadable
+
+#######################################
version 1.0
#######################################
Modified: pkg/RobAStRDA/man/0RobRDA-package.Rd
===================================================================
--- pkg/RobAStRDA/man/0RobRDA-package.Rd 2018-07-23 20:15:10 UTC (rev 1031)
+++ pkg/RobAStRDA/man/0RobRDA-package.Rd 2018-07-23 20:17:24 UTC (rev 1032)
@@ -31,14 +31,14 @@
\details{
\tabular{ll}{
Package: \tab RobAStRDA \cr
-Version: \tab 1.0 \cr
-Date: \tab 2016-04-23 \cr
-Depends: \tab R (>= 2.14.0) \cr
+Version: \tab 1.1.0 \cr
+Date: \tab 2018-07-18 \cr
+Depends: \tab R (>= 3.3.0) \cr
LazyData: \tab yes \cr
ByteCompile: \tab yes \cr
License: \tab LGPL-3 \cr
URL: \tab http://robast.r-forge.r-project.org/\cr
-SVNRevision: \tab 869 \cr
+VCS/SVNRevision: \tab 940 \cr
}
}
More information about the Robast-commits
mailing list