[Robast-commits] r544 - in branches/robast-0.9/pkg/RobExtremes: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jan 19 00:58:15 CET 2013


Author: ruckdeschel
Date: 2013-01-19 00:58:15 +0100 (Sat, 19 Jan 2013)
New Revision: 544

Modified:
   branches/robast-0.9/pkg/RobExtremes/NAMESPACE
   branches/robast-0.9/pkg/RobExtremes/R/AllClass.R
   branches/robast-0.9/pkg/RobExtremes/R/Expectation.R
   branches/robast-0.9/pkg/RobExtremes/R/GEVFamily.R
   branches/robast-0.9/pkg/RobExtremes/R/LDEstimator.R
   branches/robast-0.9/pkg/RobExtremes/R/PickandsEstimator.R
   branches/robast-0.9/pkg/RobExtremes/R/QBCC.R
   branches/robast-0.9/pkg/RobExtremes/R/SnQn.R
   branches/robast-0.9/pkg/RobExtremes/R/WeibullFamily.R
   branches/robast-0.9/pkg/RobExtremes/R/interpolSn.R
   branches/robast-0.9/pkg/RobExtremes/man/E.Rd
   branches/robast-0.9/pkg/RobExtremes/man/LDEstimator.Rd
   branches/robast-0.9/pkg/RobExtremes/man/PickandsEstimator.Rd
   branches/robast-0.9/pkg/RobExtremes/man/asvarQBCC.Rd
   branches/robast-0.9/pkg/RobExtremes/man/internalldeHelpers.Rd
   branches/robast-0.9/pkg/RobExtremes/man/validParameter-methods.Rd
Log:
RobExtremes: some debugging; still code fails at examples

Modified: branches/robast-0.9/pkg/RobExtremes/NAMESPACE
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/NAMESPACE	2013-01-18 20:07:01 UTC (rev 543)
+++ branches/robast-0.9/pkg/RobExtremes/NAMESPACE	2013-01-18 23:58:15 UTC (rev 544)
@@ -12,7 +12,7 @@
 			  "LDEstimate")
 exportClasses("Gumbel", "Pareto", "GPareto", "GEV")
 exportClasses("GParetoFamily", "GumbelLocationFamily", "WeibullFamily")
-
+exportClasses("DistributionsIntegratingByQuantiles")
 exportMethods("initialize", "show") 
 exportMethods("loc", "loc<-", "kMAD", "Sn", "Qn")
 exportMethods("validParameter",
@@ -26,7 +26,7 @@
 
 export("EULERMASCHERONICONSTANT","APERYCONSTANT")
 export("Gumbel", "Pareto", "GPareto", "GEV")
-export("GParetoFamily", "GumbelLocationFamily", "WeibullFamily")
+export("GParetoFamily", "GumbelLocationFamily", "WeibullFamily", "GEVFamily")
 export("LDEstimator", "medkMAD", "medSn", "medQn", "medkMADhybr")
 export("getShapeGrid", "getSnGrid", 
        "PickandsEstimator","QuantileBCCEstimator")

Modified: branches/robast-0.9/pkg/RobExtremes/R/AllClass.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/AllClass.R	2013-01-18 20:07:01 UTC (rev 543)
+++ branches/robast-0.9/pkg/RobExtremes/R/AllClass.R	2013-01-18 23:58:15 UTC (rev 544)
@@ -233,7 +233,12 @@
 setClass("GumbelLocationFamily",
           contains = "L2LocationFamily")
 
-## Generalized Pareto 
+### for integration:
+setClassUnion("DistributionsIntegratingByQuantiles",
+               c("Weibull", "GEV", "GPareto", "Pareto"))
+
+
+## models:
 setClass("GParetoFamily", contains="L2ScaleShapeUnion")
 setClass("GEVFamily", contains="L2ScaleShapeUnion")
 setClass("WeibullFamily", contains="L2ScaleShapeUnion")

Modified: branches/robast-0.9/pkg/RobExtremes/R/Expectation.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/Expectation.R	2013-01-18 20:07:01 UTC (rev 543)
+++ branches/robast-0.9/pkg/RobExtremes/R/Expectation.R	2013-01-18 23:58:15 UTC (rev 544)
@@ -43,7 +43,7 @@
 
 ### source http://en.wikipedia.org/wiki/Pareto_distribution
 
-setMethod("E", signature(object = "GPareto",
+setMethod("E", signature(object = "DistributionsIntegratingByQuantiles",
                          fun = "function",
                          cond = "missing"),
     function(object, fun, low = NULL, upp = NULL,
@@ -59,47 +59,32 @@
         if(!is.null(dots$useApply)) useApply <- dots$useApply
         dots.withoutUseApply$useApply <- NULL
         integrand <- function(x, dfun, ...){   di <- dim(x)
-                                               y <- exp(x)
+                                               y <- q(object)(x)##quantile transformation
                                                if(useApply){
                                                     funy <- sapply(y,fun, ...)
                                                     dim(y) <- di
                                                     dim(funy) <- di
                                                }else funy <- fun(y,...)
-                                        return(funy * y * dfun(y)) }
+                                        return(funy) }
 
-        if(is.null(low)) low <- -Inf
-        if(is.null(upp)) upp <- Inf
+         if(is.null(low)) low <- -Inf
+         if(is.null(upp)) upp <- Inf
 
-        Ib <- .getIntbounds(object, low, upp, lowerTruncQuantile,
-              upperTruncQuantile, IQR.fac)
-        low <- if(Ib["low"]<=0) -Inf else log(Ib["low"])
-        upp <- log(Ib["upp"])
-
+         Ib <- .getIntbounds(object, low, upp, lowerTruncQuantile,
+               upperTruncQuantile, IQR.fac)
+         low <- p(object)(Ib["low"])
+         upp <- p(object)(Ib["upp"])
+         if(is.nan(low)) low <- 0
+         if(is.nan(upp)) upp <- 1
         return(do.call(distrExIntegrate, c(list(f = integrand,
                     lower = low,
                     upper = upp,
                     rel.tol = rel.tol,
-                    distr = object, dfun = d(object)), dots.withoutUseApply)))
+                    distr = object, dfun = dunif), dots.withoutUseApply)))
 
     })
 
