[Distr-commits] r956 - in branches/distr-2.6/pkg/distrMod: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 10 17:53:07 CEST 2014


Author: ruckdeschel
Date: 2014-08-10 17:53:07 +0200 (Sun, 10 Aug 2014)
New Revision: 956

Modified:
   branches/distr-2.6/pkg/distrMod/R/returnlevelplot.R
   branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd
Log:
[distrMod] returnlevelplot now also got a debug argument; and there is a method for y of class "Estimate"

Modified: branches/distr-2.6/pkg/distrMod/R/returnlevelplot.R
===================================================================
--- branches/distr-2.6/pkg/distrMod/R/returnlevelplot.R	2014-08-10 15:35:37 UTC (rev 955)
+++ branches/distr-2.6/pkg/distrMod/R/returnlevelplot.R	2014-08-10 15:53:07 UTC (rev 956)
@@ -63,7 +63,8 @@
              legend.cex = 0.8,     ## magnification factor for the legend
              legend.pref = "",     ## prefix for legend  text
              legend.postf = "",    ## postfix for legend text
-             legend.alpha = alpha.CI ## nominal level of CI
+             legend.alpha = alpha.CI, ## nominal level of CI
+             debug = FALSE ## shall additional debug output be printed out?
     ){ ## return value as in stats::qqplot
 
     MaxOrPOT <- match.arg(MaxOrPOT)
@@ -78,6 +79,7 @@
     mcl$withSweave <- NULL
     mcl$mfColRow <- NULL
     mcl$type <-NULL
+    mcl$debug <- NULL
     force(x)
 
 
@@ -227,7 +229,7 @@
           }
 
         qqb <- qqbounds(sort(unique(xy)),y,alpha.CI,n,withConf.pw, withConf.sim,
-                           exact.sCI,exact.pCI,nosym.pCI)
+                           exact.sCI,exact.pCI,nosym.pCI, debug = debug)
         qqb$crit <- p2rl(qqb$crit)
         if(plot.it){
           qqb <- .confqq(xy, y, datax, withConf.pw, withConf.sim, alpha.CI,
@@ -238,7 +240,7 @@
                   legend.bg = legend.bg, legend.pos = legend.pos,
                   legend.cex = legend.cex, legend.pref = legend.pref,
                   legend.postf = legend.postf, legend.alpha = legend.alpha,
-                  qqb0=qqb)
+                  qqb0=qqb, debug = debug)
        }
     }}
     return(c(ret,qqb))
@@ -265,3 +267,31 @@
             args=mcl))
     })
 
+setMethod("returnlevelplot", signature(x = "ANY",
+                              y = "Estimate"), function(x, y,
+                              n = length(x), withIdLine = TRUE, withConf = TRUE,
+    withConf.pw  = withConf,  withConf.sim = withConf,
+    plot.it = TRUE, xlab = deparse(substitute(x)),
+    ylab = deparse(substitute(y)), ...){
+
+    mc <- match.call(call = sys.call(sys.parent(1)))
+    if(missing(xlab)) mc$xlab <- as.character(deparse(mc$x))
+    if(missing(ylab)) mc$ylab <- as.character(deparse(mc$y))
+    mcl <- as.list(mc)[-1]
+
+    param <- ParamFamParameter(main=untransformed.estimate(y), nuisance=nuisance(y),
+                               fixed=fixed(y))
+
+    es.call <- y at estimate.call
+    nm.call <- names(es.call)
+    PFam <- NULL
+    if("ParamFamily" %in% nm.call)
+       PFam <- eval(as.list(es.call)[["ParamFamily"]])
+    if(is.null(PFam))
+       stop("There is no object of class 'ProbFamily' in the call of 'x'")
+
+    PFam0 <- modifyModel(PFam, param)
+    mcl$y <- PFam0
+    return(do.call(getMethod("returnlevelplot", signature(x="ANY", y="ProbFamily")),
+            args=mcl))
+    })

Modified: branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd
===================================================================
--- branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd	2014-08-10 15:35:37 UTC (rev 955)
+++ branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd	2014-08-10 15:53:07 UTC (rev 956)
@@ -25,17 +25,25 @@
     check.NotInSupport = TRUE, col.NotInSupport = "red",
     with.legend = TRUE, legend.bg = "white",
     legend.pos = "topleft", legend.cex = 0.8,