-
-setMethod("E", signature(object = "GEV", 
-                         fun = "missing", 
-                         cond = "missing"),
-    function(object, low = NULL, upp = NULL, ...){
-    if(!is.null(low)) if(low <= Min(object)) low <- NULL
-    xi <- shape(object); sigma <- scale(object); mu <- loc(object)
-    if(is.null(low) && is.null(upp)){
-        if (xi==0) return(mu+sigma*EULERMASCHERONICONSTANT)
-        else if(xi>=1) return(Inf)
-        else return(mu+sigma*(gamma(1-xi)-1)/xi)
-        }       
-    else
-        return(E(as(object,"AbscontDistribution"), low=low, upp=upp, ...))    
-    })
-
-setMethod("E", signature(object = "GEV",
+setMethod("E", signature(object = "GPareto",
                          fun = "function",
                          cond = "missing"),
     function(object, fun, low = NULL, upp = NULL,
@@ -115,30 +100,53 @@
         if(!is.null(dots$useApply)) useApply <- dots$useApply
         dots.withoutUseApply$useApply <- NULL
         integrand <- function(x, dfun, ...){   di <- dim(x)
-                                               y <- q(object)(x)##quantile transformation
+                                               y <- exp(x)
                                                if(useApply){
                                                     funy <- sapply(y,fun, ...)
                                                     dim(y) <- di
                                                     dim(funy) <- di
                                                }else funy <- fun(y,...)
-                                        return(funy) }
+                                        return(funy * y * dfun(y)) }
 
-         if(is.null(low)) low <- -Inf
-         if(is.null(upp)) upp <- Inf
- 
-         Ib <- .getIntbounds(object, low, upp, lowerTruncQuantile,
-               upperTruncQuantile, IQR.fac)
-         low <- p(object)(Ib["low"])
-         upp <- p(object)(Ib["upp"])
-         if(is.nan(low)) low <- 0
-         if(is.nan(upp)) upp <- 1
+        if(is.null(low)) low <- -Inf
+        if(is.null(upp)) upp <- Inf
+
+        Ib <- .getIntbounds(object, low, upp, lowerTruncQuantile,
+              upperTruncQuantile, IQR.fac)
+        low <- if(Ib["low"]<=0) -Inf else log(Ib["low"])
+        upp <- log(Ib["upp"])
+
         return(do.call(distrExIntegrate, c(list(f = integrand,
                     lower = low,
                     upper = upp,
                     rel.tol = rel.tol,
-                    distr = object, dfun = dunif), dots.withoutUseApply)))
+                    distr = object, dfun = d(object)), dots.withoutUseApply)))
 
     })
 
 
+setMethod("E", signature(object = "GEV",
+                         fun = "missing", 
+                         cond = "missing"),
+    function(object, low = NULL, upp = NULL, ...){
+    if(!is.null(low)) if(low <= Min(object)) low <- NULL
+    xi <- shape(object); sigma <- scale(object); mu <- loc(object)
+    if(is.null(low) && is.null(upp)){
+        if (xi==0) return(mu+sigma*EULERMASCHERONICONSTANT)
+        else if(xi>=1) return(Inf)
+        else return(mu+sigma*(gamma(1-xi)-1)/xi)
+        }       
+    else
+        return(E(as(object,"AbscontDistribution"), low=low, upp=upp, ...))    
+    })
 
+setMethod("E", signature(object = "GEV", fun = "function", cond = "missing"),
+           getMethod("E",
+           signature(object = "DistributionsIntegratingByQuantiles",
+                     fun = "function", cond = "missing")))
+
+setMethod("E", signature(object = "Weibull", fun = "function", cond = "missing"),
+           getMethod("E",
+           signature(object = "DistributionsIntegratingByQuantiles",
+                     fun = "function", cond = "missing")))
+

Modified: branches/robast-0.9/pkg/RobExtremes/R/GEVFamily.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/GEVFamily.R	2013-01-18 20:07:01 UTC (rev 543)
+++ branches/robast-0.9/pkg/RobExtremes/R/GEVFamily.R	2013-01-18 23:58:15 UTC (rev 544)
@@ -67,6 +67,7 @@
 
     ## parameters
     names(theta) <- c("loc", "scale", "shape")
+    scaleshapename <- c("scale", "shape")
 
 
     if(!is.null(p)){
@@ -94,7 +95,7 @@
                             D1 <- (g0*pg/(1-p0)-1)/theta[2]
                             D21 <- theta[1]*D1/theta[2]
                             D22 <- theta[1]*dd/(1-p0)/theta[2]
-                            D2 <- -D21+D22)}
+                            D2 <- -D21+D22}
                             D <- t(c(D1, D2))
                             rownames(D) <- "expected shortfall"
                             colnames(D) <- NULL
@@ -255,7 +256,7 @@
 
         Lambda1 <- function(x) {
          y <- x*0
-         ind <- (x > mu-sc/k) # = [later] (x1>0)
+         ind <- (x > tr-sc/k) # = [later] (x1>0)
          x <- (x[ind]-tr)/sc
          x1 <- 1 + k * x
          y[ind] <- (x*(1-x1^(-1/k))-1)/x1/sc

Modified: branches/robast-0.9/pkg/RobExtremes/R/LDEstimator.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/LDEstimator.R	2013-01-18 20:07:01 UTC (rev 543)
+++ branches/robast-0.9/pkg/RobExtremes/R/LDEstimator.R	2013-01-18 23:58:15 UTC (rev 544)
@@ -82,6 +82,7 @@
          return(LDMval[1:2])
     }
 
+    asvar.fct0 <- asvar.fct
     asvar.0 <- asvar
     nuis.idx.0 <- nuis.idx
     trafo.0 <- trafo
@@ -96,7 +97,9 @@
     estimate <- Estimator(x, estimator, name, Infos,
                       asvar = asvar.0, nuis.idx = nuis.idx.0,
                       trafo = trafo.0, fixed = fixed.0,
-                      na.rm = na.rm.0, ...)
+                      asvar.fct = asvar.fct0,
+                      na.rm = na.rm.0, ...,
+                      ParamFamily = ParamFamily)
 
     print(estimate)
     #print(estimate at untransformed.estimate)
@@ -104,6 +107,8 @@
     cat("\n asvar",estimate at asvar,"\n")
 
 
+##->
+if(FALSE){
     if(missing(asvar)) asvar <- NULL
 
     if((is.null(asvar))&&(!missing(asvar.fct))&&(!is.null(asvar.fct)))
@@ -128,7 +133,8 @@
     }
 
      print(estimate at asvar)
-
+}
+##<-
     estimate at estimate.call <- es.call
 
     if(missing(Infos))