-    legend.pref = "", legend.postf = "",  legend.alpha = alpha.CI)
+    legend.pref = "", legend.postf = "",  legend.alpha = alpha.CI,
+    debug = FALSE)
 \S4method{returnlevelplot}{ANY,ProbFamily}(x, y,
    n = length(x), withIdLine = TRUE, withConf = TRUE,
    withConf.pw  = withConf,  withConf.sim = withConf,
     plot.it = TRUE, xlab = deparse(substitute(x)),
     ylab = deparse(substitute(y)), ...)
+\S4method{returnlevelplot}{ANY,Estimate}(x, y,
+   n = length(x), withIdLine = TRUE, withConf = TRUE,
+   withConf.pw  = withConf,  withConf.sim = withConf,
+    plot.it = TRUE, xlab = deparse(substitute(x)),
+    ylab = deparse(substitute(y)), ...)
+
 }
 \alias{returnlevelplot}
 \alias{returnlevelplot-methods}
 \alias{returnlevelplot,ANY,ProbFamily-method}
 \alias{returnlevelplot,ANY,UnivariateDistribution-method}
+\alias{returnlevelplot,ANY,Estimate-method}
 
 \arguments{
 \item{x}{data to be checked for compatibility with distribution/model \code{y}.}
@@ -118,11 +126,12 @@
 \item{legend.pref}{character to be prepended to legend text}
 \item{legend.postf}{character to be appended to legend text}
 \item{legend.alpha}{nominal coverage probability}
+\item{debug}{logical; if \code{TRUE} additional output to debug confidence bounds.}
 }
 \description{
   We generalize the return level plot (which is one of the diagnostical
   plots provided package \pkg{ismev}, e.g., in function
-  \code{\link[ismev:gev.diag]{gev.diag}})  to
+  \code{\link[ismev:gev.diag]{gev.diag}}), see also Coles' book below,  to
   be applicable to distribution and probability model objects. In this context,
   \code{returnlevelplot} produces a QQ plot of data (argument \code{x}) against
    a (model) distribution.
@@ -143,21 +152,37 @@
 \details{
 \describe{
 \item{returnlevelplot}{\code{signature(x = "ANY", y = "UnivariateDistribution")}:
-produces a QQ plot of a dataset \code{x} against the theoretical
+produces a return level plot of a dataset \code{x} against the theoretical
 quantiles of distribution \code{y}.}
 \item{returnlevelplot}{\code{signature(x = "ANY", y = "ProbFamily")}:
-produces a QQ plot of a dataset \code{x} against the theoretical
+produces a return level plot of a dataset \code{x} against the theoretical
 quantiles of the model distribution of model \code{y}. Passed through
 the \code{\dots} argument, all arguments valid for
 \code{signature(x = "ANY", y = "UnivariateDistribution")}
 are also valid for this signature.}
+\item{returnlevelplot}{\code{signature(x = "ANY", y = "Estimate")}:
+produces a return level plot of a dataset \code{x} against the theoretical
+quantiles of the model distribution of the model that can be reconstructed
+from the estimator \code{y}; more specifically, it tries to get hand at the
+argument \code{'ParamFamily'} of the esimator's call; if this is available,
+internally this model is shifted to the estimated parameter by a call to
+\code{modifyModel}, and then this shifted model is used in a call to the
+\code{(x = "ANY", y = "UnivariateDistribution")}-method. Passed through
+the \code{\dots} argument, all arguments valid for
+\code{signature(x = "ANY", y = "UnivariateDistribution")}
+are also valid for this signature.}
+
 }
 }
 
 \references{
-  Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
-  \emph{The New S Language}.
-  Wadsworth & Brooks/Cole.
+  ismev: An   Introduction to Statistical Modeling of Extreme Values. R package
+  version 1.39. http://CRAN.R-project.org/package=ismev; original S functions
+  written by Janet E. Heffernan with R port and R documentation provided by
+  Alec G. Stephenson. (2012).
+
+  Coles, S. (2001). \emph{An introduction
+  to statistical modeling of extreme values.} London: Springer.
 }
 \author{
   Peter Ruckdeschel \email{Peter.Ruckdeschel at itwm.fraunhofer.de}



More information about the Distr-commits mailing list