Modified: branches/robast-0.9/pkg/RobExtremes/R/PickandsEstimator.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/PickandsEstimator.R	2013-01-18 20:07:01 UTC (rev 543)
+++ branches/robast-0.9/pkg/RobExtremes/R/PickandsEstimator.R	2013-01-18 23:58:15 UTC (rev 544)
@@ -40,6 +40,7 @@
                         name, Infos, nuis.idx = NULL,
                         trafo = NULL, fixed = NULL,  na.rm = TRUE,
                         ...){
+    force(ParamFamily)
     isGP <- is(ParamFamily,"GParetoFamily")
     if(!(isGP|is(ParamFamily,"GEVFamily")))
          stop("Pickands estimator only available for GPD and GEVD.")
@@ -51,8 +52,7 @@
     if(missing(name))
         name <- "PickandsEstimator"
 
-
-    asvar.fct.0 <- function(L2Fam=ParamFamily, param){
+    asvar.fct.0 <- function(L2Fam, param){
                        asvarPickands(model=L2Fam, alpha = alpha)}
     nuis.idx.0 <- nuis.idx
     trafo.0 <- trafo
@@ -61,9 +61,10 @@
 
     .mPick <- function(x) .PickandsEstimator(x,alpha=alpha, GPD.l=isGP)
     estimate <- Estimator(x, .mPick, name, Infos,
-                          asvar.fct = asvar.fct0 asvar = asvar,
+                          asvar.fct = asvar.fct.0, asvar = NULL,
                           nuis.idx = nuis.idx.0, trafo = trafo.0,
-                          fixed = fixed.0, na.rm = na.rm.0, ...)
+                          fixed = fixed.0, na.rm = na.rm.0, ...,
+                          ParamFamily = ParamFamily)
 ##->
 if(FALSE){
     estimate at untransformed.asvar <- asvar(estimate)

Modified: branches/robast-0.9/pkg/RobExtremes/R/QBCC.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/QBCC.R	2013-01-18 20:07:01 UTC (rev 543)
+++ branches/robast-0.9/pkg/RobExtremes/R/QBCC.R	2013-01-18 23:58:15 UTC (rev 544)
@@ -20,12 +20,10 @@
  return(theta)
 }
 
-QuantileBCCEstimator <- function(x, p1=1/3, p2=2/3, ParamFamily=WeibullFamily(),
+QuantileBCCEstimator <- function(x, p1=1/3, p2=2/3,
                         name, Infos, nuis.idx = NULL,
                         trafo = NULL, fixed = NULL,  na.rm = TRUE,
                         ...){
-    if(!(is(ParamFamily,"WeibullFamily")))
-         stop("Pickands estimator only available for Weibull")
     es.call <- match.call()
     if(length(p1)>1 || any(!is.finite(p1)) || p1<=0 || p1>=1)
        stop("'p1' has to be in [0,1] and of length 1.")
@@ -35,7 +33,7 @@
     if(missing(name))
         name <- "QuantileBCCEstimator"
 
-
+    ParamFamily <- WeibullFamily()
     asvar.fct.0 <- function(L2Fam=ParamFamily, param){
                        asvarQBCC(model=L2Fam, p1 = p1, p2 = p2)}
     nuis.idx.0 <- nuis.idx
@@ -45,9 +43,10 @@
 
     .mQBCC <- function(x) .QBCC(x,p1=p1,p2=p2)
     estimate <- Estimator(x, .mQBCC, name, Infos,
-                          asvar.fct = asvar.fct0 asvar = asvar,
+                          asvar.fct = asvar.fct.0, asvar = NULL,
                           nuis.idx = nuis.idx.0, trafo = trafo.0,
-                          fixed = fixed.0, na.rm = na.rm.0, ...)
+                          fixed = fixed.0, na.rm = na.rm.0, ...,
+                          ParamFamily = ParamFamily)
     estimate at estimate.call <- es.call
 
     if(missing(Infos))

Modified: branches/robast-0.9/pkg/RobExtremes/R/SnQn.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/SnQn.R	2013-01-18 20:07:01 UTC (rev 543)
+++ branches/robast-0.9/pkg/RobExtremes/R/SnQn.R	2013-01-18 23:58:15 UTC (rev 544)
@@ -4,7 +4,7 @@
         constant <- ifelse(hasArg(constant), dots$"constant", 2.21914)
         finite.corr <- ifelse(hasArg(finite.corr), dots$"finite.corr",
                               !hasArg(constant))
-        if(hasArg(na.rm)) if(dots$"na.rm") x <- x[!is.na(x)]
+        if(!is.null(dots$"na.rm")) if(dots$"na.rm") x <- x[!is.na(x)]
         robustbase::Qn(x, constant=constant, finite.corr=finite.corr)
     })
 
@@ -14,7 +14,7 @@
         constant <- ifelse(hasArg(constant), dots$"constant", 1.1926)
         finite.corr <- ifelse(hasArg(finite.corr), dots$"finite.corr",
                               !hasArg(constant))
-        if(hasArg(na.rm)) if(dots$"na.rm") x <- x[!is.na(x)]
+        if(!is.null(dots$"na.rm")) if(dots$"na.rm") x <- x[!is.na(x)]
         robustbase::Sn(x, constant=constant, finite.corr=finite.corr)
     })
 
@@ -108,7 +108,7 @@
     function(x, ...){
            if(abs(scale(x)-1)< 1e-12){
 #              sng <- .SnGrids
-              sng <- getFromNamespace(".SnGrids", ns = "RobExtremes")
+              sng <- getFromNamespace(.versionSuff(".SnGrids"), ns = "RobExtremes")
               snf <- sng[["Generalized Pareto Family"]][["fct"]]
               ret <- snf(shape(x))
            }else ret <- scale(x)*Sn(x=x/scale(x))

Modified: branches/robast-0.9/pkg/RobExtremes/R/WeibullFamily.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/WeibullFamily.R	2013-01-18 20:07:01 UTC (rev 543)
+++ branches/robast-0.9/pkg/RobExtremes/R/WeibullFamily.R	2013-01-18 23:58:15 UTC (rev 544)
@@ -73,6 +73,7 @@
 
     ## parameters
     names(theta) <- c("scale", "shape")
+    scaleshapename <- c("scale", "shape")
 
     if(!is.null(p)){
        btq <- substitute({ q <- theta[1]*(-log(1-p0))^(1/theta[2])

Modified: branches/robast-0.9/pkg/RobExtremes/R/interpolSn.R
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/R/interpolSn.R	2013-01-18 20:07:01 UTC (rev 543)
+++ branches/robast-0.9/pkg/RobExtremes/R/interpolSn.R	2013-01-18 23:58:15 UTC (rev 544)
@@ -1,5 +1,4 @@
-.versionSuff <- RobAStBase:::.versionSuff
-
+.versionSuff <- ROptEst:::.versionSuff
 getShapeGrid <- function(gridsize=1000,centralvalue=0.7,
                          withPos=TRUE, cutoff.at.0=1e-4, fac = 2){
 

Modified: branches/robast-0.9/pkg/RobExtremes/man/E.Rd
===================================================================
--- branches/robast-0.9/pkg/RobExtremes/man/E.Rd	2013-01-18 20:07:01 UTC (rev 543)
+++ branches/robast-0.9/pkg/RobExtremes/man/E.Rd	2013-01-18 23:58:15 UTC (rev 544)
@@ -1,66 +1,15 @@
 \name{E}
 \alias{E}
+\alias{DistributionsIntegratingByQuantiles-class}
 \alias{E-methods}
-\alias{E,UnivariateDistribution,missing,missing-method}
-\alias{E,AbscontDistribution,missing,missing-method}
-\alias{E,DiscreteDistribution,missing,missing-method}
-\alias{E,LatticeDistribution,missing,missing-method}
-\alias{E,AffLinDistribution,missing,missing-method}
-\alias{E,AffLinAbscontDistribution,missing,missing-method}
-\alias{E,AffLinDiscreteDistribution,missing,missing-method}
-\alias{E,AffLinLatticeDistribution,missing,missing-method}
-\alias{E,MultivariateDistribution,missing,missing-method}
-\alias{E,DiscreteMVDistribution,missing,missing-method}
-\alias{E,UnivarLebDecDistribution,missing,missing-method}
-\alias{E,AffLinUnivarLebDecDistribution,missing,missing-method}
-\alias{E,UnivarMixingDistribution,missing,missing-method}
-\alias{E,UnivariateDistribution,function,missing-method}
-\alias{E,AbscontDistribution,function,missing-method}
-\alias{E,DiscreteDistribution,function,missing-method}
-\alias{E,LatticeDistribution,function,missing-method}
-\alias{E,MultivariateDistribution,function,missing-method}
-\alias{E,DiscreteMVDistribution,function,missing-method}
-\alias{E,UnivarLebDecDistribution,function,missing-method}
-\alias{E,UnivarMixingDistribution,function,missing-method}
-\alias{E,AcDcLcDistribution,ANY,ANY-method}
-\alias{E,CompoundDistribution,missing,missing-method}
-\alias{E,UnivariateCondDistribution,missing,numeric-method}
-\alias{E,AbscontCondDistribution,missing,numeric-method}
-\alias{E,DiscreteCondDistribution,missing,numeric-method}
-\alias{E,UnivarLebDecDistribution,missing,ANY-method}
-\alias{E,UnivarMixingDistribution,missing,ANY-method}
-\alias{E,UnivarLebDecDistribution,function,ANY-method}
-\alias{E,UnivariateCondDistribution,function,numeric-method}
-\alias{E,UnivarMixingDistribution,function,ANY-method}
-\alias{E,AbscontCondDistribution,function,numeric-method}
-\alias{E,DiscreteCondDistribution,function,numeric-method}
-\alias{E,Arcsine,missing,missing-method}
-\alias{E,Beta,missing,missing-method}
-\alias{E,Binom,missing,missing-method}
-\alias{E,Cauchy,missing,missing-method}
-\alias{E,Chisq,missing,missing-method}
-\alias{E,Dirac,missing,missing-method}
-\alias{E,DExp,missing,missing-method}
-\alias{E,Exp,missing,missing-method}
-\alias{E,Fd,missing,missing-method}
-\alias{E,Gammad,missing,missing-method}
-\alias{E,Gammad,function,missing-method}
-\alias{E,Geom,missing,missing-method}
+\alias{E,DistributionsIntegratingByQuantiles,function,missing-method}
 \alias{E,Gumbel,missing,missing-method}
 \alias{E,GPareto,missing,missing-method}
 \alias{E,GPareto,function,missing-method}
-\alias{E,GEV,missing,missing-method}
 \alias{E,GEV,function,missing-method}
-\alias{E,Hyper,missing,missing-method}
-\alias{E,Logis,missing,missing-method}
-\alias{E,Lnorm,missing,missing-method}
-\alias{E,Nbinom,missing,missing-method}
-\alias{E,Norm,missing,missing-method}
+\alias{E,Weibull,function,missing-method}
+\alias{E,GEV,missing,missing-method}
 \alias{E,Pareto,missing,missing-method}
-\alias{E,Pois,missing,missing-method}
-\alias{E,Td,missing,missing-method}
-\alias{E,Unif,missing,missing-method}
-\alias{E,Weibull,missing,missing-method}
 
 \title{Generic Function for the Computation of (Conditional) Expectations}
 \description{
@@ -69,152 +18,21 @@
 \usage{
 E(object, fun, cond, ...)
 
-\S4method{E}{UnivariateDistribution,missing,missing}(object, 
-             low = NULL, upp = NULL, Nsim = getdistrExOption("MCIterations"), ...)
-
-\S4method{E}{UnivariateDistribution,function,missing}(object, fun, 
-        useApply = TRUE, low = NULL, upp = NULL,  Nsim = getdistrExOption("MCIterations"), ...)
-
-\S4method{E}{AbscontDistribution,function,missing}(object, fun, useApply = TRUE,
-             low = NULL, upp = NULL, 
-             rel.tol= getdistrExOption("ErelativeTolerance"), 
-             lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), 
-             upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-             IQR.fac = getdistrExOption("IQR.fac"), ...)
-
-\S4method{E}{UnivarMixingDistribution,missing,missing}(object, low = NULL, 
-             upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), 
-             lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), 
-             upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-             IQR.fac = getdistrExOption("IQR.fac"), ...)
-
-\S4method{E}{UnivarMixingDistribution,function,missing}(object, fun, useApply = TRUE, 
-             low = NULL, upp = NULL, 
-             rel.tol= getdistrExOption("ErelativeTolerance"), 
-             lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), 
-             upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-             IQR.fac = getdistrExOption("IQR.fac"), ...)
-
-\S4method{E}{UnivarMixingDistribution,missing,ANY}(object, cond, low = NULL, 
-             upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), 
-             lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), 
-             upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-             IQR.fac = getdistrExOption("IQR.fac"), ...)
-
-\S4method{E}{UnivarMixingDistribution,function,ANY}(object, fun, cond, useApply = TRUE,
-             low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), 
-             lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), 
-             upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-             IQR.fac = getdistrExOption("IQR.fac"), ...)
-
-\S4method{E}{DiscreteDistribution,function,missing}(object, fun, useApply = TRUE, 
-             low = NULL, upp = NULL, ...)
-
-\S4method{E}{AffLinDistribution,missing,missing}(object, low = NULL, upp = NULL, ...)
-
-\S4method{E}{AffLinUnivarLebDecDistribution,missing,missing}(object, low = NULL, upp = NULL, ...)
-
-\S4method{E}{MultivariateDistribution,missing,missing}(object, 
-             Nsim = getdistrExOption("MCIterations"), ...)
-\S4method{E}{MultivariateDistribution,function,missing}(object, fun, useApply = TRUE, 
-             Nsim = getdistrExOption("MCIterations"), ...)
-
-\S4method{E}{DiscreteMVDistribution,missing,missing}(object, low = NULL, upp = NULL, ...)
-
-\S4method{E}{DiscreteMVDistribution,function,missing}(object, fun, 
-             useApply = TRUE, ...)
-
-\S4method{E}{AbscontCondDistribution,missing,numeric}(object, cond, useApply = TRUE,
-             low = NULL, upp = NULL, 
-             rel.tol= getdistrExOption("ErelativeTolerance"), 
-             lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), 
-             upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-             IQR.fac = getdistrExOption("IQR.fac"), ...)
-
-\S4method{E}{DiscreteCondDistribution,missing,numeric}(object, cond, useApply = TRUE,
-             low = NULL, upp = NULL, ...)
-
-\S4method{E}{UnivariateCondDistribution,function,numeric}(object, fun, cond, 
-              withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL,
-              Nsim = getdistrExOption("MCIterations"), ...)
-
-\S4method{E}{AbscontCondDistribution,function,numeric}(object, fun, cond, 
-               withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL,
-             rel.tol= getdistrExOption("ErelativeTolerance"), 
-             lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), 
-             upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-             IQR.fac = getdistrExOption("IQR.fac")
-             , ...)
-
-\S4method{E}{DiscreteCondDistribution,function,numeric}(object, fun, cond, 
-             withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL,...)
-
-\S4method{E}{DiscreteCondDistribution,function,numeric}(object, fun, cond, 
-             withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL,...)
-             
-\S4method{E}{UnivarLebDecDistribution,missing,missing}(object, low = NULL, upp = NULL,  
-             rel.tol= getdistrExOption("ErelativeTolerance"), 
-             lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), 
-             upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-             IQR.fac = getdistrExOption("IQR.fac"), ... )
-\S4method{E}{UnivarLebDecDistribution,function,missing}(object, fun, 
-             useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), 
-             lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), 
-             upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-             IQR.fac = getdistrExOption("IQR.fac"), ... )
-\S4method{E}{UnivarLebDecDistribution,missing,ANY}(object, cond, 
-             low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), 
-             lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), 
-             upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-             IQR.fac = getdistrExOption("IQR.fac"), ... )
-\S4method{E}{UnivarLebDecDistribution,function,ANY}(object, fun, cond, 
-             useApply = TRUE, low = NULL, upp = NULL,
-             rel.tol= getdistrExOption("ErelativeTolerance"), 
-             lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), 
-             upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-             IQR.fac = getdistrExOption("IQR.fac"), ... )
-
-\S4method{E}{AcDcLcDistribution,ANY,ANY}(object, fun, cond, 
-             low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), 
-             lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), 
-             upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-             IQR.fac = getdistrExOption("IQR.fac"), ... )
-\S4method{E}{CompoundDistribution,missing,missing}(object, low = NULL, upp = NULL, ...)
-
-\S4method{E}{Arcsine,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Beta,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Binom,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Cauchy,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Chisq,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Dirac,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{DExp,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Exp,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Fd,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Gammad,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Gammad,function,missing}(object, fun, low = NULL, upp = NULL, 
-                                      rel.tol = getdistrExOption("ErelativeTolerance"),
-                                      lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"),
-                                      upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-                                      IQR.fac = getdistrExOption("IQR.fac"), ...)
-\S4method{E}{Geom,missing,missing}(object, low = NULL, upp = NULL, ...)
+\S4method{E}{GEV,missing,missing}(object, low = NULL, upp = NULL, ...)
+\S4method{E}{DistributionsIntegratingByQuantiles,function,missing}(object,
+         fun, low = NULL, upp = NULL,
+         rel.tol= getdistrExOption("ErelativeTolerance"),
+         lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"),
+         upperTruncQuantile = getdistrExOption("EupperTruncQuantile"),
+         IQR.fac = max(1e4,getdistrExOption("IQR.fac")), ...)
 \S4method{E}{Gumbel,missing,missing}(object, low = NULL, upp = NULL, ...)
 \S4method{E}{GPareto,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{GPareto,function,missing}(object, fun, low = NULL, upp = NULL, 
-                                      rel.tol = getdistrExOption("ErelativeTolerance"),
-                                      lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"),
-                                      upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), 
-                                      IQR.fac = max(10000, getdistrExOption("IQR.fac")), ...)
-\S4method{E}{Hyper,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Logis,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Lnorm,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Nbinom,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Norm,missing,missing}(object, low = NULL, upp = NULL, ...)
+\S4method{E}{GPareto,function,missing}(object, fun, low = NULL, upp = NULL,
+             rel.tol= getdistrExOption("ErelativeTolerance"),
+             lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"),
+             upperTruncQuantile = getdistrExOption("EupperTruncQuantile"),
+             IQR.fac = max(1e4,getdistrExOption("IQR.fac")), ...)
 \S4method{E}{Pareto,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Pois,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Unif,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Td,missing,missing}(object, low = NULL, upp = NULL, ...)
-\S4method{E}{Weibull,missing,missing}(object, low = NULL, upp = NULL, ...)
-
 }
 \arguments{
   \item{object}{ object of class \code{"Distribution"}}
@@ -222,8 +40,7 @@
     else the (conditional) expection of \code{fun} is computed. }
   \item{cond}{ if not missing the conditional expectation 
     given \code{cond} is computed. }
-  \item{Nsim}{ number of MC simulations used to determine the expectation. }
-  \item{rel.tol}{relative tolerance for \code{distrExIntegrate}.} 
+  \item{rel.tol}{relative tolerance for \code{distrExIntegrate}.}
   \item{low}{lower bound of integration range.}
   \item{upp}{upper bound of integration range.}
   \item{lowerTruncQuantile}{lower quantile for quantile based integration range.}
@@ -231,258 +48,55 @@
   \item{IQR.fac}{factor for scale based integration range (i.e.; 
   median of the distribution \eqn{\pm}{+-}\code{IQR.fac}\eqn{\times}{*}IQR).}
   \item{\dots}{ additional arguments to \code{fun} }
-  \item{useApply}{ logical: should \code{sapply}, respectively \code{apply} 
-    be used to evaluate \code{fun}. }
-  \item{withCond}{ logical: is \code{cond} in the argument list of \code{fun}. }
 }
 \details{The precision of the computations can be controlled via 
   certain global options; cf. \code{\link{distrExOptions}}. 
-    Also note that arguments \code{low} and \code{upp} should be given as
+  Also note that arguments \code{low} and \code{upp} should be given as
   named arguments in order to prevent them to be matched by arguments
   \code{fun} or \code{cond}. Also the result, when arguments 
   \code{low} or \code{upp} is given, is the \emph{unconditional value} of the
   expectation; no conditioning with respect to \code{low <= object <= upp}
-  is done.}
+  is done. To be able to use integration after transformation via the
+  respective probability transformation to [0,1], we introduce a class union
+  \code{"DistributionsIntegratingByQuantiles"}, which currently comprises
+  classes \code{"GPareto"}, \code{"Pareto"}, \code{"Weibull"}, \code{"GEV"}.
+  In addition, the specific method for \code{"GPareto", "function", "missing"}
+  uses integration on [0,1] via the substitution method (y := log(x)).
+  }
 
 \value{
-  The (conditional) expectation is computed.
+  The expectation is computed.
 }
 \section{Methods}{
 \describe{
-  \item{object = "UnivariateDistribution", fun = "missing", cond = "missing":}{ 
-    expectation of univariate distributions using crude Monte-Carlo integration. }
-
-  \item{object = "AbscontDistribution", fun = "missing", cond = "missing":}{ 
-    expectation of absolutely continuous univariate distributions
-    using \code{distrExIntegrate}. }
-
-  \item{object = "DiscreteDistribution", fun = "missing", cond = "missing":}{  
-    expectation of discrete univariate distributions using \code{support}
-    and \code{sum}.}
-
-  \item{object = "MultivariateDistribution", fun = "missing", cond = "missing":}{
-    expectation of multivariate distributions using crude Monte-Carlo integration. }
-
-  \item{object = "DiscreteMVDistribution", fun = "missing", cond = "missing":}{
-    expectation of discrete multivariate distributions. The computation is based
-    on \code{support} and \code{sum}.}
-
-  \item{object = "UnivariateDistribution", fun = "missing", cond = "missing":}{ 
-    expectation of univariate Lebesgue decomposed distributions
-    by separate calculations for discrete and absolutely continuous part. }
-
-  \item{object = "AffLinDistribution", fun = "missing", cond = "missing":}{
[TRUNCATED]

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


More information about the Robast-commits mailing list