From noreply at r-forge.r-project.org Fri Aug 8 18:34:54 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 8 Aug 2014 18:34:54 +0200 (CEST) Subject: [Distr-commits] r947 - in pkg/distr: . R inst man tests tests/unitTests Message-ID: <20140808163454.2D5F21876F7@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-08 18:34:53 +0200 (Fri, 08 Aug 2014) New Revision: 947 Added: pkg/distr/inst/unitTests/ pkg/distr/tests/doSvUnit.R pkg/distr/tests/unitTests/ pkg/distr/tests/unitTests/runit.dontrunMinimum.R pkg/distr/tests/unitTests/runit.dontrunMinimum.save pkg/distr/tests/unitTests/runit.dontrunOperatorsMethods.R pkg/distr/tests/unitTests/runit.dontrunOperatorsMethods.save pkg/distr/tests/unitTests/runit.dontrunQQPlot.R pkg/distr/tests/unitTests/runit.dontrunQQPlot1.save pkg/distr/tests/unitTests/runit.dontrunQQPlot2.save pkg/distr/tests/unitTests/runit.dontrunQQPlot3.save Modified: pkg/distr/DESCRIPTION pkg/distr/R/internalUtils.R pkg/distr/R/internalUtils_LCD.R pkg/distr/R/internals-qqplot.R pkg/distr/R/qqbounds.R pkg/distr/R/qqplot.R pkg/distr/R/setIsRelations.R pkg/distr/inst/CITATION pkg/distr/inst/NEWS pkg/distr/man/DiscreteDistribution-class.Rd pkg/distr/man/internals-qqplot.Rd pkg/distr/man/internals.Rd pkg/distr/man/qqbounds.Rd pkg/distr/man/qqplot.Rd Log: [distr] prepared trunk version 2.5.3 for publishing on CRAN / included new CITATION file Modified: pkg/distr/DESCRIPTION =================================================================== --- pkg/distr/DESCRIPTION 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/DESCRIPTION 2014-08-08 16:34:53 UTC (rev 947) @@ -1,6 +1,6 @@ Package: distr -Version: 2.5.2 -Date: 2013-09-12 +Version: 2.5.3 +Date: 2014-08-08 Title: Object oriented implementation of distributions Description: S4 Classes and Methods for distributions Authors at R: c(person("Florian", "Camphausen", role=c("aut")), @@ -10,7 +10,7 @@ person("R Core Team", role = c("ctb", "cph"), comment="for source file ks.c/ routines 'pKS2' and 'pKolmogorov2x'")) Depends: R(>= 2.14.0), methods, graphics, startupmsg, sfsmisc, SweaveListingUtils -Suggests: distrEx +Suggests: distrEx, svUnit (>= 0.7-11) Imports: stats ByteCompile: yes Encoding: latin1 Modified: pkg/distr/R/internalUtils.R =================================================================== --- pkg/distr/R/internalUtils.R 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/R/internalUtils.R 2014-08-08 16:34:53 UTC (rev 947) @@ -1233,7 +1233,10 @@ #------------------------------------------------------------------------------ # fill a list acc. recycling rules #------------------------------------------------------------------------------ +.List <- function(list0) if(is.list(list0)) list0 else list(list0) + .fillList <- function(list0, len = length(list0)){ + list0 <- .List(list0) if(len == length(list0)) return(list0) i <- 0 Modified: pkg/distr/R/internalUtils_LCD.R =================================================================== --- pkg/distr/R/internalUtils_LCD.R 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/R/internalUtils_LCD.R 2014-08-08 16:34:53 UTC (rev 947) @@ -82,7 +82,7 @@ state2 <- 0 } } - erg <- if (jj > 0) gaps.new[1:jj, ] else NULL + erg <- if (jj > 0) gaps.new[1:jj, ,drop=FALSE] else NULL return(.consolidategaps(erg)) } Modified: pkg/distr/R/internals-qqplot.R =================================================================== --- pkg/distr/R/internals-qqplot.R 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/R/internals-qqplot.R 2014-08-08 16:34:53 UTC (rev 947) @@ -86,18 +86,12 @@ .C("pkolmogorov2x", p = as.double(p0), as.integer(n), PACKAGE = "stats")$p }else function(p0,n){ -# .Call(stats:::C_pKolmogorov2x, p0, n) #, PACKAGE = "stats") -# .C("pkolmogorov2x", p = as.double(p0), -# as.integer(n))$p .Call("pKolmogorov2x", p0, n) #, PACKAGE = "stats") } .pks2 <- if(getRversion()<"2.16.0") function(x, tol){ .C("pkstwo", as.integer(1), p = as.double(x), as.double(tol), PACKAGE = "stats")$p }else function(x, tol){ -# .Call(stats:::C_pKS2, p = x, tol) #, PACKAGE = "stats") -# .C("pkstwo", as.integer(1), -# p = as.double(x), as.double(tol))$p .Call("pKS2", p = x, tol) #, PACKAGE = "stats") } @@ -113,23 +107,10 @@ } res <- uniroot(fct,lower=0,upper=1)$root*sqrt(n) }else{ + fct <- function(p0){ ### from ks.test from package stats: - pkstwo <- function(x, tol = 1e-09) { - #if (is.numeric(x)) - # x <- as.vector(x) - #else stop("argument 'x' must be numeric") - #p <- rep(0, length(x)) - #p[is.na(x)] <- NA - #IND <- which(!is.na(x) & (x > 0)) - #if (length(IND)) { - .pks2(x,tol) -alpha - #} - # return(p) - } - ### end of code from package stats - fct <- function(p0){ - 1 - pkstwo(p0)-alpha } - res <- uniroot(fct,lower=0,upper=sqrt(n))$root + 1 - .pks2(p0,1e-09)-alpha } + res <- uniroot(fct,lower=1e-12,upper=sqrt(n))$root } return(res) } @@ -184,7 +165,7 @@ pq <- log(p.b)+log(1-p.b) if(is(D,"AbscontDistribution")){ dp <- d(D)(x,log=TRUE) - dsupp.p <- dsupp.m<-1 + dsupp.p <- dsupp.m <- 1 }else{ ## have E and sd available ? if(!.distrExInstalled) stop("") supp.ind <- sapply(x, function(y) @@ -205,14 +186,15 @@ -.confqq <- function(x,D, withConf.pw = TRUE, withConf.sim = TRUE, alpha, +.confqq <- function(x,D, datax = TRUE, withConf.pw = TRUE, + withConf.sim = TRUE, alpha, col.pCI, lty.pCI, lwd.pCI, pch.pCI, cex.pCI, col.sCI, lty.sCI, lwd.sCI, pch.sCI, cex.sCI, n,exact.sCI=(n<100),exact.pCI=(n<100), nosym.pCI = FALSE, with.legend = TRUE, legend.bg = "white", legend.pos = "topleft", legend.cex = 0.8, legend.pref = "", legend.postf = "", - legend.alpha = alpha){ + legend.alpha = alpha, qqb0=NULL, debug = FALSE){ x <- sort(unique(x)) if("gaps" %in% names(getSlots(class(D)))) @@ -229,36 +211,65 @@ x.d <- x.in[!SI.c] - qqb <- qqbounds(x,D,alpha,n,withConf.pw, withConf.sim, - exact.sCI,exact.pCI,nosym.pCI) + qqb <- if(is.null(qqb0)) qqbounds(x,D,alpha,n,withConf.pw, withConf.sim, + exact.sCI,exact.pCI,nosym.pCI, debug) else qqb0 + qqb$crit <- qqb$crit[SI.in,] if(qqb$err["pw"]){ if(sum(SI.c)>0){ - lines(x.c, qqb$crit[SI.c,"pw.right"], - col=col.pCI,lty=lty.pCI,lwd=lwd.pCI) - lines(x.c, qqb$crit[SI.c,"pw.left"], - col=col.pCI,lty=lty.pCI,lwd=lwd.pCI) + if(datax){ + lines(x.c, qqb$crit[SI.c,"pw.right"], + col=col.pCI,lty=lty.pCI,lwd=lwd.pCI) + lines(x.c, qqb$crit[SI.c,"pw.left"], + col=col.pCI,lty=lty.pCI,lwd=lwd.pCI) + }else{ + lines(qqb$crit[SI.c,"pw.right"], x.c, + col=col.pCI,lty=lty.pCI,lwd=lwd.pCI) + lines(qqb$crit[SI.c,"pw.left"], x.c, + col=col.pCI,lty=lty.pCI,lwd=lwd.pCI) + } } if(sum(!SI.c)>0){ - points(x.d, qqb$crit[!SI.c,"pw.right"], - col=col.pCI, pch=pch.pCI, cex = cex.pCI) - points(x.d, qqb$crit[!SI.c,"pw.left"], - col=col.pCI, pch=pch.pCI, cex = cex.pCI) + if(datax){ + points(x.d, qqb$crit[!SI.c,"pw.right"], + col=col.pCI, pch=pch.pCI, cex = cex.pCI) + points(x.d, qqb$crit[!SI.c,"pw.left"], + col=col.pCI, pch=pch.pCI, cex = cex.pCI) + }else{ + points(qqb$crit[!SI.c,"pw.right"], x.d, + col=col.pCI, pch=pch.pCI, cex = cex.pCI) + points(qqb$crit[!SI.c,"pw.left"], x.d, + col=col.pCI, pch=pch.pCI, cex = cex.pCI) + } } } if(qqb$err["sim"]){ if(sum(SI.c)>0){ - lines(x.c, qqb$crit[SI.c,"sim.right"], + if(datax){ + lines(x.c, qqb$crit[SI.c,"sim.right"], col=col.sCI,lty=lty.sCI,lwd=lwd.sCI) - lines(x.c, qqb$crit[SI.c,"sim.left"], + lines(x.c, qqb$crit[SI.c,"sim.left"], col=col.sCI,lty=lty.sCI,lwd=lwd.sCI) + }else{ + lines(qqb$crit[SI.c,"sim.right"], x.c, + col=col.sCI,lty=lty.sCI,lwd=lwd.sCI) + lines(qqb$crit[SI.c,"sim.left"], x.c, + col=col.sCI,lty=lty.sCI,lwd=lwd.sCI) + } } if(sum(!SI.c)>0){ - points(x.d, qqb$crit[!SI.c,"sim.right"], + if(datax){ + points(x.d, qqb$crit[!SI.c,"sim.right"], col=col.sCI, pch=pch.sCI, cex = cex.sCI) - points(x.d, qqb$crit[!SI.c,"sim.left"], + points(x.d, qqb$crit[!SI.c,"sim.left"], col=col.sCI, pch=pch.sCI, cex = cex.sCI) + }else{ + points(qqb$crit[!SI.c,"sim.right"], x.d, + col=col.sCI, pch=pch.sCI, cex = cex.sCI) + points(qqb$crit[!SI.c,"sim.left"], x.d, + col=col.sCI, pch=pch.sCI, cex = cex.sCI) + } } } if(with.legend){ @@ -301,7 +312,7 @@ merge = FALSE, cex = legend.cex), lcl)) } } - return(invisible(NULL)) + return(invisible(qqb)) } .deleteItemsMCL <- function(mcl){ Modified: pkg/distr/R/qqbounds.R =================================================================== --- pkg/distr/R/qqbounds.R 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/R/qqbounds.R 2014-08-08 16:34:53 UTC (rev 947) @@ -1,7 +1,7 @@ ## to be exported: berechnet Konfidenzb?nder, simultan und punktweise qqbounds <- function(x,D,alpha,n,withConf.pw, withConf.sim, exact.sCI=(n<100),exact.pCI=(n<100), - nosym.pCI = FALSE){ + nosym.pCI = FALSE, debug = FALSE){ x <- sort(unique(x)) if("gaps" %in% names(getSlots(class(D)))) {if(!is.null(gaps(D))) @@ -17,10 +17,21 @@ p.r <- p(D)(x.in) p.l <- p.l(D)(x.in) l.x <- length(x.in) - + if(debug){ + print(SI) + print(x.in) + print(sum(SI.in)) + print(cbind(p.r,p.l)) + print(l.x) + print(c(alpha,n,exact.sCI)) + } c.crit <- if(withConf.sim) try(.q2kolmogorov(alpha,n,exact.sCI), silent=TRUE) else NULL c.crit.i <- if(withConf.pw) try(.q2pw(x.in,p.r,D,n,alpha,exact.pCI,nosym.pCI),silent=TRUE) else NULL - + #print(cbind(c.crit,c.crit.i)) + if(debug){ + print(str(c.crit)) + print(str(c.crit.i)) + } te.i <- withConf.pw & !is(c.crit.i,"try-error") te.s <- withConf.sim & !is(c.crit, "try-error") @@ -46,3 +57,4 @@ } return(list(crit = c.c, err=c(sim=te.s,pw=te.i))) } +# returnlevelplot(xex,datax=FALSE,GEVFamilyMuUnknown(loc=es[1],shape=es[3],scale=es[2])) Modified: pkg/distr/R/qqplot.R =================================================================== --- pkg/distr/R/qqplot.R 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/R/qqplot.R 2014-08-08 16:34:53 UTC (rev 947) @@ -18,7 +18,7 @@ jit.fac = 0, 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.postf = "", legend.alpha = alpha.CI, debug = FALSE){ mc <- match.call(call = sys.call(sys.parent(1))) if(missing(xlab)) mc$xlab <- as.character(deparse(mc$x)) @@ -26,6 +26,7 @@ mcl <- as.list(mc)[-1] mcl$withSweave <- NULL mcl$mfColRow <- NULL + mcl$debug <- NULL force(x) @@ -73,9 +74,9 @@ if(mfColRow) opar1 <- par(mfrow = c(1,1), no.readonly = TRUE) ret <- do.call(stats::qqplot, args=mcl) - - if(withIdLine&& plot.it){ - abline(0,1,col=col.IdL,lty=lty.IdL,lwd=lwd.IdL) + qqb <- NULL + if(withIdLine){ + if(plot.it)abline(0,1,col=col.IdL,lty=lty.IdL,lwd=lwd.IdL) if(#is(y,"AbscontDistribution") && withConf){ xy <- unique(sort(c(xc.o,yc.o))) @@ -97,16 +98,22 @@ xy <- sort(c(xy,xy0,xy1)) } } - .confqq(xy, y, withConf.pw, withConf.sim, alpha.CI, + if(plot.it){ + qqb <- .confqq(xy, y, datax=TRUE, withConf.pw, withConf.sim, alpha.CI, col.pCI, lty.pCI, lwd.pCI, pch.pCI, cex.pCI, col.sCI, lty.sCI, lwd.sCI, pch.sCI, cex.sCI, n, exact.sCI = exact.sCI, exact.pCI = exact.pCI, nosym.pCI = nosym.pCI, with.legend = with.legend, legend.bg = legend.bg, legend.pos = legend.pos, legend.cex = legend.cex, legend.pref = legend.pref, - legend.postf = legend.postf, legend.alpha = legend.alpha) + legend.postf = legend.postf, legend.alpha = legend.alpha, + debug = debug) + }else{ + qqb <- qqbounds(sort(unique(xy)),y,alpha.CI,n,withConf.pw, withConf.sim, + exact.sCI,exact.pCI,nosym.pCI,debug) + } } } - return(ret) + return(c(ret,qqb)) }) Modified: pkg/distr/R/setIsRelations.R =================================================================== --- pkg/distr/R/setIsRelations.R 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/R/setIsRelations.R 2014-08-08 16:34:53 UTC (rev 947) @@ -55,6 +55,22 @@ slot(to, name = names(lst)[i]) <- lst[[i]] return(to)} }) + +## if support is affine linear, a DiscreteDistribution is a LatticeDistribution +setAs("AffLinDiscreteDistribution", "LatticeDistribution", + function(from){ + if(!.is.vector.lattice(from at support)) + return(from) + else{ to <- new("AffLinLatticeDistribution") + slotNames <- slotNames(from) + lst <- sapply(slotNames, function(x) slot(from,x)) + names(lst) <- slotNames + lst$lattice <- .make.lattice.es.vector(from at support) + for (i in 1: length(lst)) + slot(to, name = names(lst)[i]) <- lst[[i]] + return(to)} + }) + #setIs("DiscreteDistribution", "LatticeDistribution", # test = function(object) .is.vector.lattice(support(object)), # coerce = function(from) Modified: pkg/distr/inst/CITATION =================================================================== --- pkg/distr/inst/CITATION 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/inst/CITATION 2014-08-08 16:34:53 UTC (rev 947) @@ -1,20 +1,42 @@ citHeader("To cite package distr in publications use:") citEntry(entry="Article", - title = "S4 Classes for Distributions", - author = personList(as.person("P. Ruckdeschel"), - as.person("M. Kohl"), - as.person("T. Stabla"), - as.person("F. Camphausen")), - language = "English", - year = 2006, - journal = "R News", - year = 2006, - volume = 6, - number = 2, - pages = "2--6", - month = "May", - url = "http://www.uni-bayreuth.de/departments/math/org/mathe7/DISTR/distr.pdf", - pdf = "http://CRAN.R-project.org/doc/Rnews/Rnews_2006-2.pdf", -textVersion = paste("Ruckdeschel, P., Kohl, M., Stabla, T., & Camphausen, F. (2006)", - "S4 Classes for Distributions")) + title = "S4 Classes for Distributions", + author = personList(as.person("P. Ruckdeschel"), + as.person("M. Kohl"), + as.person("T. Stabla"), + as.person("F. Camphausen")), + language = "English", + year = 2006, + journal = "R News", + year = 2006, + volume = 6, + number = 2, + pages = "2--6", + month = "May", + url = "http://www.uni-bayreuth.de/departments/math/org/mathe7/DISTR/distr.pdf", + pdf = "http://CRAN.R-project.org/doc/Rnews/Rnews_2006-2.pdf", + textVersion = + paste("Peter Ruckdeschel, Matthias Kohl, Thomas Stabla, Florian Camphausen (2006).", + "S4 Classes for Distributions.", "R News, 6(2), 2-6.", + "URL http://CRAN.R-project.org/doc/Rnews/") +) + +citEntry(entry = "Article", + title = "General Purpose Convolution Algorithm in {S}4 Classes by Means of FFT", + author = personList(as.person("Peter Ruckdeschel"), + as.person("Matthias Kohl")), + journal = "Journal of Statistical Software", + year = "2014", + volume = "59", + number = "4", + pages = "1--25", + url = "http://www.jstatsoft.org/v59/i04/", + textVersion = + paste("Peter Ruckdeschel, Matthias Kohl (2014).", + "General Purpose Convolution Algorithm in S4 Classes by Means of FFT.", + "Journal of Statistical Software, 59(4), 1-25.", + "URL http://www.jstatsoft.org/v59/i04/."), + header = "If you employ convolution, please also cite:" +) + Modified: pkg/distr/inst/NEWS =================================================================== --- pkg/distr/inst/NEWS 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/inst/NEWS 2014-08-08 16:34:53 UTC (rev 947) @@ -8,6 +8,25 @@ information) ############## +v 2.5.3 +############## + +user-visible CHANGES: ++ CITATION file updated after JSS publication + +under the hood: ++ tests: long-running tests with large pre-calculated results successfully implemented ++ enhanced utility function .fillList by an automatic cast to list if the argument + not yet is of class list. ++ some minor changes in qqplot + +bug fixes: ++ bug in LatticeDistribution found by Mikhail.Spivakov at babraham.ac.uk ++ found a missing drop=FALSE in .mergegaps2 ++ fixed an issue with casting AffLinDiscreteDistributions to LatticeDistributions + (discovered by Kostas Oikonomou, ko at research.att.com ) + +############## v 2.5 ############## Modified: pkg/distr/man/DiscreteDistribution-class.Rd =================================================================== --- pkg/distr/man/DiscreteDistribution-class.Rd 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/man/DiscreteDistribution-class.Rd 2014-08-08 16:34:53 UTC (rev 947) @@ -6,6 +6,7 @@ \alias{initialize,AffLinDiscreteDistribution-method} \alias{sqrt,DiscreteDistribution-method} \alias{coerce,DiscreteDistribution,LatticeDistribution-method} +\alias{coerce,AffLinDiscreteDistribution,LatticeDistribution-method} \title{Class "DiscreteDistribution"} \description{The \code{DiscreteDistribution}-class is the mother-class of the class \code{LatticeDistribution}.} Modified: pkg/distr/man/internals-qqplot.Rd =================================================================== --- pkg/distr/man/internals-qqplot.Rd 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/man/internals-qqplot.Rd 2014-08-08 16:34:53 UTC (rev 947) @@ -33,14 +33,14 @@ .q2kolmogorov(alpha,n,exact=(n<100)) .q2pw(x,p.b,D,n,alpha,exact=(n<100),nosym=FALSE) -.confqq(x,D, withConf.pw = TRUE, withConf.sim = TRUE, alpha, +.confqq(x,D, datax=TRUE, withConf.pw = TRUE, withConf.sim = TRUE, alpha, col.pCI, lty.pCI, lwd.pCI, pch.pCI, cex.pCI, col.sCI, lty.sCI, lwd.sCI, pch.sCI, cex.sCI, n,exact.sCI=(n<100),exact.pCI=(n<100), nosym.pCI = FALSE, with.legend = TRUE, legend.bg = "white", legend.pos = "topleft", legend.cex = 0.8, legend.pref = "", legend.postf = "", - legend.alpha = alpha) + legend.alpha = alpha, qqb0 = NULL, debug = FALSE) .deleteItemsMCL(mcl) .distrExInstalled @@ -54,6 +54,7 @@ object. } \item{D}{object of class \code{"UnivariateDistribution"}} +\item{datax}{logical; (to be used in \pkg{distrMod}) shall data be plotted on x-axis?} \item{ord}{integer; the result of a call to \code{order}} \item{alpha}{numeric in [0,1]; confidence level} \item{n}{integer; sample size} @@ -92,6 +93,8 @@ \item{legend.postf}{character to be appended to legend text} \item{legend.alpha}{nominal coverage probability} \item{mcl}{arguments in call as a list} +\item{qqb0}{precomputed return value of \code{qqbounds}} +\item{debug}{logical; if \code{TRUE} additional output to debug confidence bounds.} } \details{ @@ -157,7 +160,7 @@ columns will be filled with \code{NA}. \code{.confqq} calls \code{qqbound} to compute the confidence intervals -and plots them. +and plots them; returns the return value of qqbound. \code{.deleteItemsMCL} deletes arguments from a call list which functions like \code{plot}, \code{lines}, \code{points} cannot digest; Modified: pkg/distr/man/internals.Rd =================================================================== --- pkg/distr/man/internals.Rd 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/man/internals.Rd 2014-08-08 16:34:53 UTC (rev 947) @@ -124,6 +124,7 @@ .csimpsum(fx) .primefun(f,x, nm = NULL) .IssueWarn(Arith,Sim) +.List(list0) .fillList(list0, len=length(list0)) .trunc.up(object, upper) .trunc.low(object, lower) @@ -364,8 +365,13 @@ of \code{cumsum}. \code{.primefun} is similar but more flexible and produces the prime function as a function. +\code{.List} checks if argument already is a list, and if so leaves it as + it is, otherwise casts it to a list by a call to \code{list}. + \code{.fillList} fills a new list with the elements of a given list \code{list0} until length \code{len} is reached using recycling if necessary. + Argument \code{list0} is cast to \code{list} by a call + to \code{.List} if necessary. \code{.trunc.up}, \code{.trunc.low} provide common routines for classes \code{DiscreteDistribution} and \code{AbscontDistribution} for @@ -442,6 +448,7 @@ \item{.csimpsum}{a vector of evaluations of the prime function at the grid points.} \item{.primefun}{the prime function as a function.} \item{.IssueWarn}{a list with two warnings to be issued each of which may be empty.} +\item{.List}{a list.} \item{.fillList}{a list.} \item{.trunc.up,.trunc.low}{a list with elements \code{r,p,d,q} (in this order).} \item{.DistrCollapse}{upon a suggestion by Jacob van Etten, Modified: pkg/distr/man/qqbounds.Rd =================================================================== --- pkg/distr/man/qqbounds.Rd 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/man/qqbounds.Rd 2014-08-08 16:34:53 UTC (rev 947) @@ -3,7 +3,7 @@ \usage{ qqbounds(x,D,alpha,n,withConf.pw, withConf.sim, exact.sCI=(n<100),exact.pCI=(n<100), - nosym.pCI = FALSE) + nosym.pCI = FALSE, debug = FALSE) } \alias{qqbounds} @@ -19,6 +19,7 @@ \item{exact.pCI}{logical; shall pointwise CIs be determined with exact Binomial distribution?} \item{exact.sCI}{logical; shall simultaneous CIs be determined with exact kolmogorov distribution?} \item{nosym.pCI}{logical; shall we use (shortest) asymmetric CIs?} +\item{debug}{logical; if \code{TRUE} additional output to debug confidence bounds.} } \description{ We compute confidence intervals for QQ plots. Modified: pkg/distr/man/qqplot.Rd =================================================================== --- pkg/distr/man/qqplot.Rd 2014-07-28 11:09:12 UTC (rev 946) +++ pkg/distr/man/qqplot.Rd 2014-08-08 16:34:53 UTC (rev 947) @@ -24,7 +24,7 @@ jit.fac = 0, 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.postf = "", legend.alpha = alpha.CI, debug = FALSE) \S4method{qqplot}{ANY,ANY}(x, y, plot.it = TRUE, xlab = deparse(substitute(x)), ylab = deparse(substitute(y)), ...) @@ -79,6 +79,7 @@ \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{ @@ -105,6 +106,11 @@ \item{x}{The x coordinates of the points that were/would be plotted} \item{y}{The corresponding quantiles of the second distribution, \emph{including \code{\link{NA}}s}.} + \item{crit}{A matrix with the lower and upper confidence bounds + (computed by \code{qqbounds}).} + \item{err}{logical vector of length 2.} + (elements \code{crit} and \code{err} are taken from the return + value(s) of \code{qqbounds}). } \references{ Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) Added: pkg/distr/tests/doSvUnit.R =================================================================== --- pkg/distr/tests/doSvUnit.R (rev 0) +++ pkg/distr/tests/doSvUnit.R 2014-08-08 16:34:53 UTC (rev 947) @@ -0,0 +1,73 @@ +# we only run the tests, if svUnit is available +if (require(svUnit, quietly=TRUE)) { + pkg <- "distr" + require("distr") + + # we must investigate whether R CMD check is running or not + # and if the check is running, whether a time limit exists + RCMDCHECK <- FALSE + RCMDCHECKCRAN <- FALSE + + for (actual.name in names(Sys.getenv())) { + if (substr(actual.name, 1, 9) == "_R_CHECK_") { + RCMDCHECK <- TRUE + + if (actual.name == "_R_CHECK_TIMINGS_") { + RCMDCHECKCRAN <- (as.numeric(Sys.getenv("_R_CHECK_TIMINGS_")) > 0) + } + } + } + + # we must determine the path for tests in the installation and outside installation + if (RCMDCHECK) { + ## Path to unit tests for R CMD check + ## PKG.Rcheck/tests/../PKG/unitTests + ## PKG.Rcheck/tests/unitTests + + # we determine the two paths + pathTestsInInstallation <- system.file(package=pkg, "unitTests") + pathTestsOutsideInstallation <- file.path(getwd(), "unitTests") + } else { + ## Path to unit tests for standalone running as script with "PKG/tests" as working directory + ## PKG/tests/../inst/unitTests + ## PKG/tests/unitTests + + # we determine the two paths + pathTestsInInstallation <- file.path(getwd(), "..", "inst", "unitTests") + pathTestsOutsideInstallation <- file.path(getwd(), "unitTests") + } + + print(pathTestsInInstallation) + print(pathTestsOutsideInstallation) + + # it depends whether we want to skip the long running tests or not + if (RCMDCHECKCRAN) { + mypkgSuite <- svSuiteList(packages=pkg, dirs=pathTestsInInstallation) + } else { + mypkgSuite <- svSuiteList(packages=pkg, dirs=c(pathTestsInInstallation, pathTestsOutsideInstallation)) + } + + unlink("report.txt") # Make sure we generate a new report + + print(svSuiteList(packages=FALSE, dirs=c(pathTestsInInstallation, pathTestsOutsideInstallation))) + + runTest(mypkgSuite, name = pkg) # Run them... + + ## makeTestListFromExamples is in svUnit 0.7.8 or more + #doRunExamples <- TRUE + #svUnitVersion = as.integer(strsplit(installed.packages()[which(installed.packages()[, 'Package'] == "svUnit"), "Version"], "[\\.-]")[[1]]) + #if (svUnitVersion[1] == 0) { + # if (svUnitVersion[2] < 7) { + # doRunExamples <- FALSE + # } else { + # if (svUnitVersion[2] == 7) + # doRunExamples <- svUnitVersion[3] >= 8 + # } + #} + #if(doRunExamples) + # runTest(tryCatch(makeTestListFromExamples(pkg, "../../pkg/man/"), error=function(e) NULL)) + + + protocol(Log(), type = "text", file = "report.txt") # ... and write report +} + Added: pkg/distr/tests/unitTests/runit.dontrunMinimum.R =================================================================== --- pkg/distr/tests/unitTests/runit.dontrunMinimum.R (rev 0) +++ pkg/distr/tests/unitTests/runit.dontrunMinimum.R 2014-08-08 16:34:53 UTC (rev 947) @@ -0,0 +1,19 @@ +# test for equality of the saved result and the actual result of a dontrun example +test.minimum <- function() { + # we compute the actual object + runit.dontrunMinimum.actual <- Minimum(Norm(), Pois()) + + # we load the saved object for comparison + # we assume that this test is called from within the script in the upper directory + load("unitTests/runit.dontrunMinimum.save") + + # we compare the stored result with the calculated one + # (a comparison with identical (ignoring the environment) gives FALSE... + result <- all.equal(runit.dontrunMinimum.actual, + runit.dontrunMinimum.save) + + # we check whether the result is TRUE and if not, we write the message + # coming from the result + checkEquals(is.logical(result) && result, TRUE, msg=paste(result, sep="", collapse="\n")) +} + Added: pkg/distr/tests/unitTests/runit.dontrunMinimum.save =================================================================== (Binary files differ) Property changes on: pkg/distr/tests/unitTests/runit.dontrunMinimum.save ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: pkg/distr/tests/unitTests/runit.dontrunOperatorsMethods.R =================================================================== --- pkg/distr/tests/unitTests/runit.dontrunOperatorsMethods.R (rev 0) +++ pkg/distr/tests/unitTests/runit.dontrunOperatorsMethods.R 2014-08-08 16:34:53 UTC (rev 947) @@ -0,0 +1,21 @@ +# test for equality of the saved result and the actual result of a dontrun example +test.operatorsMethods <- function() { + # we compute the actual result + N <- Norm(0,3) + P <- Pois(4) + runit.dontrunOperatorsMethods.actual <- N ^ P + + # we load the stored result + # we assume that this test is called from within the script in the upper directory + load("unitTests/runit.dontrunOperatorsMethods.save") + + # we compare the stored result with the calculated one + # (a comparison with identical (ignoring the environment) gives FALSE... + result <- all.equal(runit.dontrunOperatorsMethods.actual, + runit.dontrunOperatorsMethods.save) + + # we check whether the result is TRUE and if not, we write the message + # coming from the result + checkEquals(is.logical(result) && result, TRUE, msg=paste(result, sep="", collapse="\n")) +} + Added: pkg/distr/tests/unitTests/runit.dontrunOperatorsMethods.save =================================================================== (Binary files differ) Property changes on: pkg/distr/tests/unitTests/runit.dontrunOperatorsMethods.save ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: pkg/distr/tests/unitTests/runit.dontrunQQPlot.R =================================================================== --- pkg/distr/tests/unitTests/runit.dontrunQQPlot.R (rev 0) +++ pkg/distr/tests/unitTests/runit.dontrunQQPlot.R 2014-08-08 16:34:53 UTC (rev 947) @@ -0,0 +1,68 @@ +# test for equality of the saved result and the actual result of a dontrun example +test.qqplot1 <- function() { + # we compute the actual result + P <- Pois(5) + B <- Binom(size=2000,prob=5/2000) + runit.dontrunQQPlot1.actual <- qqplot(B,P, nosym.pCI=TRUE) + + # we load the stored result + # we assume that this test is called from within the script in the upper directory + load("unitTests/runit.dontrunQQPlot1.save") + + # we compare the stored result with the calculated one + # (a comparison with identical (ignoring the environment) gives FALSE... + result <- all.equal(runit.dontrunQQPlot1.actual, + runit.dontrunQQPlot1.save) + + # we check whether the result is TRUE and if not, we write the message + # coming from the result + checkEquals(is.logical(result) && result, TRUE, msg=paste(result, sep="", collapse="\n")) +} + + +# test for equality of the saved result and the actual result of a dontrun example +test.qqplot2 <- function() { + # we compute the actual result + mylist <- UnivarLebDecDistribution(discretePart=Binom(3,.3), acPart=Norm(2,2), + acWeight=11/20) + mylist2 <- mylist+0.1 + + runit.dontrunQQPlot2.actual <- qqplot(mylist,mylist2,nosym.pCI=TRUE) + + # we load the stored result + # we assume that this test is called from within the script in the upper directory + load("unitTests/runit.dontrunQQPlot2.save") + + # we compare the stored result with the calculated one + # (a comparison with identical (ignoring the environment) gives FALSE... + result <- all.equal(runit.dontrunQQPlot2.actual, + runit.dontrunQQPlot2.save) + + # we check whether the result is TRUE and if not, we write the message + # coming from the result + checkEquals(is.logical(result) && result, TRUE, msg=paste(result, sep="", collapse="\n")) +} + + +# test for equality of the saved result and the actual result of a dontrun example +test.qqplot3 <- function() { + # we compute the actual result + mylist3 <- UnivarMixingDistribution(Unif(0,0.3),Unif(0.6,1),mixCoeff=c(0.8,0.2)) + mylist4 <- UnivarMixingDistribution(Unif(0,0.3),Unif(0.6,1),mixCoeff=c(0.6,0.4)) + + runit.dontrunQQPlot3.actual <- qqplot(mylist3,mylist4,nosym.pCI=TRUE) + + # we load the stored result + # we assume that this test is called from within the script in the upper directory + load("unitTests/runit.dontrunQQPlot3.save") + + # we compare the stored result with the calculated one + # (a comparison with identical (ignoring the environment) gives FALSE... + result <- all.equal(runit.dontrunQQPlot3.actual, + runit.dontrunQQPlot3.save) + + # we check whether the result is TRUE and if not, we write the message + # coming from the result + checkEquals(is.logical(result) && result, TRUE, msg=paste(result, sep="", collapse="\n")) +} + Added: pkg/distr/tests/unitTests/runit.dontrunQQPlot1.save =================================================================== (Binary files differ) Property changes on: pkg/distr/tests/unitTests/runit.dontrunQQPlot1.save ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: pkg/distr/tests/unitTests/runit.dontrunQQPlot2.save =================================================================== (Binary files differ) Property changes on: pkg/distr/tests/unitTests/runit.dontrunQQPlot2.save ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: pkg/distr/tests/unitTests/runit.dontrunQQPlot3.save =================================================================== (Binary files differ) [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/distr -r 947 From noreply at r-forge.r-project.org Fri Aug 8 18:53:55 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 8 Aug 2014 18:53:55 +0200 (CEST) Subject: [Distr-commits] r948 - in branches/distr-2.6/pkg: distr/inst distrMod/man Message-ID: <20140808165355.7D23C187697@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-08 18:53:55 +0200 (Fri, 08 Aug 2014) New Revision: 948 Modified: branches/distr-2.6/pkg/distr/inst/CITATION branches/distr-2.6/pkg/distr/inst/NEWS branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd Log: [distr] in devel-branch CITATION und NEWS file aktualisiert, sowie ?\195?\132nderung in Doku returnlevelplot.R gemacht Modified: branches/distr-2.6/pkg/distr/inst/CITATION =================================================================== --- branches/distr-2.6/pkg/distr/inst/CITATION 2014-08-08 16:34:53 UTC (rev 947) +++ branches/distr-2.6/pkg/distr/inst/CITATION 2014-08-08 16:53:55 UTC (rev 948) @@ -1,20 +1,43 @@ citHeader("To cite package distr in publications use:") citEntry(entry="Article", - title = "S4 Classes for Distributions", - author = personList(as.person("P. Ruckdeschel"), - as.person("M. Kohl"), - as.person("T. Stabla"), - as.person("F. Camphausen")), - language = "English", - year = 2006, - journal = "R News", - year = 2006, - volume = 6, - number = 2, - pages = "2--6", - month = "May", - url = "http://www.uni-bayreuth.de/departments/math/org/mathe7/DISTR/distr.pdf", - pdf = "http://CRAN.R-project.org/doc/Rnews/Rnews_2006-2.pdf", -textVersion = paste("Ruckdeschel, P., Kohl, M., Stabla, T., & Camphausen, F. (2006)", - "S4 Classes for Distributions")) + title = "S4 Classes for Distributions", + author = personList(as.person("P. Ruckdeschel"), + as.person("M. Kohl"), + as.person("T. Stabla"), + as.person("F. Camphausen")), + language = "English", + year = 2006, + journal = "R News", + year = 2006, + volume = 6, + number = 2, + pages = "2--6", + month = "May", + url = "http://www.uni-bayreuth.de/departments/math/org/mathe7/DISTR/distr.pdf", + pdf = "http://CRAN.R-project.org/doc/Rnews/Rnews_2006-2.pdf", + textVersion = + paste("Peter Ruckdeschel, Matthias Kohl, Thomas Stabla, Florian Camphausen (2006).", + "S4 Classes for Distributions.", "R News, 6(2), 2-6.", + "URL http://CRAN.R-project.org/doc/Rnews/") +) + +citEntry(entry = "Article", + title = "General Purpose Convolution Algorithm in {S}4 Classes by Means of FFT", + author = personList(as.person("Peter Ruckdeschel"), + as.person("Matthias Kohl")), + journal = "Journal of Statistical Software", + year = "2014", + volume = "59", + number = "4", + pages = "1--25", + url = "http://www.jstatsoft.org/v59/i04/", + textVersion = + paste("Peter Ruckdeschel, Matthias Kohl (2014).", + "General Purpose Convolution Algorithm in S4 Classes by Means of FFT.", + "Journal of Statistical Software, 59(4), 1-25.", + "URL http://www.jstatsoft.org/v59/i04/."), + header = "If you employ convolution, please also cite:" +) + + \ No newline at end of file Modified: branches/distr-2.6/pkg/distr/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distr/inst/NEWS 2014-08-08 16:34:53 UTC (rev 947) +++ branches/distr-2.6/pkg/distr/inst/NEWS 2014-08-08 16:53:55 UTC (rev 948) @@ -8,6 +8,25 @@ information) ############## +v 2.5.3 +############## + +user-visible CHANGES: ++ CITATION file updated after JSS publication + +under the hood: ++ tests: long-running tests with large pre-calculated results successfully implemented ++ enhanced utility function .fillList by an automatic cast to list if the argument + not yet is of class list. ++ some minor changes in qqplot + +bug fixes: ++ bug in LatticeDistribution found by Mikhail.Spivakov at babraham.ac.uk ++ found a missing drop=FALSE in .mergegaps2 ++ fixed an issue with casting AffLinDiscreteDistributions to LatticeDistributions + (discovered by Kostas Oikonomou, ko at research.att.com ) + + ############## v 2.5 ############## Modified: branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd =================================================================== --- branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd 2014-08-08 16:34:53 UTC (rev 947) +++ branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd 2014-08-08 16:53:55 UTC (rev 948) @@ -120,7 +120,9 @@ \item{legend.alpha}{nominal coverage probability} } \description{ - We generalize function \code{\link[stats:qqnorm]{returnlevelplot}} from package \pkg{stats} to + 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 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. From noreply at r-forge.r-project.org Sun Aug 10 14:41:00 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 10 Aug 2014 14:41:00 +0200 (CEST) Subject: [Distr-commits] r949 - in branches/distr-2.6/pkg: distr/inst distr/man distr/vignettes distrDoc/inst distrDoc/vignettes distrEllipse/inst distrEx/inst distrMod/inst distrRmetrics/inst distrSim/inst distrTEst/inst distrTeach/inst distrTeach/man Message-ID: <20140810124100.848AD180936@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-10 14:41:00 +0200 (Sun, 10 Aug 2014) New Revision: 949 Modified: branches/distr-2.6/pkg/distr/inst/NEWS branches/distr-2.6/pkg/distr/man/0distr-package.Rd branches/distr-2.6/pkg/distr/man/ConvPow.Rd branches/distr-2.6/pkg/distr/man/operators-methods.Rd branches/distr-2.6/pkg/distr/vignettes/newDistributions.Rnw branches/distr-2.6/pkg/distrDoc/inst/CITATION branches/distr-2.6/pkg/distrDoc/inst/NEWS branches/distr-2.6/pkg/distrDoc/vignettes/distr.Rnw branches/distr-2.6/pkg/distrEllipse/inst/NEWS branches/distr-2.6/pkg/distrEx/inst/NEWS branches/distr-2.6/pkg/distrMod/inst/NEWS branches/distr-2.6/pkg/distrRmetrics/inst/NEWS branches/distr-2.6/pkg/distrSim/inst/NEWS branches/distr-2.6/pkg/distrTEst/inst/NEWS branches/distr-2.6/pkg/distrTeach/inst/NEWS branches/distr-2.6/pkg/distrTeach/man/IllustCLT.Rd Log: updated NEWS entries and references Modified: branches/distr-2.6/pkg/distr/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distr/inst/NEWS 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distr/inst/NEWS 2014-08-10 12:41:00 UTC (rev 949) @@ -8,6 +8,38 @@ information) ############## +v 2.6 +############## + +user visible changes ++ added reference to JSS paper in IllustCLT ++ updated references in vignette 'newDistributions' + +under the hood: + +-qqplot: + + (already there for a while) gains argument 'debug' to be able to + trace where computation of confidence bounds fails; this 'debug' + argument has now been enhanced in the sense that now more detailed + information about which helper function was the culprit and where + (uniroot/optimize) this happens +-qqbounds: + + the respective helper functions .BinomCI.nosym, .BinomCI, + .q2kolmogorov capsulate their calls to uniroot / optimize in + individual try-catches (instead of / on top of the one in + qqbounds itself) so that in case of several evaluations (e.g. in + pointwise CIs) at least a subset of valid points is produced. + In addition the search interval is now more flexible: it is bound + away from 0 below and from the upper bound from above, and this + bound moves to the respective lower/upper bounds in up to 20 trials. + Also, the search interval for .q2kolmogorov if argument 'exact' is + TRUE (i.e., if pKolmogorov2x is called) has been refined. This + should make the simultaneous intervals more stable. + + re-included faster right-tail approximation in C-code K(int n, double d) + included from R-Core (was commented out there) [ks.c in folder src in + tar-ball, ll 153-155] + +############## v 2.5.3 ############## Modified: branches/distr-2.6/pkg/distr/man/0distr-package.Rd =================================================================== --- branches/distr-2.6/pkg/distr/man/0distr-package.Rd 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distr/man/0distr-package.Rd 2014-08-10 12:41:00 UTC (rev 949) @@ -336,6 +336,11 @@ S4 Classes for Distributions, \emph{R News}, \emph{6}(2), 2-6. \url{http://CRAN.R-project.org/doc/Rnews/Rnews_2006-2.pdf} +P. Ruckdeschel and M. Kohl (2014): + General purpose convolution algorithm for distributions + in S4-Classes by means of FFT. \emph{J. Statist. Softw.} + \bold{59}(4): 1-25. + a vignette for packages \pkg{distr}, \pkg{distrSim}, \pkg{distrTEst}, and \pkg{distrEx} is included into the mere documentation package \pkg{distrDoc} and may be called by Modified: branches/distr-2.6/pkg/distr/man/ConvPow.Rd =================================================================== --- branches/distr-2.6/pkg/distr/man/ConvPow.Rd 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distr/man/ConvPow.Rd 2014-08-10 12:41:00 UTC (rev 949) @@ -91,11 +91,10 @@ } \references{ -Kohl, M., Ruckdeschel, P., Stabla, T. (2005): +Kohl, M., Ruckdeschel, P., (2014): General purpose convolution algorithm for distributions - in S4-Classes by means of FFT. - Technical report, Feb. 2005. Also available in -\url{http://www.uni-bayreuth.de/departments/math/org/mathe7/RUCKDESCHEL/pubs/comp.pdf} + in S4-Classes by means of FFT. \emph{J. Statist. Softw.} + \bold{59}(4): 1-25. } \concept{convolution for distributions} Modified: branches/distr-2.6/pkg/distr/man/operators-methods.Rd =================================================================== --- branches/distr-2.6/pkg/distr/man/operators-methods.Rd 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distr/man/operators-methods.Rd 2014-08-10 12:41:00 UTC (rev 949) @@ -335,6 +335,13 @@ 1.2 ^ N abs(N) ^ 1.3 } +\references{ +Ruckdeschel, P., Kohl, M.(2014): + General purpose convolution algorithm for distributions + in S4-Classes by means of FFT. \emph{J. Statist. Softw.} + \bold{59}(4): 1-25. +} + \keyword{math} \keyword{distribution} \keyword{arith} Modified: branches/distr-2.6/pkg/distr/vignettes/newDistributions.Rnw =================================================================== --- branches/distr-2.6/pkg/distr/vignettes/newDistributions.Rnw 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distr/vignettes/newDistributions.Rnw 2014-08-10 12:41:00 UTC (rev 949) @@ -390,14 +390,13 @@ \begin{thebibliography}{2} \bibitem{K:R:S:04} -Kohl M., Ruckdeschel P. and Stabla T. +Ruckdeschel P. and Kohl, M. (2014): \newblock {General Purpose Convolution Algorithm for Distributions in S4-Classes by means of FFT}. -\newblock unpublished manual +\newblock {\em J. Statist. Software\/}, {\bf 59}(4): 1--25. - \bibitem{R:K:S:C:04} -Ruckdeschel P., Kohl M., Stabla T., and Camphausen F. +Ruckdeschel P., Kohl M., Stabla T., and Camphausen F. (2006): \newblock {S4 Classes for Distributions.} \newblock {\em R-News\/}, {\bf 6}(2): 10--13. \newblock http://CRAN.R-project.org/doc/Rnews/Rnews\_2006-2.pdf Modified: branches/distr-2.6/pkg/distrDoc/inst/CITATION =================================================================== --- branches/distr-2.6/pkg/distrDoc/inst/CITATION 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distrDoc/inst/CITATION 2014-08-10 12:41:00 UTC (rev 949) @@ -18,3 +18,23 @@ pdf = "http://CRAN.R-project.org/doc/Rnews/Rnews_2006-2.pdf", textVersion = paste("Ruckdeschel, P., Kohl, M., Stabla, T., & Camphausen, F. (2006)", "S4 Classes for Distributions")) + +citEntry(entry = "Article", + title = "General Purpose Convolution Algorithm in {S}4 Classes by Means of FFT", + author = personList(as.person("Peter Ruckdeschel"), + as.person("Matthias Kohl")), + journal = "Journal of Statistical Software", + year = "2014", + volume = "59", + number = "4", + pages = "1--25", + url = "http://www.jstatsoft.org/v59/i04/", + textVersion = + paste("Peter Ruckdeschel, Matthias Kohl (2014).", + "General Purpose Convolution Algorithm in S4 Classes by Means of FFT.", + "Journal of Statistical Software, 59(4), 1-25.", + "URL http://www.jstatsoft.org/v59/i04/."), + header = "If you employ convolution, please also cite:" +) + + \ No newline at end of file Modified: branches/distr-2.6/pkg/distrDoc/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distrDoc/inst/NEWS 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distrDoc/inst/NEWS 2014-08-10 12:41:00 UTC (rev 949) @@ -8,6 +8,19 @@ information) ############## +v 2.6 +############## + +user-visible CHANGES: + ++ updated CITATION file ++ removed some outdated references from uni-bayreuth ++ updated references in vignette distr.Rnw + +under the hood ++ added svn-properties to distr.Rnw + +############## v 2.5 ############## Modified: branches/distr-2.6/pkg/distrDoc/vignettes/distr.Rnw =================================================================== --- branches/distr-2.6/pkg/distrDoc/vignettes/distr.Rnw 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distrDoc/vignettes/distr.Rnw 2014-08-10 12:41:00 UTC (rev 949) @@ -3564,7 +3564,7 @@ \begin{thebibliography}{8} \bibitem{Beng:03} -Bengtsson H. +Bengtsson H. (2003): \newblock The {R.oo} package - object-oriented programming with references using standard {R} code. \newblock In: Hornik K., Leisch F. and Zeileis A. (Eds.) {\em @@ -3573,43 +3573,43 @@ \newblock Published as http://www.ci.tuwien.ac.at/Conferences/DSC-2003/ \bibitem{Cham:98} -Chambers J.M. +Chambers J.M. (1998): \newblock {\em {Programming with data. A guide to the S language}\/}. \newblock {Springer}. \newblock http://cm.bell-labs.com/stat/Sbook/index.html \bibitem{OOPGent} -Gentleman R. +Gentleman R. (2003): \newblock {\em Object Orientated Programming. Slides of a Short Course held in Auckland\/}. \newblock http://www.stat.auckland.ac.nz/S-Workshop/Gentleman/Methods.pdf \bibitem{MK:05} -Kohl M. +Kohl M. (2005): \newblock {\em Numerical Contributions to the Asymptotic Theory of Robustness\/}. \newblock {Dissertation}, Universit\"at Bayreuth. \newblock See also http://stamats.de/ThesisMKohl.pdf \bibitem{K:R:S:04} -Kohl M., Ruckdeschel P. and Stabla T. -\newblock {General Purpose Convolution Algorithm for Distributions in S4-Classes +Ruckdeschel P. and Kohl, M. (2014): +\newblock {General Purpose Convolution Algorithm for Distributions in S4-Classes by means of FFT}. -\newblock unpublished manual +\newblock {\em J. Statist. Software\/}, {\bf 59}(4): 1--25. \bibitem{NumR:92} -Press W.H., Teukolsky S.A., Vetterling W.T. and Flannery B.P. +Press W.H., Teukolsky S.A., Vetterling W.T. and Flannery B.P. (1992): \newblock {\em {Numerical recipes in C. The art of scientific computing.}\/} \newblock {Cambridge Univ. Press}, 2. Aufl. \bibitem{Ric:88} -Rice J.A. +Rice J.A. (1988): \newblock {\em {Mathematical statistics and data analysis}\/}. \newblock The Wadsworth \& Brooks/Cole Statistics/Probability Series. {Wadsworth \& Brooks/Cole Advanced Books \& Software}, Pacific Grove, California. \bibitem{R:K:S:C:04} -Ruckdeschel P., Kohl M., Stabla T., and Camphausen F. +Ruckdeschel P., Kohl M., Stabla T., and Camphausen F. (2006): \newblock {S4 Classes for Distributions.} \newblock {\em R-News\/}, {\bf 6}(2): 10--13. \newblock http://CRAN.R-project.org/doc/Rnews/Rnews\_2006-2.pdf Modified: branches/distr-2.6/pkg/distrEllipse/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distrEllipse/inst/NEWS 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distrEllipse/inst/NEWS 2014-08-10 12:41:00 UTC (rev 949) @@ -8,6 +8,16 @@ information) ############## +v 2.6 +############## + +under the hood: + ++ removed ::: internal dependencies (within distr-Fam of pkgs) by copying + respective routines + + +############## v 2.5 ############## Modified: branches/distr-2.6/pkg/distrEx/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distrEx/inst/NEWS 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distrEx/inst/NEWS 2014-08-10 12:41:00 UTC (rev 949) @@ -6,6 +6,16 @@ package-individual development, but rather are chosen for the distrXXX family as a whole in order to ease updating "depends" information) + +############## +v 2.6 +############## + +under the hood: ++ used delayedAssign() for assignment of .mv2RobExtremes() to + former package internal constants EULERMASCHERONICONSTANT and + APERYCONSTANT) + ############## v 2.5 Modified: branches/distr-2.6/pkg/distrMod/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distrMod/inst/NEWS 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distrMod/inst/NEWS 2014-08-10 12:41:00 UTC (rev 949) @@ -8,6 +8,38 @@ information) ############## +v 2.6 +############## + +user-visible CHANGES: ++ introduced dropZeroDensity argument to ML estimators + +GENERAL ENHANCEMENTS: + +under the hood: ++ zero dropping (see argument 'dropZeroDensity' above) + --Optimizers like optim require finite values, so get problems when + negative loglikelihood is evaluated, so optionally, and by default, + values with density/likelihood 0 are dropped from optimization ++ removed ::: internal dependencies (within distr-Fam of pkgs) by copying + respective routines ++ qqplot: + * (already there for a while) gains ability to interchange x- and y- + axis by argument 'datax' for compatibility with other qqplots + * gains new methods for object of class "Estimate" (which could also be + seen as "fitted" objects...) ++ returnlevelplot + * similar ++ new .checkEstClassForParamFamily-method to be able to cast an estimator + to a return class specific to the resp. parametric famil + + BUGFIXES: + ++ fixed issue with slot withPosRestr in ParamFamParameter.R ++ fixed issue with check.validity (reported by B.Spangl) ++ fixed some minor issue in existsPIC (in case we get 0 matrix, and less strict tolerance) + +############## v 2.5 ############## Modified: branches/distr-2.6/pkg/distrRmetrics/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distrRmetrics/inst/NEWS 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distrRmetrics/inst/NEWS 2014-08-10 12:41:00 UTC (rev 949) @@ -8,6 +8,12 @@ information) ############## +v 2.6 +############## + +No extra changes this time + +############## v 2.5 ############## Modified: branches/distr-2.6/pkg/distrSim/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distrSim/inst/NEWS 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distrSim/inst/NEWS 2014-08-10 12:41:00 UTC (rev 949) @@ -8,6 +8,12 @@ information) ############## +v 2.6 +############## + +No extra changes this time + +############## v 2.5 ############## Modified: branches/distr-2.6/pkg/distrTEst/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distrTEst/inst/NEWS 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distrTEst/inst/NEWS 2014-08-10 12:41:00 UTC (rev 949) @@ -3,6 +3,12 @@ ###################################################################### ############## +v 2.6 +############## + +No extra changes this time + +############## v 2.5 ############## Modified: branches/distr-2.6/pkg/distrTeach/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distrTeach/inst/NEWS 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distrTeach/inst/NEWS 2014-08-10 12:41:00 UTC (rev 949) @@ -8,6 +8,19 @@ information) ############## +v 2.6 +############## + +user visible changes: + ++ added reference to JSS-paper in help to IllustCLT + +under the hood: + ++ removed ::: internal dependencies (within distr-Fam of pkgs) by copying + respective routines + +############## v 2.5 ############## Modified: branches/distr-2.6/pkg/distrTeach/man/IllustCLT.Rd =================================================================== --- branches/distr-2.6/pkg/distrTeach/man/IllustCLT.Rd 2014-08-08 16:53:55 UTC (rev 948) +++ branches/distr-2.6/pkg/distrTeach/man/IllustCLT.Rd 2014-08-10 12:41:00 UTC (rev 949) @@ -43,6 +43,14 @@ illustrateCLT(Distr = Pois(lambda = 2)+Unif(), len = 20) illustrateCLT.tcl(Distr = Unif(), k = 4, "Unif()") } + +\references{ +Kohl, M., Ruckdeschel, P., (2014): + General purpose convolution algorithm for distributions + in S4-Classes by means of FFT. \emph{J. Statist. Softw.} + \bold{59}(4): 1-25. +} + \keyword{distribution} \keyword{methods} \concept{illustration} From noreply at r-forge.r-project.org Sun Aug 10 14:52:51 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 10 Aug 2014 14:52:51 +0200 (CEST) Subject: [Distr-commits] r950 - branches/distr-2.6/pkg/distr/src Message-ID: <20140810125251.4C8621876D7@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-10 14:52:51 +0200 (Sun, 10 Aug 2014) New Revision: 950 Modified: branches/distr-2.6/pkg/distr/src/ks.c Log: [distr] commented back in the faster right-tail approximation in R-Core C-Code for kolmogoroff distribution Modified: branches/distr-2.6/pkg/distr/src/ks.c =================================================================== --- branches/distr-2.6/pkg/distr/src/ks.c 2014-08-10 12:41:00 UTC (rev 949) +++ branches/distr-2.6/pkg/distr/src/ks.c 2014-08-10 12:52:51 UTC (rev 950) @@ -142,12 +142,18 @@ int k, m, i, j, g, eH, eQ; double h, s, *H, *Q; + /* Change of P. Ruckdeschel w.r.t. the included version + from R-Core : the faster right-tail approximation + omitted there is re-included + */ /* - The faster right-tail approximation is omitted here. + Original comment R-Core: + The faster right-tail approximation is omitted here. + */ s = d*d*n; if(s > 7.24 || (s > 3.76 && n > 99)) return 1-2*exp(-(2.000071+.331/sqrt(n)+1.409/n)*s); - */ + /* end of comment in original R-Core code */ k = (int) (n * d) + 1; m = 2 * k - 1; h = k - n * d; From noreply at r-forge.r-project.org Sun Aug 10 15:02:30 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 10 Aug 2014 15:02:30 +0200 (CEST) Subject: [Distr-commits] r951 - in branches/distr-2.6/pkg/distr: R man Message-ID: <20140810130230.8B86E1876FF@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-10 15:02:30 +0200 (Sun, 10 Aug 2014) New Revision: 951 Modified: branches/distr-2.6/pkg/distr/R/internals-qqplot.R branches/distr-2.6/pkg/distr/R/qqbounds.R branches/distr-2.6/pkg/distr/man/internals-qqplot.Rd Log: [distr] - qqplot: + (already there for a while) gains argument 'debug' to be able to trace where computation of confidence bounds fails; this 'debug' argument has now been enhanced in the sense that now more detailed information about which helper function was the culprit and where (uniroot/optimize) this happens - qqbounds: + the respective helper functions .BinomCI.nosym, .BinomCI, .q2kolmogorov capsulate their calls to uniroot / optimize in individual try-catches (instead of / on top of the one in qqbounds itself) so that in case of several evaluations (e.g. in pointwise CIs) at least a subset of valid points is produced. + the respective helper functions .BinomCI.nosym, .BinomCI, .q2kolmogorov, .q2pw give more detailed information when a try catch happens + In addition the search interval is now more flexible: it is bound away from 0 below and from the upper bound from above, and this bound moves to the respective lower/upper bounds in up to 20 trials. + Also, the search interval for .q2kolmogorov if argument 'exact' is TRUE (i.e., if pKolmogorov2x is called) has been refined. This all should make the simultaneous intervals more stable. Modified: branches/distr-2.6/pkg/distr/R/internals-qqplot.R =================================================================== --- branches/distr-2.6/pkg/distr/R/internals-qqplot.R 2014-08-10 12:52:51 UTC (rev 950) +++ branches/distr-2.6/pkg/distr/R/internals-qqplot.R 2014-08-10 13:02:30 UTC (rev 951) @@ -96,21 +96,43 @@ } -.q2kolmogorov <- function(alpha,n,exact=(n<100)){ ## Kolmogorovstat +.q2kolmogorov <- function(alpha,n,exact=(n<100), silent0 = TRUE){ ## Kolmogorovstat if(is.numeric(alpha)) alpha <- as.vector(alpha) else stop("Level alpha must be numeric.") if(any(is.na(alpha))) stop("Level alpha must not contain missings.") if(exact){ - fct <- function(p0){ - ### from ks.test from package stats: - .pk2(p0,n) -alpha - } - res <- uniroot(fct,lower=0,upper=1)$root*sqrt(n) + fct <- function(p0){ + ### from ks.test from package stats: + .pk2(p0,n) -alpha + } + i <- 0 + oK <- FALSE + del <- 0.01 + while(!oK && i < 20){ + i <- i + 1 + res <- try(uniroot(fct,lower=del,upper=3*(1-del)/sqrt(n))$root*sqrt(n), silent=silent0) + del <- del / 10 + if(!is(res, "try-error")) oK <- TRUE + } }else{ - fct <- function(p0){ - ### from ks.test from package stats: - 1 - .pks2(p0,1e-09)-alpha } - res <- uniroot(fct,lower=1e-12,upper=sqrt(n))$root + fct <- function(p0){ + ### from ks.test from package stats: + 1 - .pks2(p0,1e-09)-alpha } + i <- 0 + oK <- FALSE + while(!oK && i < 20){ + i <- i + 1 + res <- try(uniroot(fct,lower=del,upper=3*(1-del))$root, silent=silent0) + del <- del / 10 + if(!is(res, "try-error")){ + oK <- TRUE + }else{ + if(!silent0){ + cat("Problem in uniroot in .q2kolmogorov:\nSearch bounds were") + print(c(lower=del,upper=sqrt(n)*(1-del))) + } + } + } } return(res) } @@ -128,26 +150,87 @@ } -.BinomCI <- function(x,p.b,D,n,alpha){ +.BinomCI <- function(x,p.b,D,n,alpha,silent0 = TRUE){ if(length(x)==0) return(NA) - res <- sapply(1:length(x), function(i) uniroot(.BinomCI.in, - lower=0, upper=sqrt(n)*max(x[i],n-x[i])+1, - p.bi = p.b[i], x.i = x[i], del.i = 0, - D.i = D, n.i = n, alpha.i = alpha, tol = 1e-9)$root) + res <- sapply(1:length(x), + function(i){ + .nm.i <- sqrt(n)*max(x[i],n-x[i]) + 1 + .fct.i <- function(t){ + .BinomCI.in(t, p.bi = p.b[i], x.i = x[i], del.i = 0, + D.i = D, n.i = n, alpha.i = alpha) + } + ii <- 0 + oK <- FALSE + del <- 0.01 + while(ii < 20 && !oK){ + ii <- ii + 1 + res0 <- try(uniroot(.fct.i, tol = 1e-9, lower = del, + upper=.nm.i*(1-del))$root, + silent=silent0) + del <- del / 10 + if(!is(res0, "try-error")){ + oK <- TRUE + }else{ + if(!silent0){ + cat("Problem in uniroot in .BinomCI:\nSearch bounds were") + print(c(lower=del,upper=.nm.i*(1-del))) + cat("Further settings:\n") + print(c(i=i,p.bi = p.b[i], x.i = x[i], del=del)) + } + res0 <- NA + } + } + return(res0) + } + ) return(cbind(left=-res, right=res)) } -.BinomCI.nosym <- function(x,p.b,D,n,alpha){ +.BinomCI.nosym <- function(x,p.b,D,n,alpha,silent0 = TRUE){ if(length(x)==0) return(NA) - res0 <- sapply(1:length(x), function(i){ - get.t <- function(del.o, p.bi, x.i) - uniroot(.BinomCI.in, - lower=0, upper=sqrt(n)*max(x.i,n-x.i)+1, - p.bi = p.bi, x.i = x.i, del.i=del.o, - D.i = D, n.i = n, alpha.i = alpha, tol = 1e-9)$root - res <- optimize(get.t, lower=-sqrt(n)*max(x[i],n-x[i])-1, - upper = sqrt(n)*max(x[i],n-x[i])+1, p.bi = p.b[i], - x = x[i], tol = 1e-9) + res0 <- sapply(1:length(x), + function(i){ + .nm.i <- max(x[i],n-x[i])*sqrt(n) + 1 + .fct.i.d <- function(t,del.0){ + .BinomCI.in(t, p.bi = p.b[i], x.i = x[i], del.i = del.0, + D.i = D, n.i = n, alpha.i = alpha) + } + get.t <- function(del.o){ + ii <- 0 + oK <- FALSE + del.l <- 0.01 + while(ii < 20 && !oK){ + ii <- ii + 1 + res0 <- try(uniroot(.fct.i.d, tol = 1e-9, lower = del.l, + upper = .nm.i*(1-del.l), + del.0 = del.o)$root, silent = silent0) + del.l <- del.l / 10 + if(!is(res0, "try-error")){ + oK <- TRUE + }else{ + if(!silent0){ + cat("Problem in uniroot in .BinomCI.nosym:\nSearch bounds were") + print(c(lower=del.l,upper=.nm.i*(1-del.l))) + cat("Further settings:\n") + print(c(i=i,p.bi = p.b[i], x.i = x[i], del.i=del.o, + del.l=del.l)) + } + res0 <- NA + } + } + return(res0) + } + res <- try(optimize(get.t, lower=-.nm.i, upper = .nm.i, tol = 1e-9), + silent = silent0) + if(is(res,"try-error")){ + if(!silent0){ + cat("Problem in optimize in .BinomCI.nosym:\nSearch bounds were") + print(c(lower=-.nm.i,upper=.nm.i)) + cat("Further settings:\n") + print(c(i=i,p.bi = p.b[i], x.i = x[i])) + } + return(c(NA,NA)) + } t.o <- res$objective del <- res$minimum c(left=-t.o+del, right=t.o+del) @@ -156,10 +239,10 @@ } -.q2pw <- function(x,p.b,D,n,alpha,exact=(n<100),nosym=FALSE){ +.q2pw <- function(x,p.b,D,n,alpha,exact=(n<100),nosym=FALSE, silent0=TRUE){ if(exact){ fct <- if(nosym) .BinomCI.nosym else .BinomCI - ro <- fct(x,p.b,D,n,alpha) + ro <- fct(x,p.b,D,n,alpha,silent0) return(ro) } pq <- log(p.b)+log(1-p.b) Modified: branches/distr-2.6/pkg/distr/R/qqbounds.R =================================================================== --- branches/distr-2.6/pkg/distr/R/qqbounds.R 2014-08-10 12:52:51 UTC (rev 950) +++ branches/distr-2.6/pkg/distr/R/qqbounds.R 2014-08-10 13:02:30 UTC (rev 951) @@ -25,8 +25,13 @@ print(l.x) print(c(alpha,n,exact.sCI)) } - c.crit <- if(withConf.sim) try(.q2kolmogorov(alpha,n,exact.sCI), silent=TRUE) else NULL - c.crit.i <- if(withConf.pw) try(.q2pw(x.in,p.r,D,n,alpha,exact.pCI,nosym.pCI),silent=TRUE) else NULL + + silent0 <- !debug + + c.crit <- if(withConf.sim) try(.q2kolmogorov(alpha,n,exact.sCI, silent0), + silent=silent0) else NULL + c.crit.i <- if(withConf.pw) try(.q2pw(x.in,p.r,D,n,alpha,exact.pCI,nosym.pCI, + silent0),silent=silent0) else NULL #print(cbind(c.crit,c.crit.i)) if(debug){ print(str(c.crit)) Modified: branches/distr-2.6/pkg/distr/man/internals-qqplot.Rd =================================================================== --- branches/distr-2.6/pkg/distr/man/internals-qqplot.Rd 2014-08-10 12:52:51 UTC (rev 950) +++ branches/distr-2.6/pkg/distr/man/internals-qqplot.Rd 2014-08-10 13:02:30 UTC (rev 951) @@ -27,11 +27,11 @@ .makeLenAndOrder(x,ord) .BinomCI.in(t,p.bi,x.i, del.i=0,D.i,n.i,alpha.i) -.BinomCI(x,p.b,D,n,alpha) -.BinomCI.nosym(x,p.b,D,n,alpha) +.BinomCI(x,p.b,D,n,alpha, silent0 = TRUE) +.BinomCI.nosym(x,p.b,D,n,alpha, silent0 = TRUE) -.q2kolmogorov(alpha,n,exact=(n<100)) -.q2pw(x,p.b,D,n,alpha,exact=(n<100),nosym=FALSE) +.q2kolmogorov(alpha,n,exact=(n<100), silent0 = TRUE) +.q2pw(x,p.b,D,n,alpha,exact=(n<100),nosym=FALSE, silent0 = TRUE) .confqq(x,D, datax=TRUE, withConf.pw = TRUE, withConf.sim = TRUE, alpha, col.pCI, lty.pCI, lwd.pCI, pch.pCI, cex.pCI, @@ -94,7 +94,9 @@ \item{legend.alpha}{nominal coverage probability} \item{mcl}{arguments in call as a list} \item{qqb0}{precomputed return value of \code{qqbounds}} -\item{debug}{logical; if \code{TRUE} additional output to debug confidence bounds.} +\item{debug}{logical; if \code{TRUE} additional output to debug confidence bounds. } +\item{silent0}{logical; it is used as argument \code{silent} in \code{try}-catches + within this function. } } \details{ From noreply at r-forge.r-project.org Sun Aug 10 16:10:08 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 10 Aug 2014 16:10:08 +0200 (CEST) Subject: [Distr-commits] r952 - in branches/distr-2.6/pkg/distrEx: R inst src Message-ID: <20140810141008.D284B184B7C@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-10 16:10:08 +0200 (Sun, 10 Aug 2014) New Revision: 952 Modified: branches/distr-2.6/pkg/distrEx/R/distrExIntegrate.R branches/distr-2.6/pkg/distrEx/R/moved2RobExtremes.R branches/distr-2.6/pkg/distrEx/inst/NEWS branches/distr-2.6/pkg/distrEx/inst/TOBEDONE branches/distr-2.6/pkg/distrEx/src/GLaw.c Log: [distrEx]: + use particular S3-class "moved2RobExtremeClass" for former package internal constants EULERMASCHERONICONSTANT and APERYCONSTANT + stubs prepared for usage of .Call-Interface in files GLaw.c and distrExIntegrate.R Modified: branches/distr-2.6/pkg/distrEx/R/distrExIntegrate.R =================================================================== --- branches/distr-2.6/pkg/distrEx/R/distrExIntegrate.R 2014-08-10 13:02:30 UTC (rev 951) +++ branches/distr-2.6/pkg/distrEx/R/distrExIntegrate.R 2014-08-10 14:10:08 UTC (rev 952) @@ -44,6 +44,12 @@ A = as.double(A),W = as.double(W), PACKAGE = "distrEx") ### PACKAGE ARGUMENT added P.R. 270507 # dyn.unload("G:/rtest/GLaw.dll") +# +# P.R. 20140810: .Call interface instead of .C interface +# +# erg0 <- .Call("Gauleg", n, eps, PACKAGE="distrEx") +# erg <- matrix(erg0,n,2); colnames(erg) <- c("A","W") +# cbind(A=erg$A, W=erg$W) } Modified: branches/distr-2.6/pkg/distrEx/R/moved2RobExtremes.R =================================================================== --- branches/distr-2.6/pkg/distrEx/R/moved2RobExtremes.R 2014-08-10 13:02:30 UTC (rev 951) +++ branches/distr-2.6/pkg/distrEx/R/moved2RobExtremes.R 2014-08-10 14:10:08 UTC (rev 952) @@ -1,13 +1,18 @@ ################ commands that have moved to RobExtremes -.mv2RobExtremes <- function(){ - cat("\n\n This functionality has moved to package RobExtremes.\n\n") +.mv2RobExtremes <- function(what){ + cat("\n\n", what, gettext(" has moved to package RobExtremes."), + "\n\n") } -kMAD <- function(x,k) .mv2RobExtremes() -Pareto <- function(shape, Min) .mv2RobExtremes() -Pareto <- function(shape, Min) .mv2RobExtremes() -GPareto <- function(loc, scale, shape, location) .mv2RobExtremes() -GEV <- function(loc, scale, shape, location) .mv2RobExtremes() -EULERMASCHERONICONSTANT <- .mv2RobExtremes() -APERYCONSTANT <- .mv2RobExtremes() \ No newline at end of file +kMAD <- function(x,k) .mv2RobExtremes("kMAD") +Pareto <- function(shape, Min) .mv2RobExtremes("Pareto") +GPareto <- function(loc, scale, shape, location) .mv2RobExtremes("GPareto") +GEV <- function(loc, scale, shape, location) .mv2RobExtremes("GEV") + +EULERMASCHERONICONSTANT <- list(NULL) +class(EULERMASCHERONICONSTANT) <- "moved2RobExtremeClass" +APERYCONSTANT <- list(NULL) +class(APERYCONSTANT) <- "moved2RobExtremeClass" +print.moved2RobExtremeClass <- function(x,...) + .mv2RobExtremes("Constants 'EULERMASCHERONICONSTANT' and 'APERYCONSTANT'") Modified: branches/distr-2.6/pkg/distrEx/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distrEx/inst/NEWS 2014-08-10 13:02:30 UTC (rev 951) +++ branches/distr-2.6/pkg/distrEx/inst/NEWS 2014-08-10 14:10:08 UTC (rev 952) @@ -12,9 +12,9 @@ ############## under the hood: -+ used delayedAssign() for assignment of .mv2RobExtremes() to ++ use particular S3-class "moved2RobExtremeClass" for former package internal constants EULERMASCHERONICONSTANT and - APERYCONSTANT) + APERYCONSTANT ############## Modified: branches/distr-2.6/pkg/distrEx/inst/TOBEDONE =================================================================== --- branches/distr-2.6/pkg/distrEx/inst/TOBEDONE 2014-08-10 13:02:30 UTC (rev 951) +++ branches/distr-2.6/pkg/distrEx/inst/TOBEDONE 2014-08-10 14:10:08 UTC (rev 952) @@ -2,4 +2,6 @@ to be done in package distrEx ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -+ control class for controlling the accuracy / methods for integration \ No newline at end of file ++ control class for controlling the accuracy / methods for integration ++ re-do the C-code in folder src using the Call interface + (stubs prepared already in files GLaw.c and distrExIntegrate.R) \ No newline at end of file Modified: branches/distr-2.6/pkg/distrEx/src/GLaw.c =================================================================== --- branches/distr-2.6/pkg/distrEx/src/GLaw.c 2014-08-10 13:02:30 UTC (rev 951) +++ branches/distr-2.6/pkg/distrEx/src/GLaw.c 2014-08-10 14:10:08 UTC (rev 952) @@ -1,5 +1,8 @@ #include #define PI 3.141592653589793 +#include +#include +#include /* constants */ void gauleg(int *n, double *eps, double *A, double *W) { int i,j, m=((*n)+1)/2; double z1,z,pp,p1,p2,p3; @@ -22,3 +25,25 @@ W[(*n)-i]=W[i-1]; } } + +/* P.R. 20140810: Yet to be tested: preparation for .Call - interface + +SEXP Gauleg(SEXP nFromR, SEXP epsFromR) +{ + int i, nx = asInteger(nFromR); + double epsx = asReal(epsFromR); + SEXP A = allocVector(REALSXP, nx); + SEXP W = allocVector(REALSXP, nx); + SEXP AW = PROTECT(allocVector(REALSXP, 2*nx)); + gauleg(nx,epsx,REAL(A),REAL(W)) + for(i=1;i<=n;i++){ + AW[i-1] <- A[i-1] + } + for(i=1;i<=n;i++){ + AW[n+i-1] <- W[i-1] + } + UNPROTECT(1) + return AW; +} + +*/ \ No newline at end of file From noreply at r-forge.r-project.org Sun Aug 10 17:04:38 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 10 Aug 2014 17:04:38 +0200 (CEST) Subject: [Distr-commits] r953 - in branches/distr-2.6/pkg/distrMod: . R inst man Message-ID: <20140810150438.81E9A187563@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-10 17:04:38 +0200 (Sun, 10 Aug 2014) New Revision: 953 Added: branches/distr-2.6/pkg/distrMod/R/checkEstClassForParamFamilyMethods.R branches/distr-2.6/pkg/distrMod/man/internal-methods.Rd Modified: branches/distr-2.6/pkg/distrMod/NAMESPACE branches/distr-2.6/pkg/distrMod/R/AllGeneric.R branches/distr-2.6/pkg/distrMod/R/Estimator.R branches/distr-2.6/pkg/distrMod/R/MCEstimator.R branches/distr-2.6/pkg/distrMod/R/MDEstimator.R branches/distr-2.6/pkg/distrMod/R/MLEstimator.R branches/distr-2.6/pkg/distrMod/inst/NEWS Log: [distrMod] new internal method .checkEstClassForParamFamily-method to be called immediately before returning an Estimate object (in functions Estimator(), MCEstimator(), MDEstimator(), MLEstimator()); this allows to return an object of S4 class specific to the resp. parametric family (by means of S4 method dispatch); this is used in pkg 'RobExtremes' to produce, e.g., objects of class "GEVMCEstimate", i.e. which inherit from both "MCEstimate" and "GEVEstimate", so that a diag-method for "GEVEstimate" becomes available for this class. ... note: for some reason, when only an ANY, ANY-method is provided and this is to be documented in an .Rd-File of docType "methods", we also need an alias for ANY (i.e., with only one argument) --- do not understand this, but ... Modified: branches/distr-2.6/pkg/distrMod/NAMESPACE =================================================================== --- branches/distr-2.6/pkg/distrMod/NAMESPACE 2014-08-10 14:10:08 UTC (rev 952) +++ branches/distr-2.6/pkg/distrMod/NAMESPACE 2014-08-10 15:04:38 UTC (rev 953) @@ -60,7 +60,7 @@ exportMethods("scaleshapename", "scalename", "LogDeriv") exportMethods("coerce", "profile", "locscalename", "scaleshapename<-") exportMethods("mleCalc", "mceCalc") -exportMethods("qqplot", "returnlevelplot") +exportMethods("qqplot", "returnlevelplot", ".checkEstClassForParamFamily") export("distrModMASK") export("trafoEst") export("distrModOptions", "distrModoptions", "getdistrModOption", Modified: branches/distr-2.6/pkg/distrMod/R/AllGeneric.R =================================================================== --- branches/distr-2.6/pkg/distrMod/R/AllGeneric.R 2014-08-10 14:10:08 UTC (rev 952) +++ branches/distr-2.6/pkg/distrMod/R/AllGeneric.R 2014-08-10 15:04:38 UTC (rev 953) @@ -290,3 +290,7 @@ if(!isGeneric("returnlevelplot")){ setGeneric("returnlevelplot", function(x, y, ...) standardGeneric("returnlevelplot")) } +if(!isGeneric(".checkEstClassForParamFamily")){ + setGeneric(".checkEstClassForParamFamily", function(PFam, estimator) + standardGeneric(".checkEstClassForParamFamily")) +} \ No newline at end of file Modified: branches/distr-2.6/pkg/distrMod/R/Estimator.R =================================================================== --- branches/distr-2.6/pkg/distrMod/R/Estimator.R 2014-08-10 14:10:08 UTC (rev 952) +++ branches/distr-2.6/pkg/distrMod/R/Estimator.R 2014-08-10 15:04:38 UTC (rev 953) @@ -144,5 +144,7 @@ estimator at asvar <- asvar estimator at trafo <- list(fct = fct, mat = fctv$mat) - return(estimator) + return(.checkEstClassForParamFamily(ParamFamily,estimator)) } + + Modified: branches/distr-2.6/pkg/distrMod/R/MCEstimator.R =================================================================== --- branches/distr-2.6/pkg/distrMod/R/MCEstimator.R 2014-08-10 14:10:08 UTC (rev 952) +++ branches/distr-2.6/pkg/distrMod/R/MCEstimator.R 2014-08-10 15:04:38 UTC (rev 953) @@ -58,5 +58,5 @@ res <- do.call(.process.meCalcRes, argList) res at completecases <- completecases - return(res) + return(.checkEstClassForParamFamily(ParamFamily,res)) } Modified: branches/distr-2.6/pkg/distrMod/R/MDEstimator.R =================================================================== --- branches/distr-2.6/pkg/distrMod/R/MDEstimator.R 2014-08-10 14:10:08 UTC (rev 952) +++ branches/distr-2.6/pkg/distrMod/R/MDEstimator.R 2014-08-10 15:04:38 UTC (rev 953) @@ -56,6 +56,6 @@ res <- do.call(.process.meCalcRes, argList) res at completecases <- completecases - return(res) + return(.checkEstClassForParamFamily(ParamFamily,res)) } Modified: branches/distr-2.6/pkg/distrMod/R/MLEstimator.R =================================================================== --- branches/distr-2.6/pkg/distrMod/R/MLEstimator.R 2014-08-10 14:10:08 UTC (rev 952) +++ branches/distr-2.6/pkg/distrMod/R/MLEstimator.R 2014-08-10 15:04:38 UTC (rev 953) @@ -57,5 +57,5 @@ res at name <- "Maximum likelihood estimate" res at completecases <- completecases - return(res) + return(.checkEstClassForParamFamily(ParamFamily,res)) } Added: branches/distr-2.6/pkg/distrMod/R/checkEstClassForParamFamilyMethods.R =================================================================== --- branches/distr-2.6/pkg/distrMod/R/checkEstClassForParamFamilyMethods.R (rev 0) +++ branches/distr-2.6/pkg/distrMod/R/checkEstClassForParamFamilyMethods.R 2014-08-10 15:04:38 UTC (rev 953) @@ -0,0 +1,3 @@ +setMethod(".checkEstClassForParamFamily", + signature=signature(PFam="ANY",estimator="ANY"), + function(PFam, estimator) estimator) Modified: branches/distr-2.6/pkg/distrMod/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distrMod/inst/NEWS 2014-08-10 14:10:08 UTC (rev 952) +++ branches/distr-2.6/pkg/distrMod/inst/NEWS 2014-08-10 15:04:38 UTC (rev 953) @@ -30,9 +30,15 @@ seen as "fitted" objects...) + returnlevelplot * similar -+ new .checkEstClassForParamFamily-method to be able to cast an estimator - to a return class specific to the resp. parametric famil - ++ new internal method .checkEstClassForParamFamily-method to be called + immediately before returning an Estimate object (in functions Estimator(), + MCEstimator(), MDEstimator(), MLEstimator()); this allows to return an + object of S4 class specific to the resp. parametric family (by means of + S4 method dispatch); this is used in pkg 'RobExtremes' to produce, e.g., + objects of class "GEVMCEstimate", i.e. which inherit from both + "MCEstimate" and "GEVEstimate", so that a diag-method for + "GEVEstimate" becomes available for this class. + BUGFIXES: + fixed issue with slot withPosRestr in ParamFamParameter.R Added: branches/distr-2.6/pkg/distrMod/man/internal-methods.Rd =================================================================== --- branches/distr-2.6/pkg/distrMod/man/internal-methods.Rd (rev 0) +++ branches/distr-2.6/pkg/distrMod/man/internal-methods.Rd 2014-08-10 15:04:38 UTC (rev 953) @@ -0,0 +1,34 @@ +\name{.checkEstClassForParamFamily-methods} +\docType{methods} +\alias{.checkEstClassForParamFamily} +\alias{.checkEstClassForParamFamily-methods} +\alias{.checkEstClassForParamFamily,ANY-method} +\alias{.checkEstClassForParamFamily,ANY,ANY-method} +\title{ Methods for Function .checkEstClassForParamFamily in Package `distrMod' } + +\description{.checkEstClassForParamFamily-methods} + +\usage{ +.checkEstClassForParamFamily(PFam, estimator) +\S4method{.checkEstClassForParamFamily}{ANY,ANY}(PFam, estimator) +} + +\arguments{ + \item{PFam}{a parametric family. } + \item{estimator}{an estimator. } + } + +\details{ +The respective methods can be used to cast an estimator to +a model-specific subclass with particular methods. +} + +\value{ +The (default) \code{ANY,ANY}-method returns the estimator unchanged. +} +\author{ + Peter Ruckdeschel \email{Peter.Ruckdeschel at itwm.fraunhofer.de} + } + +\keyword{methods} + From noreply at r-forge.r-project.org Sun Aug 10 17:22:52 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 10 Aug 2014 17:22:52 +0200 (CEST) Subject: [Distr-commits] r954 - branches/distr-2.6/pkg/distr/R Message-ID: <20140810152252.D92CC1873CC@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-10 17:22:52 +0200 (Sun, 10 Aug 2014) New Revision: 954 Modified: branches/distr-2.6/pkg/distr/R/qqplot.R Log: [distr] captured output in qqplot by invisible() Modified: branches/distr-2.6/pkg/distr/R/qqplot.R =================================================================== --- branches/distr-2.6/pkg/distr/R/qqplot.R 2014-08-10 15:04:38 UTC (rev 953) +++ branches/distr-2.6/pkg/distr/R/qqplot.R 2014-08-10 15:22:52 UTC (rev 954) @@ -114,6 +114,6 @@ } } } - return(c(ret,qqb)) + return(invisible(c(ret,qqb))) }) From noreply at r-forge.r-project.org Sun Aug 10 17:35:38 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 10 Aug 2014 17:35:38 +0200 (CEST) Subject: [Distr-commits] r955 - in branches/distr-2.6/pkg/distrMod: R man Message-ID: <20140810153538.54BC8187580@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-10 17:35:37 +0200 (Sun, 10 Aug 2014) New Revision: 955 Modified: branches/distr-2.6/pkg/distrMod/R/qqplot.R branches/distr-2.6/pkg/distrMod/man/qqplot.Rd Log: [distrMod]: -qqplot: + new method for y being of class "Estimate" (which could also be seen as "fitted" objects...); + output for all methods is captured by invisible() Modified: branches/distr-2.6/pkg/distrMod/R/qqplot.R =================================================================== --- branches/distr-2.6/pkg/distrMod/R/qqplot.R 2014-08-10 15:22:52 UTC (rev 954) +++ branches/distr-2.6/pkg/distrMod/R/qqplot.R 2014-08-10 15:35:37 UTC (rev 955) @@ -216,7 +216,7 @@ } } } - return(c(ret,qqb)) + return(invisible(c(ret,qqb))) }) ## into distrMod @@ -236,7 +236,36 @@ if(!is(yD,"UnivariateDistribution")) stop("Not yet implemented.") - return(do.call(getMethod("qqplot", signature(x="ANY", y="UnivariateDistribution")), - args=mcl)) + return(invisible(do.call(getMethod("qqplot", signature(x="ANY", y="UnivariateDistribution")), + args=mcl))) }) +setMethod("qqplot", 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(invisible(do.call(getMethod("qqplot", signature(x="ANY", y="ProbFamily")), + args=mcl))) + }) + Modified: branches/distr-2.6/pkg/distrMod/man/qqplot.Rd =================================================================== --- branches/distr-2.6/pkg/distrMod/man/qqplot.Rd 2014-08-10 15:22:52 UTC (rev 954) +++ branches/distr-2.6/pkg/distrMod/man/qqplot.Rd 2014-08-10 15:35:37 UTC (rev 955) @@ -30,10 +30,16 @@ withConf.pw = withConf, withConf.sim = withConf, plot.it = TRUE, xlab = deparse(substitute(x)), ylab = deparse(substitute(y)), ...) +\S4method{qqplot}{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{qqplot} \alias{qqplot-methods} \alias{qqplot,ANY,ProbFamily-method} +\alias{qqplot,ANY,Estimate-method} \alias{qqplot,ANY,UnivariateDistribution-method} \arguments{ @@ -115,10 +121,14 @@ } \description{ We generalize function \code{\link[stats:qqnorm]{qqplot}} from package \pkg{stats} to - be applicable to distribution and probability model objects. In this context, + be applicable to distribution and probability model objects, as well as + to estimate objects. In this context, \code{qqplot} produces a QQ plot of data (argument \code{x}) against - a (model) distribution. - Graphical parameters may be given as arguments to \code{qqplot}. + a (model) distribution. If the second argument is of class \code{'Estimate'}, + \code{qqplot} looks at the \code{estimate.call}-slot and checks whether + it can use an argument \code{ParamFamily} to conclude on the model + distribution. Graphical parameters may be given as arguments to + \code{qqplot}. } \value{ As for function \code{\link[stats:qqnorm]{qqplot}} from package \pkg{stats}: a @@ -143,6 +153,17 @@ the \code{\dots} argument, all arguments valid for \code{signature(x = "ANY", y = "UnivariateDistribution")} are also valid for this signature.} +\item{qqplot}{\code{signature(x = "ANY", y = "Estimate")}: +produces a QQ 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.} } } @@ -162,8 +183,12 @@ intervals. } \examples{ -qqplot(r(Norm(15,sqrt(30)))(40), Chisq(df=15)) -qqplot(r(Norm(15,sqrt(30)))(40), NormLocationFamily()) +set.seed(123) +x <- rnorm(40,mean=15,sd=30) +qqplot(x, Chisq(df=15)) +qqplot(x, NormLocationScaleFamily()) +mlE <- MLEstimator(x, NormLocationScaleFamily()) +qqplot(x, mlE) } \keyword{hplot} \keyword{distribution} From noreply at r-forge.r-project.org Sun Aug 10 17:53:07 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 10 Aug 2014 17:53:07 +0200 (CEST) Subject: [Distr-commits] r956 - in branches/distr-2.6/pkg/distrMod: R man Message-ID: <20140810155308.02634186E70@r-forge.r-project.org> 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} From noreply at r-forge.r-project.org Sun Aug 10 19:00:14 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 10 Aug 2014 19:00:14 +0200 (CEST) Subject: [Distr-commits] r957 - branches/distr-2.6/pkg/distr/R Message-ID: <20140810170014.A18671876CB@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-10 19:00:14 +0200 (Sun, 10 Aug 2014) New Revision: 957 Modified: branches/distr-2.6/pkg/distr/R/qqbounds.R Log: [distr]: qqbounds additional information in debug mode Modified: branches/distr-2.6/pkg/distr/R/qqbounds.R =================================================================== --- branches/distr-2.6/pkg/distr/R/qqbounds.R 2014-08-10 15:53:07 UTC (rev 956) +++ branches/distr-2.6/pkg/distr/R/qqbounds.R 2014-08-10 17:00:14 UTC (rev 957) @@ -18,12 +18,17 @@ p.l <- p.l(D)(x.in) l.x <- length(x.in) if(debug){ + cat("the partition into discrete mass points and cont. points gives\n") print(SI) + cat("x.in is\n") print(x.in) + cat("number of mass points:\n") print(sum(SI.in)) + cat("p.r and p.l\n") print(cbind(p.r,p.l)) + cat("length of l.x\n") print(l.x) - print(c(alpha,n,exact.sCI)) + print(c(alpha=alpha,n=n,exact.sCI=exact.sCI)) } silent0 <- !debug @@ -34,7 +39,9 @@ silent0),silent=silent0) else NULL #print(cbind(c.crit,c.crit.i)) if(debug){ + cat("returned c.crit is\n") print(str(c.crit)) + cat("returned c.crit.i is\n") print(str(c.crit.i)) } te.i <- withConf.pw & !is(c.crit.i,"try-error") From noreply at r-forge.r-project.org Sun Aug 10 19:26:22 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 10 Aug 2014 19:26:22 +0200 (CEST) Subject: [Distr-commits] r958 - in branches/distr-2.6/pkg/distrMod: R inst man Message-ID: <20140810172622.8FC5B18749F@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-10 19:26:21 +0200 (Sun, 10 Aug 2014) New Revision: 958 Modified: branches/distr-2.6/pkg/distrMod/R/qqplot.R branches/distr-2.6/pkg/distrMod/R/returnlevelplot.R branches/distr-2.6/pkg/distrMod/inst/NEWS branches/distr-2.6/pkg/distrMod/man/qqplot.Rd branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd Log: [distrMod] fixed issue with returnlevelplot discovered by B. Spangl -- points had not been ordered; qqplot and returnlevelplot both have an additional argument added.points.CI to allow for additional evaluation points for the confidence intervals in the range of the seen data Modified: branches/distr-2.6/pkg/distrMod/R/qqplot.R =================================================================== --- branches/distr-2.6/pkg/distrMod/R/qqplot.R 2014-08-10 17:00:14 UTC (rev 957) +++ branches/distr-2.6/pkg/distrMod/R/qqplot.R 2014-08-10 17:26:21 UTC (rev 958) @@ -74,6 +74,7 @@ lwd.sCI = 2, ## line width for the simultaneous CI pch.sCI = par("pch"),## symbol for points (for discrete mass points) in simultaneous CI cex.sCI = par("cex"),## magnification factor for points (for discrete mass points) in simultaneous CI + added.points.CI = TRUE, ## should the CIs be drawn through additional points? cex.pch = par("cex"),## magnification factor for the plotted symbols col.pch = par("col"),## color for the plotted symbols cex.lbl = par("cex"),## magnification factor for the plotted observation labels @@ -100,6 +101,7 @@ mcl$withSweave <- NULL mcl$mfColRow <- NULL mcl$debug <- NULL + mcl$added.points.CI <- NULL force(x) @@ -182,6 +184,13 @@ if(#is(y,"AbscontDistribution")&& withConf){ xy <- unique(sort(c(x,yc.o))) + if(added.points.CI){ + mxy <- min(xy); Mxy <- max(xy) + mnxy <- (mxy+Mxy)/2 + sxy <- (Mxy-mxy)/2*1.1 + xyn <- seq(mnxy-sxy,mnxy+sxy,length.out=500) + xy <- unique(sort(c(xy,xyn))) + } xy <- xy[!.NotInSupport(xy,y)] lxy <- length(xy) if(is(y,"DiscreteDistribution")){ Modified: branches/distr-2.6/pkg/distrMod/R/returnlevelplot.R =================================================================== --- branches/distr-2.6/pkg/distrMod/R/returnlevelplot.R 2014-08-10 17:00:14 UTC (rev 957) +++ branches/distr-2.6/pkg/distrMod/R/returnlevelplot.R 2014-08-10 17:26:21 UTC (rev 958) @@ -48,6 +48,7 @@ lwd.sCI = 2, ## line width for the simultaneous CI pch.sCI = par("pch"),## symbol for points (for discrete mass points) in simultaneous CI cex.sCI = par("cex"),## magnification factor for points (for discrete mass points) in simultaneous CI + added.points.CI = TRUE, ## should the CIs be drawn through additional points? cex.pch = par("cex"),## magnification factor for the plotted symbols col.pch = par("col"),## color for the plotted symbols cex.lbl = par("cex"),## magnification factor for the plotted observation labels @@ -80,13 +81,15 @@ mcl$mfColRow <- NULL mcl$type <-NULL mcl$debug <- NULL + mcl$added.points.CI <- NULL force(x) - xj <- x - if(any(.isReplicated(x))) + xj <- sort(x) + if(any(.isReplicated(x))&&jit.fac>0) xj[.isReplicated(x)] <- jitter(x[.isReplicated(x)], factor=jit.fac) + xj <- sort(xj) ord.x <- order(xj) p2rl <- function(pp){ @@ -94,7 +97,7 @@ return(if(MaxOrPOT=="Max") -1/log(pp) else 1/(1-pp)/npy) } - pp <- ppoints(n) + pp <- ppoints(length(xj)) yc.o <- q(y)(pp) ycl <- p2rl(yc.o) @@ -108,15 +111,15 @@ rxymean <- (max(xyall)+min(xyall))/2 xyallc <- seq(from=rxymean-rxyall,to=rxymean+rxyall, length.out=300) - print(xyallc) +# print(xyallc) pxyall <- p(y)(xyallc) - print(pxyall) +# print(pxyall) pxyallc <- p2rl(xyallc) xyallc <- xyallc[pxyall>0.00001 & pxyall<0.99999] pxyallc <- pxyallc[pxyall>0.00001 & pxyall<0.99999] - print(cbind(pxyallc,xyallc)) +# print(cbind(pxyallc,xyallc)) if("support" %in% names(getSlots(class(y)))) ycl <- sort(jitter(ycl, factor=jit.fac)) @@ -208,7 +211,12 @@ qqb <- NULL if(#is(y,"AbscontDistribution")&& withConf){ - xy <- unique(sort(c(x,yc.o))) + + if(added.points.CI){ + xy <- unique(sort(c(x,xj,xyallc,yc.o))) + }else{ + xy <- unique(sort(c(x,xj,yc.o))) + } xy <- xy[!.NotInSupport(xy,y)] lxy <- length(xy) if(is(y,"DiscreteDistribution")){ @@ -243,7 +251,7 @@ qqb0=qqb, debug = debug) } }} - return(c(ret,qqb)) + return(invisible(c(ret,qqb))) }) ## into distrMod @@ -255,16 +263,16 @@ 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)) + if(missing(xlab)) mc$xlab <- paste(gettext("Return Level of"), as.character(deparse(mc$x))) + if(missing(ylab)) mc$ylab <- paste(gettext("Return Period at"), as.character(deparse(mc$y))) mcl <- as.list(mc)[-1] mcl$y <- yD <- y at distribution if(!is(yD,"UnivariateDistribution")) stop("Not yet implemented.") - return(do.call(getMethod("returnlevelplot", signature(x="ANY", y="UnivariateDistribution")), - args=mcl)) + return(invisible(do.call(getMethod("returnlevelplot", signature(x="ANY", y="UnivariateDistribution")), + args=mcl))) }) setMethod("returnlevelplot", signature(x = "ANY", @@ -275,8 +283,7 @@ 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)) + if(missing(xlab)) mc$xlab <- paste(gettext("Return Level of"), as.character(deparse(mc$x))) mcl <- as.list(mc)[-1] param <- ParamFamParameter(main=untransformed.estimate(y), nuisance=nuisance(y), @@ -292,6 +299,8 @@ PFam0 <- modifyModel(PFam, param) mcl$y <- PFam0 - return(do.call(getMethod("returnlevelplot", signature(x="ANY", y="ProbFamily")), - args=mcl)) + if(missing(ylab)) mc$ylab <- paste(gettext("Return Period at fitted"), name(PFam0)) + + return(invisible(do.call(getMethod("returnlevelplot", signature(x="ANY", y="ProbFamily")), + args=mcl))) }) Modified: branches/distr-2.6/pkg/distrMod/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distrMod/inst/NEWS 2014-08-10 17:00:14 UTC (rev 957) +++ branches/distr-2.6/pkg/distrMod/inst/NEWS 2014-08-10 17:26:21 UTC (rev 958) @@ -28,6 +28,8 @@ axis by argument 'datax' for compatibility with other qqplots * gains new methods for object of class "Estimate" (which could also be seen as "fitted" objects...) + * additional argument added.points.CI to allow for additional evaluation + points for the confidence intervals in the range of the seen data + returnlevelplot * similar + new internal method .checkEstClassForParamFamily-method to be called @@ -44,7 +46,7 @@ + fixed issue with slot withPosRestr in ParamFamParameter.R + fixed issue with check.validity (reported by B.Spangl) + fixed some minor issue in existsPIC (in case we get 0 matrix, and less strict tolerance) - ++ fixed issue with returnlevelplot discovered by B. Spangl -- points had not been ordered ############## v 2.5 ############## Modified: branches/distr-2.6/pkg/distrMod/man/qqplot.Rd =================================================================== --- branches/distr-2.6/pkg/distrMod/man/qqplot.Rd 2014-08-10 17:00:14 UTC (rev 957) +++ branches/distr-2.6/pkg/distrMod/man/qqplot.Rd 2014-08-10 17:26:21 UTC (rev 958) @@ -16,7 +16,7 @@ col.pCI = "orange", lty.pCI = 3, lwd.pCI = 2, pch.pCI = par("pch"), cex.pCI = par("cex"), col.sCI = "tomato2", lty.sCI = 4, lwd.sCI = 2, pch.sCI = par("pch"), - cex.sCI = par("cex"), + cex.sCI = par("cex"), added.points.CI = TRUE, cex.pch = par("cex"), col.pch = par("col"), cex.lbl = par("cex"), col.lbl = par("col"), adj.lbl = NULL, alpha.trsp = NA, jit.fac = 0, @@ -92,6 +92,8 @@ \item{pch.sCI}{symbol for points (for discrete mass points) in simultaneous CI} \item{cex.sCI}{magnification factor for points (for discrete mass points) in simultaneous CI} +\item{added.points.CI}{logical; should CIs be plotted through additional points + (and not only through data points)? } \item{cex.pch}{magnification factor for the plotted symbols} \item{col.pch}{color for the plotted symbols} \item{cex.lbl}{magnification factor for the plotted observation labels} Modified: branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd =================================================================== --- branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd 2014-08-10 17:00:14 UTC (rev 957) +++ branches/distr-2.6/pkg/distrMod/man/returnlevelplot.Rd 2014-08-10 17:26:21 UTC (rev 958) @@ -18,7 +18,7 @@ col.pCI = "orange", lty.pCI = 3, lwd.pCI = 2, pch.pCI = par("pch"), cex.pCI = par("cex"), col.sCI = "tomato2", lty.sCI = 4, lwd.sCI = 2, pch.sCI = par("pch"), - cex.sCI = par("cex"), + cex.sCI = par("cex"), added.points.CI = TRUE, cex.pch = par("cex"), col.pch = par("col"), cex.lbl = par("cex"), col.lbl = par("col"), adj.lbl = NULL, alpha.trsp = NA, jit.fac = 0, @@ -101,6 +101,8 @@ \item{pch.sCI}{symbol for points (for discrete mass points) in simultaneous CI} \item{cex.sCI}{magnification factor for points (for discrete mass points) in simultaneous CI} +\item{added.points.CI}{logical; should CIs be plotted through additional points + (and not only through data points)? } \item{cex.pch}{magnification factor for the plotted symbols} \item{col.pch}{color for the plotted symbols} \item{cex.lbl}{magnification factor for the plotted observation labels} From noreply at r-forge.r-project.org Tue Aug 12 14:45:39 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 12 Aug 2014 14:45:39 +0200 (CEST) Subject: [Distr-commits] r959 - in branches/distr-2.6/pkg: distr/R distrMod/R Message-ID: <20140812124539.E2E41187168@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-12 14:45:39 +0200 (Tue, 12 Aug 2014) New Revision: 959 Modified: branches/distr-2.6/pkg/distr/R/internalUtils.R branches/distr-2.6/pkg/distrMod/R/0distrModUtils.R Log: [distr,distrMod] modified treatment of NULL in .fillList-utility Modified: branches/distr-2.6/pkg/distr/R/internalUtils.R =================================================================== --- branches/distr-2.6/pkg/distr/R/internalUtils.R 2014-08-10 17:26:21 UTC (rev 958) +++ branches/distr-2.6/pkg/distr/R/internalUtils.R 2014-08-12 12:45:39 UTC (rev 959) @@ -1236,19 +1236,21 @@ .List <- function(list0) if(is.list(list0)) list0 else list(list0) .fillList <- function(list0, len = length(list0)){ + if(is.null(list0)) return(vector("list",len)) list0 <- .List(list0) if(len == length(list0)) return(list0) i <- 0 ll0 <- length(list0) li0 <- vector("list",len) - if(ll0) - while(i < len){ - j <- 1 + ( i %% ll0) - i <- i + 1 - li0[[i]] <- list0[[j]] + if(ll0){ + while(i < len){ + j <- 1 + ( i %% ll0) + i <- i + 1 + li0[[i]] <- list0[[j]] + } } - return(li0) + return(li0) } #------------------------------------------------------------------------------ Modified: branches/distr-2.6/pkg/distrMod/R/0distrModUtils.R =================================================================== --- branches/distr-2.6/pkg/distrMod/R/0distrModUtils.R 2014-08-10 17:26:21 UTC (rev 958) +++ branches/distr-2.6/pkg/distrMod/R/0distrModUtils.R 2014-08-12 12:45:39 UTC (rev 959) @@ -430,6 +430,7 @@ .List <- function(list0) if(is.list(list0)) list0 else list(list0) .fillList <- function(list0, len = length(list0)){ + if(is.null(list0)) return(vector("list",len)) list0 <- .List(list0) if(len == length(list0)) return(list0) From noreply at r-forge.r-project.org Thu Aug 14 18:05:28 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 14 Aug 2014 18:05:28 +0200 (CEST) Subject: [Distr-commits] r960 - in branches/distr-2.6/pkg/distr: . R inst man Message-ID: <20140814160528.1B80118769D@r-forge.r-project.org> Author: stamats Date: 2014-08-14 18:05:27 +0200 (Thu, 14 Aug 2014) New Revision: 960 Added: branches/distr-2.6/pkg/distr/R/EmpiricalDistribution.R branches/distr-2.6/pkg/distr/man/EmpiricalDistribution.Rd Modified: branches/distr-2.6/pkg/distr/NAMESPACE branches/distr-2.6/pkg/distr/inst/NEWS branches/distr-2.6/pkg/distr/man/DiscreteDistribution.Rd Log: added generating function EmpiricalDistribution which provide a simple wrapper to function DiscreteDistribution Modified: branches/distr-2.6/pkg/distr/NAMESPACE =================================================================== --- branches/distr-2.6/pkg/distr/NAMESPACE 2014-08-12 12:45:39 UTC (rev 959) +++ branches/distr-2.6/pkg/distr/NAMESPACE 2014-08-14 16:05:27 UTC (rev 960) @@ -1,100 +1,101 @@ -useDynLib("distr") -import("methods") -import("stats") -importFrom("graphics", "plot") -importFrom("sfsmisc", "D1ss") -import("startupmsg") -import("SweaveListingUtils") - -export("Beta", "Binom", "Cauchy", "Chisq", - "Dirac","Exp", "DExp", "Fd", "Gammad", - "Geom", "Hyper", "Lnorm", "Logis", - "Nbinom", "Norm", "Pois", "RtoDPQ", - "RtoDPQ.d", "Td", "Unif", "Weibull", "Arcsine", - "distroptions", "getdistrOption", "simplifyr", - "Lattice", "DiscreteDistribution", - "LatticeDistribution", "EuclideanSpace", "Reals", - "Naturals", "standardMethods", - "distrARITH", "distrMASK", "getLabel", "devNew") -export("AbscontDistribution") -export("DistrList", "UnivarDistrList") -export("makeAbscontDistribution") -exportClasses("rSpace", "EuclideanSpace", "Reals", - "Naturals") -exportClasses("Parameter") -exportClasses("OptionalParameter", "OptionalMatrix") -exportClasses("BetaParameter", "BinomParameter", - "CauchyParameter", "ChisqParameter", - "DiracParameter", "ExpParameter", - "FParameter", "GammaParameter", - "HyperParameter", "GeomParameter", - "LogisParameter", "LnormParameter", - "NbinomParameter", "NormParameter", - "PoisParameter", "TParameter", - "UnifParameter", "WeibullParameter", - "UniNormParameter") -exportClasses("Distribution") -exportClasses("UnivariateDistribution", "AbscontDistribution", - "DiscreteDistribution", "LatticeDistribution", - "AffLinAbscontDistribution", "AffLinDiscreteDistribution", - "AffLinLatticeDistribution", "AffLinDistribution", "Lattice", - "Beta", "Binom", "Cauchy", "Chisq", "Dirac", - "DExp", "Exp", "Fd", "Gammad", "Geom", - "Hyper", "Logis", "Lnorm", "Nbinom", "Norm", - "Pois", "Td", "Unif", "Weibull", "Arcsine", - "ExpOrGammaOrChisq") -exportClasses("UnivDistrListOrDistribution") -exportClasses("CompoundDistribution") -exportClasses("DistrList", - "UnivarDistrList") -exportClasses("OptionalNumeric", "PosSemDefSymmMatrix", - "PosDefSymmMatrix", - "Symmetry", "DistributionSymmetry", - "NoSymmetry", "EllipticalSymmetry", "SphericalSymmetry", - "DistrSymmList") -exportMethods("Max", "Max<-", "Min", "Min<-", "d", "df", - "df<-", "df1", "df1<-", "df2", - "df2<-", "dimension", "dimension<-", "name", - "name<-", "img", "k", "k<-", - "lambda", "lambda<-", "liesIn", "location", - "location<-", "m", "m<-", "mean", - "mean<-", "meanlog", "meanlog<-", "n", - "n<-", "ncp", "ncp<-", "p", "param", - "prob", "prob<-", "q", "r", "rate", "p.l", "q.r", - "rate<-", "scale", "scale<-", "sd", "sd<-", - "sdlog", "sdlog<-", "shape", "shape<-", - "shape1", "shape1<-", "shape2", "shape2<-", - "size", "size<-", "support", "initialize", - "print", "plot", "+", "-", "/", "*", "coerce", - "Math", "log", "log10", "gamma", "lgamma", "digamma", - "dim", "show", "convpow", "pivot", "sign", - "lattice", "width", "Length", "pivot<-", - "width<-", "Length<-", "liesInSupport", - "isOldVersion", "conv2NewVersion", "gaps", - "gaps<-", "setgaps", "getLow", "getUp") -exportClasses("UnivarMixingDistribution", - "UnivarLebDecDistribution", - "AffLinUnivarLebDecDistribution", - "AcDcLcDistribution") -exportMethods("mixCoeff", "mixCoeff<-", "mixDistr", "mixDistr<-", - "discretePart", "discretePart<-", "acPart", "acPart<-", - "discreteWeight", "discreteWeight<-", "acWeight", "acWeight<-", - "p.discrete", "d.discrete", "q.discrete", "r.discrete", - "p.ac", "d.ac", "q.ac", "r.ac") -exportMethods("decomposePM", "simplifyD", "showobj") -exportMethods("Truncate","Minimum","Maximum","Huberize") -exportMethods("solve", "sqrt") -exportMethods("type", "SymmCenter", "Symmetry", ".logExact", ".lowerExact") -export("UnivarMixingDistribution", "UnivarLebDecDistribution") -export("RtoDPQ.LC", "flat.LCD", "flat.mix") -exportMethods("abs","exp","^") -exportMethods("NumbOfSummandsDistr","SummandsDistr") -export("CompoundDistribution") -export("PosDefSymmMatrix","PosSemDefSymmMatrix") -export("NoSymmetry", "EllipticalSymmetry", "SphericalSymmetry", - "DistrSymmList") -export("qqbounds","igamma") -exportMethods("qqplot") -export(".isEqual",".isEqual01", ".inArgs", ".fillList", - ".presubs", ".makeLenAndOrder", ".DistrCollapse") +useDynLib("distr") +import("methods") +import("stats") +importFrom("graphics", "plot") +importFrom("sfsmisc", "D1ss") +import("startupmsg") +import("SweaveListingUtils") + +export("Beta", "Binom", "Cauchy", "Chisq", + "Dirac","Exp", "DExp", "Fd", "Gammad", + "Geom", "Hyper", "Lnorm", "Logis", + "Nbinom", "Norm", "Pois", "RtoDPQ", + "RtoDPQ.d", "Td", "Unif", "Weibull", "Arcsine", + "distroptions", "getdistrOption", "simplifyr", + "Lattice", "DiscreteDistribution", + "EmpiricalDistribution", + "LatticeDistribution", "EuclideanSpace", "Reals", + "Naturals", "standardMethods", + "distrARITH", "distrMASK", "getLabel", "devNew") +export("AbscontDistribution") +export("DistrList", "UnivarDistrList") +export("makeAbscontDistribution") +exportClasses("rSpace", "EuclideanSpace", "Reals", + "Naturals") +exportClasses("Parameter") +exportClasses("OptionalParameter", "OptionalMatrix") +exportClasses("BetaParameter", "BinomParameter", + "CauchyParameter", "ChisqParameter", + "DiracParameter", "ExpParameter", + "FParameter", "GammaParameter", + "HyperParameter", "GeomParameter", + "LogisParameter", "LnormParameter", + "NbinomParameter", "NormParameter", + "PoisParameter", "TParameter", + "UnifParameter", "WeibullParameter", + "UniNormParameter") +exportClasses("Distribution") +exportClasses("UnivariateDistribution", "AbscontDistribution", + "DiscreteDistribution", "LatticeDistribution", + "AffLinAbscontDistribution", "AffLinDiscreteDistribution", + "AffLinLatticeDistribution", "AffLinDistribution", "Lattice", + "Beta", "Binom", "Cauchy", "Chisq", "Dirac", + "DExp", "Exp", "Fd", "Gammad", "Geom", + "Hyper", "Logis", "Lnorm", "Nbinom", "Norm", + "Pois", "Td", "Unif", "Weibull", "Arcsine", + "ExpOrGammaOrChisq") +exportClasses("UnivDistrListOrDistribution") +exportClasses("CompoundDistribution") +exportClasses("DistrList", + "UnivarDistrList") +exportClasses("OptionalNumeric", "PosSemDefSymmMatrix", + "PosDefSymmMatrix", + "Symmetry", "DistributionSymmetry", + "NoSymmetry", "EllipticalSymmetry", "SphericalSymmetry", + "DistrSymmList") +exportMethods("Max", "Max<-", "Min", "Min<-", "d", "df", + "df<-", "df1", "df1<-", "df2", + "df2<-", "dimension", "dimension<-", "name", + "name<-", "img", "k", "k<-", + "lambda", "lambda<-", "liesIn", "location", + "location<-", "m", "m<-", "mean", + "mean<-", "meanlog", "meanlog<-", "n", + "n<-", "ncp", "ncp<-", "p", "param", + "prob", "prob<-", "q", "r", "rate", "p.l", "q.r", + "rate<-", "scale", "scale<-", "sd", "sd<-", + "sdlog", "sdlog<-", "shape", "shape<-", + "shape1", "shape1<-", "shape2", "shape2<-", + "size", "size<-", "support", "initialize", + "print", "plot", "+", "-", "/", "*", "coerce", + "Math", "log", "log10", "gamma", "lgamma", "digamma", + "dim", "show", "convpow", "pivot", "sign", + "lattice", "width", "Length", "pivot<-", + "width<-", "Length<-", "liesInSupport", + "isOldVersion", "conv2NewVersion", "gaps", + "gaps<-", "setgaps", "getLow", "getUp") +exportClasses("UnivarMixingDistribution", + "UnivarLebDecDistribution", + "AffLinUnivarLebDecDistribution", + "AcDcLcDistribution") +exportMethods("mixCoeff", "mixCoeff<-", "mixDistr", "mixDistr<-", + "discretePart", "discretePart<-", "acPart", "acPart<-", + "discreteWeight", "discreteWeight<-", "acWeight", "acWeight<-", + "p.discrete", "d.discrete", "q.discrete", "r.discrete", + "p.ac", "d.ac", "q.ac", "r.ac") +exportMethods("decomposePM", "simplifyD", "showobj") +exportMethods("Truncate","Minimum","Maximum","Huberize") +exportMethods("solve", "sqrt") +exportMethods("type", "SymmCenter", "Symmetry", ".logExact", ".lowerExact") +export("UnivarMixingDistribution", "UnivarLebDecDistribution") +export("RtoDPQ.LC", "flat.LCD", "flat.mix") +exportMethods("abs","exp","^") +exportMethods("NumbOfSummandsDistr","SummandsDistr") +export("CompoundDistribution") +export("PosDefSymmMatrix","PosSemDefSymmMatrix") +export("NoSymmetry", "EllipticalSymmetry", "SphericalSymmetry", + "DistrSymmList") +export("qqbounds","igamma") +exportMethods("qqplot") +export(".isEqual",".isEqual01", ".inArgs", ".fillList", + ".presubs", ".makeLenAndOrder", ".DistrCollapse") export("samplesize", "distribution", "samplesize<-") \ No newline at end of file Added: branches/distr-2.6/pkg/distr/R/EmpiricalDistribution.R =================================================================== --- branches/distr-2.6/pkg/distr/R/EmpiricalDistribution.R (rev 0) +++ branches/distr-2.6/pkg/distr/R/EmpiricalDistribution.R 2014-08-14 16:05:27 UTC (rev 960) @@ -0,0 +1,20 @@ +############################################################################### +## Generating function to generate empirical distribution given some data +############################################################################### + +## simple wrapper to DiscreteDistribution +EmpiricalDistribution <- function(data, .withArith = FALSE, + .withSim = FALSE, .lowerExact = TRUE, .logExact = FALSE, + .DistrCollapse = + getdistrOption("DistrCollapse"), + .DistrCollapse.Unique.Warn = + getdistrOption("DistrCollapse.Unique.Warn"), + .DistrResolution = getdistrOption("DistrResolution"), + Symmetry = NoSymmetry()){ + DiscreteDistribution(supp = data, .withArith = .withArith, .withSim = .withSim, + .lowerExact = .lowerExact, .logExact = .logExact, + .DistrCollapse = .DistrCollapse, + .DistrCollapse.Unique.Warn = .DistrCollapse.Unique.Warn, + .DistrResolution = .DistrResolution, + Symmetry = Symmetry) +} Modified: branches/distr-2.6/pkg/distr/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distr/inst/NEWS 2014-08-12 12:45:39 UTC (rev 959) +++ branches/distr-2.6/pkg/distr/inst/NEWS 2014-08-14 16:05:27 UTC (rev 960) @@ -1,828 +1,830 @@ -###################################################################### -# News: to package distr -###################################################################### - -(first two numbers of package versions do not necessarily reflect - package-individual development, but rather are chosen for the - distrXXX family as a whole in order to ease updating "depends" - information) - -############## -v 2.6 -############## - -user visible changes -+ added reference to JSS paper in IllustCLT -+ updated references in vignette 'newDistributions' - -under the hood: - --qqplot: - + (already there for a while) gains argument 'debug' to be able to - trace where computation of confidence bounds fails; this 'debug' - argument has now been enhanced in the sense that now more detailed - information about which helper function was the culprit and where - (uniroot/optimize) this happens --qqbounds: - + the respective helper functions .BinomCI.nosym, .BinomCI, - .q2kolmogorov capsulate their calls to uniroot / optimize in - individual try-catches (instead of / on top of the one in - qqbounds itself) so that in case of several evaluations (e.g. in - pointwise CIs) at least a subset of valid points is produced. - In addition the search interval is now more flexible: it is bound - away from 0 below and from the upper bound from above, and this - bound moves to the respective lower/upper bounds in up to 20 trials. - Also, the search interval for .q2kolmogorov if argument 'exact' is - TRUE (i.e., if pKolmogorov2x is called) has been refined. This - should make the simultaneous intervals more stable. - + re-included faster right-tail approximation in C-code K(int n, double d) - included from R-Core (was commented out there) [ks.c in folder src in - tar-ball, ll 153-155] - -############## -v 2.5.3 -############## - -user-visible CHANGES: -+ CITATION file updated after JSS publication - -under the hood: -+ tests: long-running tests with large pre-calculated results successfully implemented -+ enhanced utility function .fillList by an automatic cast to list if the argument - not yet is of class list. -+ some minor changes in qqplot - -bug fixes: -+ bug in LatticeDistribution found by Mikhail.Spivakov at babraham.ac.uk -+ found a missing drop=FALSE in .mergegaps2 -+ fixed an issue with casting AffLinDiscreteDistributions to LatticeDistributions - (discovered by Kostas Oikonomou, ko at research.att.com ) - - ############## -v 2.5 -############## - -user-visible CHANGES: - -GENERAL ENHANCEMENTS: -+ cleaned DESCRIPTION and NAMESPACE file as to Imports/Depends - -under the hood: -+ added .Rbuildignore -+ exported some routines which had been internal so far to - avoid calls by ::: -+ in order to avoid calls to non-exported C-Code from pkg stats - (for Kolmogorov-distribution) we integrated R-Core's C-code from - /src/library/stats/src/ks.c rev60573 - (with small changes to make it self-contained) to src folder of this pkg; - in addition, we now use the shakier .C - interface again... - in v 2.5.1 reverted the changes in /src/library/stats/src/ks.c: - including R.h etc is easier than thought... - -BUGFIXES: -+ fixed .makedotsPt -issue discovered by Gerald --> thx -+ moved generics to "distribution" and "samplesize" to pkg distr to avoid - conflict between pkgs distrMod and distrSim - v 2.5.1: same with "samplesize<-" to avoid conflict between pkgs - distrSim and RobAStBase - -############## -v 2.4 -############## - -user-visible CHANGES: - - -GENERAL ENHANCEMENTS: - -LatticeDistribution::: -+ revised initialize and convolution methods, and generating function --> new routine to determine the smallest common grid for convolution -+ Taking up proposal by Baoyue Li, b.li at erasmusmc.nl, - plot methods for distribution objects gain functionality to modify xlab and ylab - - -under the hood: -+ introduce .Rbuildignore files -+ require no longer called in .onAttach -+ created folder vignettes and moved content of inst/doc/ to it -+ removed lazyload tag in DESCRIPTION -+ updated affiliation info in newDistributions.Rnw -+ deleted inst/doc folder -+ added DESCRIPTION tag "ByteCompile" to all our packages -+ updating maintainer email address and URL. -+ added argument no.readonly = TRUE to assignments of form opar <- par() -+ unified dots-manipulations -+ put some examples in "\dontrun" to reduce check time on CRAN -+ introduced new option warn.makeDNew to suppress annoying warnings when dealing with GEVD -+ deleted no longer needed chm folders - - -BUGFIXES: - -+ fixed an error in show method for UnivarLebDecDistribution: - match.call() threw an error -+ fixed problems with .makeDNew - as .makeDNew is not exported -+ error in definition of Beta() --- d slot was wrong -+ corrected typo (inifinite...) -+ typo in Beta-class.Rd (only in TeX mode) discovered by Thomas Kirschenmann, thk3421 at gmail.com -+ fixed some issue with X^a, X distribution, a a number ... -+ tried to fix gaps issue as mentioned by Dirk Surmann, surmann at statistik.uni-dortmund.de -+ corrected a bug noticed by frank1828 at gmail.com -+ fixed a bug within internals-qqplot : withConf.sim, withConf.pw had not been removed from call with - .deleteItemsMCL; -+ fixed request by B.Ripley as to installed.packages in branch 2.4 -+ fixed gaps issue with .multm -+ fixed issue with gaps (in case length(gaps)==0) - - and: BDR has changed calls to .C in 2.16.0 to calls to .Call; we used this in qqbounds, - respectively in .q2kolmogorov; now have branching functions .pk2 and .pks2 between ante 2.16. and from 2.16 on - - -############## -v 2.3 -############## - -user-visible CHANGES: - -- parameter size in NegbinomDistribution can now be real-valued -- introduced igamma, the inverse of digamma and corresponding transformations; - distr: drastically reduced memory needed by smaller grid for igamma -+ distr: implemented Nataliya's quantile trick to avoid simulated grid points - -GENERAL ENHANCEMENTS: - -+ [qqplot] - - had forgot to delete some legend arguments from call mcl ... - - gains arguments legend.pref and legend.postf to pre/ap-pend text before/after legend text - - CIs in qqplot may now comprise +-Inf values - - gains argument legend.alpha to be able to distinguish nominal and actual confidence level - -under the hood: -+ DESCRIPTION files and package-help files gain a tag - SVNRevision to be filled by get[All]RevNr.R from utils in distr - -BUGFIXES: - -+ old version of AllClasses.R for package "distr" was fetched - from R-Forge - warning after merging branch 2.2 into trunk - -+ got strange unreproducible error reports in the example to - simplifyD; set seed now to avoid this. - -+ (hopefully) fixed http://n4.nabble.com/R-devel-f909078.html - -+ fixed an error with qqplot in distr: mfColRow did not work as it should - ... now can be used in multipanel plots -+ fixed minor error in internals-qqplot.R - -+ for restoring old par() values, not all attributes may be set; - hence deleted them from stored value in plot functions by something like - opar$cin <- opar$cra <- opar$csi <- opar$cxy <- opar$din <- NULL - -+ Typos in plot functions... - -+ implemented Matthias' proposals, ie - (1) - [old] - newd <- (abs(newd) >= .Machine$double.eps)*newd - [new] - newd <- (newd >= .Machine$double.eps)*newd - - (2) - [old] - rsum.u <- min( sum( rev(cumsum(rev(newd))) <= ep/2)+1, length(supp1)) - [new] - rsum.u <- min( sum( !(cumsum(rev(newd)) <= ep/2))+1, length(supp1)) - - -+ a renaming schedule : enforcing ending .R in convpow.R - -+ fixed typo in corrected version of Convpow.R - -+ tentative fix for Uwe Ligges' bug report obsevered in - http://cran.r-project.org/bin/windows/contrib/2.12/check/distr-check.log 15-06-2010 - - -+ unnecessary Rplots.pdf deleted from inst folders of - distr and distrMod (are created anyway during vignette build) - -+ changed mail address: - triggered by mail by Sven Sewitz sas69 at cam.ac.uk, replaced all dead links - to distr.pdf in www files by url to vignette of distrDoc on CRAN; - also replaced uni-bayreuth.de mail address by itwm.fraunhofer.de one - ----------------- -Changes after changes in R , R-forge ----------------- - -+ cleanup issues: - - -Package: distr Version: 2.2 Flavor: r-devel-linux-ix86 - Check: package vignettes ... WARNING - *** Weave Errors *** - File /home/hornik/tmp/R.check/r-devel/Work/PKGS/distr.Rcheck/inst/doc/newDistributions.Rnw : - chunk 20 (label=cleanup) - Error : package ?SweaveListingUtils? is required by ?distr? so will not be detached - - - => removed tag in distr.Rnw in distrDoc - <>= - unloadNamespace("SweaveListingUtils") - @ - similarly in newDistributions.Rnw - - => small changes in SweaveListingUtils in order to pass R CMD check again... - - - - -############## -v 2.2 -############## - -user-visible CHANGES: - -+ moved Distribution symmetry classes and corresponding methods/functions from distrMod to distr - * introduced new slot "Symmetry" (of Class "DistributionSymmetry") in class Distribution - * adapted all algorithms in distr (arithmetics; generators) to take care about this new slot - - -+ (sort of) version management - * enhanced conv2NewVersion --- did not work before as intended in cases where - there is a particular initialized method with less arguments... - * correspondingly .lowerExact, .logExact Symmetry methods now are exported - * .lowerExact, .logExact methods now issue a warning before coercing to new version and - return corresponding slot of converted object - * corrected some small bug in demo ConvolutionNormalDistr.R - * method for UnivarMixingDistribution - -+ enhanced abs() - * for ContDistribution / DiscreteDistribution - * for ContDistribution now forces argument x --- caused errors in mad() for instance - -+ in distr generating functions [Univar]DistrList() gain Dlist argument - -+ plotting: - * new diagnostic function qqplot to check the compatibility of two distributions - + special method for first argument "UnivariateDistribution" (to be checked - for compatibility) and for second argument of class "UnivariateDistribution" - (H_0 distribution) - + comes with corresponding (pointwise/simultaneous) confidence intervals - - -GENERAL ENHANCEMENTS: - -+ added tests/Examples folder with file distr-Ex.Rout.save to have - some automatic testing -+ added field "Encoding: latin1" to all DESCRIPTION files in order to avoid problems - with e.g. Windows locale when svn replaces $LastChangedDate -+ added TOBEDONE (sic!) files for each package (by accident also in trunc; these are empty so far) -+ vignette: - * included svn-multi style files to /inst/doc folders for upload on CRAN - -BUGFIXES: - -+ fixed an inconsistency of Truncate for DiscreteDistributions; to better match Huberize and Min/Max - Truncation should be done for m<=object<=M instead of mDISCRETE DISTRIBUTIONS - --collapsing discrete distributions: - +getdistrOption(".DistrCollapse.Unique.Warn") - +implemented proposal by jacob van etten - (collapsing support) - --enhance accuracy - + yet another improvement of .multm (now sets density for discrete distributions - for non-support arguments actively to 0) - + We are a bit more careful about hitting support points in .multm for - DiscreteDistribution (i.e., for D * e2, e2 numeric, D DiscreteDistribution) -->CONTINUOUS DISTRIBUTIONS - --gaps/support : - +gaps matrix could falsely have 0 rows (instead of being set to NULL) - +class UnivarMixingDistribution gains overall slots gaps support - +added corresponding accessors - +correspondingly, for UnivarLebDecDistribution as daughter class, - accessors gaps(), support() refer to "overall" slots, not to slots of acPart, discretePart - +deleted special support, gaps method for UnivarLebDecDistribution; - now inherits from UnivarMixingDistribution - +new utility function .consolidategaps to "merge" adjacent gaps - +setgaps method for UnivarMixingDistribution - +correspondingly, - * method "*", c("AffLinUnivarLebDecDistribution","numeric"), - * method "+", c("AffLinUnivarLebDecDistribution","numeric"), - * method "*", c("UnivarLebDecDistribution","numeric"), - * method "+", c("UnivarLebDecDistribution","numeric"), - * generating function "UnivarLebDecDistribtion" - had to be modified - +utility 'mergegaps' catches situation where support has length 0 - +abs - and Truncate - methods for AbscontDistribution use '.consolidategaps' -->COMPOUND DISTRIBUTIONS - + Compound Distributions are now implemented; - see ?CompoundDistribution, class?CompoundDistribution -->UNIVARIATE MIXING DISTRIBUTIONS - + fixed some errors / made some enhancements acc. to - mail by Krunoslav Sever - -* ENHANCED ACCURACY BY LOG SCALE -+ enhanced accuracy for Truncation with Peter Dalgaard's trick -+ passed over to log-scale for getUp, getLow (again to enhance accuracy - for distributions with unbounded support) -+ introduced new slots .lowerExact and .logExact for objects of class - "Distribution" (or inheriting) to control whether the argument parts - log[.p], lower.tail are implemented carefully in order to preserve - accuracy. - -* ARITHMETICS --- enhanced "+" method - +for DiscreteDistribution,DiscreteDistribution --- - catches addition with Dirac-Distribution - + we enforce to use FFT-based algorithm for LatticeDistributions - if the supports of both summands may be arranged on a common lattice - whenever the length of convolutional grid (= unique(sort(outer(support1, support2, "+"))) ) - is smaller than the length of the product grid ( = length(support1) * length(support2) ) - --- covers in particular m1*Binom(p,size) + m2*Binom(p',size) when m1, m2 are naturals > 1 ... --- convpow: - + some minor enhancements in convpow and "+", "LatticeDistribution","LatticeDistribution" - and correction of a buglet there (e.g., lattice width oould get too small) - +method for AcDcLcDistribution gains argument 'ep' to control - when to ignore discrete parts (or a.c. parts) - which summands in binomial expansion of (acPart+discretePart)^\ast n to ignore - +minor fix in method for DiscreteDistribution --- automatic image distribution generation -+ slot r is now /much/ faster / slimmer for results of *,/,^ - (no split in pos/neg part necessary for this!) -+ slot d for results of *,/, exp() now is correct at 0 by extrapolation - (and deletion wir .del0dmixfun of half of the part to avoid double counting in *,/) --- affine linear trafos return slot X0 of AffLin-Construction if resulting a=1 and b=0 --- sqrt now dispatches correctly for Abscont and DiscreteDistribution. - -* PLOTTING - + enhanced automatic plotting range selection - + plot-methods in branches/distr-2.1 now accept to.draw.arg no matter whether mfColRow==TRUE or FALSE - + fixed xlim and ylim args for plots; ylim can now be matrix-valued... - + realized suggestions by A. Unwin, Augsburg; - plot for L2paramFamilies may be restricted to selected subplots; - + also named parameters are used in axis annotation if available. - + changed devNew to only open a device if length(dev.list())>0 - + plot (for distribution objects) now is conformal - to the (automatic) generic, i.e. it dispatches on signature (x,y) - and has methods for signature(x=,y="missing") - - -* NEW / ENHANCED METHODS ---getLow/getUp: - +now available for UnivarLebDecDistribution, UnivarMixingDistribution ---q.r, p.l (methods for right continuous quantile function - and left continuous cdf) - + for class AbscontDistribution (q.r with 'modifyqgaps') - + for class UnivarLebDecDistribution - + for class UnivarMixingDistribution ---prob methods: - +prob() for DiscreteDistribution-class - returns vector of probabilities for the support points - (named by values of support points) ) - + method for UnivarLebDecDistribution: returns a - two-row matrix with - * column names values of support points - * first row named "cond" the probabilities of discrete part - * second row named "abd" the probabilities of discrete part - multiplied with discreteWeight; hence the absolute probabilities - of the support points ---methods p.ac, d.ac, p.discrete, d.discrete: - * they all have an extra argument 'CondOrAbs' with default value - "cond" which if it does not partially match "abs", returns exactly - slot p (resp. d) the respective acPart/discretePart of the object - else return value is weighted by acWeight/discreteWeight ---new function 'makeAbscontDistribution' - +to convert arbitrary univariate distributions to AbscontDistribution: - takes slot p and uses AbscontDistribution(); in order to smear out - mass points on the border, makeAbscontDistribution() enlarges upper and - lower bounds ---flat.LCD: - +setgaps is called only if slot gaps is not yet filled ---general technique: more freguent use of .isEqual ---new / enhanced utilities (non-exported) - +'modifyqgaps' in order to achieve correct values for slot q - in case slot p hast constancy regions (gaps) - +.qmixfun can cope with gaps and may return both left and right continuous versions - +.pmixfun may return both left and right continuous versions - in case slot p hast constancy regions (gaps) - - -* DOCUMENTATION --new section "Extension packages" in package-help file 0distr-package.Rd --mention of CompoundDistribution-class in package-help file 0distr-package.Rd of devel version --new vignette "How to generate new distributions in packages distr, distrEx" - in package distr ... - -* Rd-style: - + several buglets detected with the fuzzier checking mechanism - cf [Rd] More intensive checking of R help files, Prof Brian Ripley, 09.01.2009 10:25) - [Rd] Warning: missing text for item ... in \describe? , Prof Brian Ripley, - -* S4 ISSUES: - + fixed setGenerics- error reported by Kurt Hornik... - "log", "log10", "gamma", "lgamma" are no longer redefined as generics. - +explicit method "+" for Dirac,DiscreteDistribution - +some changes to the connections between LatticeDistribution and DiscreteDistribution - resp. between AffLinLatticeDistribution and AffLinDiscreteDistribution. - key issues: - +JMC has changed the way non-simple inheritance [i.e. in the presence of setIs relations] - is treated (see distr; in particular show, and operator methods for LatticeDistribution) - works now and could be released as 2.0.1 - ->some explicit methods for LatticeDistribution, as due to setIs Relation - it may no longer be inherited automatically from DiscreteDistribution - since JMC's changes in S4 inheritance mechanism Sep/Oct 08 - -* BUGFIXES - +fixed a buglet in initialize for Cauchy Distribution - +fixed bug in "+",LatticeDistribution,LatticeDistribution - +it may be that even if both lattices of e1, e2 have same width, - the convoluted support has another width! - example: c(-1.5,1.5), c(-3,0,3) - +matrix-valued ylim argument has not yet been dealt with correctly - +fixed bug in plot-methods for argument "inner" under use of to.draw.arg argument - +fixed a bug in convpow-method for AbscontDistribution - +small buglets in plot-methods.R and plot-methods_LebDec.R (moved setting of owarn/oldPar outside) - +fixed a bug in UnivarMixingDistribution.R (with new argument Dlist) - +fixed a bug discovered by Prof. Unwin --- - "+" trapped in a dead-lock coercing between DiscreteDistribution - and LatticeDistribution - +fixed a small buglet in convpow(). - +fixed buglet in devel version of distr: getLow.R (wrong place of ")" ) - +fixed some errors in plotting LCD and CompoundDistribution(and enhanced automatic axis labels by some tricky castings...) - +UnivarMixingDistribution was too strict with sum mixCoeff == 1 - +deleted some erroneous prints left over from debugging in ExtraConvolutionMethods.R - +fixed some buglets in plot for distr (only in branch) - +fixed redundant code in bAcDcLcDistribution.R - +Patch to bug with AffLinAbscontDistribution - -############## -v 2.0.3 -############## - - * under the hood: - + enhanced plotting (correct dispatch; opening of new device is controlled - by option("newDevice") ) - + after JMC's changes: gone through setIs relations to ensure - "correct" inheritance - * new plot function for 'UnivarLebDecDistribution' : now plots 3 lines - +first line common cdf and quantile function - +second line abscont part - +third line discrete part - * new vignette "How to generate new distributions in packages distr, distrEx" - * moved license to LGPL-3 - * enhancements for arithmetics: - + fixed bug with AffLinAbscontDistribution for a*X+b, distribution X >=0 [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/distr -r 960 From noreply at r-forge.r-project.org Thu Aug 14 18:20:36 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 14 Aug 2014 18:20:36 +0200 (CEST) Subject: [Distr-commits] r961 - in branches/distr-2.6/pkg/distrEx: . R man src Message-ID: <20140814162036.D3FE8187385@r-forge.r-project.org> Author: stamats Date: 2014-08-14 18:20:36 +0200 (Thu, 14 Aug 2014) New Revision: 961 Added: branches/distr-2.6/pkg/distrEx/R/EmpiricalMVDistribution.R branches/distr-2.6/pkg/distrEx/man/EmpiricalMVDistribution.Rd Modified: branches/distr-2.6/pkg/distrEx/DESCRIPTION branches/distr-2.6/pkg/distrEx/NAMESPACE branches/distr-2.6/pkg/distrEx/man/0distrEx-package.Rd branches/distr-2.6/pkg/distrEx/man/DiscreteMVDistribution.Rd branches/distr-2.6/pkg/distrEx/src/GLaw.c Log: Added generating function EmpiricalMVDistribution as a simple wrapper to DiscreteMVDistribution. In addition, removed definition of PI as it is already defined in the included R.h. Futhermore, distrEx now depends on R >= 2.10.0. Modified: branches/distr-2.6/pkg/distrEx/DESCRIPTION =================================================================== --- branches/distr-2.6/pkg/distrEx/DESCRIPTION 2014-08-14 16:05:27 UTC (rev 960) +++ branches/distr-2.6/pkg/distrEx/DESCRIPTION 2014-08-14 16:20:36 UTC (rev 961) @@ -3,7 +3,7 @@ Date: 2013-09-18 Title: Extensions of package distr Description: Extensions of package distr and some additional functionality -Depends: R(>= 2.6.0), methods, distr(>= 2.2) +Depends: R(>= 2.10.0), methods, distr(>= 2.2) Suggests: tcltk Author: Matthias Kohl, Peter Ruckdeschel, Nataliya Horbenko Maintainer: Matthias Kohl Modified: branches/distr-2.6/pkg/distrEx/NAMESPACE =================================================================== --- branches/distr-2.6/pkg/distrEx/NAMESPACE 2014-08-14 16:05:27 UTC (rev 960) +++ branches/distr-2.6/pkg/distrEx/NAMESPACE 2014-08-14 16:20:36 UTC (rev 961) @@ -1,50 +1,51 @@ -useDynLib("distrEx") - -import("methods") -import("distr") - -exportClasses("Condition", "EuclCondition") -exportClasses("LMParameter") -exportClasses("MultivariateDistribution", - "DiscreteMVDistribution", - "UnivariateCondDistribution", - "DiscreteCondDistribution", - "AbscontCondDistribution", - "PrognCondition") -exportMethods("show", - "plot", - "coerce", - "dim") -exportMethods("ConvexContamination", - "ContaminationSize", - "TotalVarDist", - "AsymTotalVarDist", - "OAsymTotalVarDist", - "KolmogorovDist", - "HellingerDist", - "CvMDist") -exportMethods("support", - "cond", - "location", "location<-", - "Range", - "scale", "scale<-", - "Min","shape", - "Min<-","shape<-", - "+", "*", - "name", "name<-", - "E", "var", "IQR", "skewness", "kurtosis", - "sd", "median", "mad", - "m1df", "m2df", - "liesInSupport") -export("EuclCondition") -export("LMParameter") -export("DiscreteMVDistribution", - "LMCondDistribution") -export("ConvexContamination") -export("GLIntegrate", - "distrExIntegrate") -export("distrExOptions", "getdistrExOption", - "distrExMASK", "distrExoptions", "distrExMOVED") -export("make01","PrognCondDistribution", - "PrognCondition") -export(".getIntbounds") +useDynLib("distrEx") + +import("methods") +import("distr") + +exportClasses("Condition", "EuclCondition") +exportClasses("LMParameter") +exportClasses("MultivariateDistribution", + "DiscreteMVDistribution", + "UnivariateCondDistribution", + "DiscreteCondDistribution", + "AbscontCondDistribution", + "PrognCondition") +exportMethods("show", + "plot", + "coerce", + "dim") +exportMethods("ConvexContamination", + "ContaminationSize", + "TotalVarDist", + "AsymTotalVarDist", + "OAsymTotalVarDist", + "KolmogorovDist", + "HellingerDist", + "CvMDist") +exportMethods("support", + "cond", + "location", "location<-", + "Range", + "scale", "scale<-", + "Min","shape", + "Min<-","shape<-", + "+", "*", + "name", "name<-", + "E", "var", "IQR", "skewness", "kurtosis", + "sd", "median", "mad", + "m1df", "m2df", + "liesInSupport") +export("EuclCondition") +export("LMParameter") +export("DiscreteMVDistribution", + "EmpiricalMVDistribution", + "LMCondDistribution") +export("ConvexContamination") +export("GLIntegrate", + "distrExIntegrate") +export("distrExOptions", "getdistrExOption", + "distrExMASK", "distrExoptions", "distrExMOVED") +export("make01","PrognCondDistribution", + "PrognCondition") +export(".getIntbounds") Added: branches/distr-2.6/pkg/distrEx/R/EmpiricalMVDistribution.R =================================================================== --- branches/distr-2.6/pkg/distrEx/R/EmpiricalMVDistribution.R (rev 0) +++ branches/distr-2.6/pkg/distrEx/R/EmpiricalMVDistribution.R 2014-08-14 16:20:36 UTC (rev 961) @@ -0,0 +1,7 @@ +############################################################################### +## Generating function to generate empirical distribution given some data +############################################################################### + +EmpiricalMVDistribution <- function(data, Symmetry = NoSymmetry()){ + DiscreteMVDistribution(supp = data, Symmetry = Symmetry) +} Modified: branches/distr-2.6/pkg/distrEx/man/0distrEx-package.Rd =================================================================== --- branches/distr-2.6/pkg/distrEx/man/0distrEx-package.Rd 2014-08-14 16:05:27 UTC (rev 960) +++ branches/distr-2.6/pkg/distrEx/man/0distrEx-package.Rd 2014-08-14 16:20:36 UTC (rev 961) @@ -1,255 +1,255 @@ -\name{distrEx-package} -\alias{distrEx-package} -\alias{distrEx} -\docType{package} -\title{ -distrEx -- Extensions of package distr -} -\description{ -\pkg{distrEx} proides some extensions of package \pkg{distr}: -\itemize{\item expectations in the form - \itemize{\item \code{E(X)} for the expectation of a - distribution object \code{X} - \item \code{E(X,f)} for the expectation of \code{f(X)} - where \code{X} is some distribution object and - \code{f} some function in \code{X} } -\item further functionals: var, sd, IQR, mad, median, skewness, kurtosis -\item truncated moments, -\item distances between distributions - (Hellinger, Cramer von Mises, Kolmogorov, total variation, "convex contamination") -\item lists of distributions, -\item conditional distributions in factorized form -\item conditional expectations in factorized form -} -Support for extreme value distributions has moved to package \pkg{RobExtremes} -} - -\details{ -\tabular{ll}{ -Package: \tab distrEx \cr -Version: \tab 2.6 \cr -Date: \tab 2013-09-18 \cr -Depends: \tab R(>= 2.6.0), methods, distr(>= 2.2) \cr -LazyLoad: \tab yes \cr -License: \tab LGPL-3 \cr -URL: \tab http://distr.r-forge.r-project.org/\cr -SVNRevision: \tab 926 \cr -} -} -\section{Classes}{ -\preformatted{ - -Distribution Classes - -"Distribution" (from distr) -|>"UnivariateDistribution" (from distr) -|>|>"AbscontDistribution" (from distr) -|>|>|>"Gumbel" -|>|>|>"Pareto" -|>|>|>"GPareto" -|>"MultivariateDistribution" -|>|>"DiscreteMVDistribution-class" -|>"UnivariateCondDistribution" -|>|>"AbscontCondDistribution" -|>|>|>"PrognCondDistribution" -|>|>"DiscreteCondDistribution" - - -Condition Classes - -"Condition" -|>"EuclCondition" -|>"PrognCondition" - -Parameter Classes - -"OptionalParameter" (from distr) -|>"Parameter" (from distr) -|>|>"LMParameter" -|>|>"GumbelParameter" -|>|>"ParetoParameter" -} -} -\section{Functions}{ - -\preformatted{ - -Integration: -GLIntegrate Gauss-Legendre quadrature -distrExIntegrate Integration of one-dimensional functions - -Options: -distrExOptions Function to change the global variables of the - package 'distrEx' -Standardization: -make01 Centering and standardization of univariate - distributions - -}} - -\section{Generating Functions}{ -\preformatted{ - -Distribution Classes -ConvexContamination Generic function for generating convex - contaminations -DiscreteMVDistribution - Generating function for - DiscreteMVDistribution-class -Gumbel Generating function for Gumbel-class -LMCondDistribution Generating function for the conditional - distribution of a linear regression model. - -Condition Classes -EuclCondition Generating function for EuclCondition-class - -Parameter Classes -LMParameter Generating function for LMParameter-class - -}} -\section{Methods}{ -\preformatted{ -Distances: -ContaminationSize Generic function for the computation of the - convex contamination (Pseudo-)distance of two - distributions -HellingerDist Generic function for the computation of the - Hellinger distance of two distributions -KolmogorovDist Generic function for the computation of the - Kolmogorov distance of two distributions -TotalVarDist Generic function for the computation of the - total variation distance of two distributions -AsymTotalVarDist Generic function for the computation of the - asymmetric total variation distance of two distributions - (for given ratio rho of negative to positive part of deviation) -OAsymTotalVarDist Generic function for the computation of the minimal (in rho) - asymmetric total variation distance of two distributions -vonMisesDist Generic function for the computation of the - von Mises distance of two distributions - -liesInSupport Generic function for testing the support of a - distribution - - -Functionals: -E Generic function for the computation of - (conditional) expectations -var Generic functions for the computation of - functionals -IQR Generic functions for the computation of - functionals -sd Generic functions for the computation of - functionals -mad Generic functions for the computation of - functionals -median Generic functions for the computation of - functionals -skewness Generic functions for the computation of - functionals -kurtosis Generic functions for the computation of - Functionals - - -truncated Moments: -m1df Generic function for the computation of clipped - first moments -m2df Generic function for the computation of clipped - second moments - -} -} - -\section{Demos}{ -Demos are available --- see \code{demo(package="distrEx")}.} - -\section{Acknowledgement}{ -G. Jay Kerns, \email{gkerns at ysu.edu}, has provided a major contribution, -in particular the functionals \code{skewness} and \code{kurtosis} are due to him. -Natalyia Horbenko, \email{natalyia.horbenko at itwm.fraunhofer.de} has ported -the \pkg{actuar} code for the Pareto distribution to this setup. -} - -\note{ -Some functions of package \pkg{stats} have intentionally been masked, but -completely retain their functionality --- see \code{distrExMASK()}. - -If any of the packages \pkg{e1071}, \pkg{moments}, \pkg{fBasics} is to be used -together with \pkg{distrEx} the latter must be attached \emph{after} any of the -first mentioned. Otherwise \code{kurtosis()} and \code{skewness()} -defined as \emph{methods} in \pkg{distrEx} may get masked.\cr To re-mask, you -may use \code{kurtosis <- distrEx::kurtosis; skewness <- distrEx::skewness}. -See also \code{distrExMASK()} -} - -\section{Start-up-Banner}{ -You may suppress the start-up banner/message completely by setting -\code{options("StartupBanner"="off")} somewhere before loading this package by -\code{library} or \code{require} in your R-code / R-session. - -If option \code{"StartupBanner"} is not defined (default) or setting -\code{options("StartupBanner"=NULL)} or -\code{options("StartupBanner"="complete")} the complete start-up banner is -displayed. - -For any other value of option \code{"StartupBanner"} (i.e., not in -\code{c(NULL,"off","complete")}) only the version information is displayed. - -The same can be achieved by wrapping the \code{library} or \code{require} call -into either \code{suppressStartupMessages()} or -\code{onlytypeStartupMessages(.,atypes="version")}. - -As for general \code{packageStartupMessage}'s, you may also suppress all - the start-up banner by wrapping the \code{library} or \code{require} - call into \code{suppressPackageStartupMessages()} from - \pkg{startupmsg}-version 0.5 on. - } - -\section{Package versions}{ -Note: The first two numbers of package versions do not necessarily reflect - package-individual development, but rather are chosen for the - distrXXX family as a whole in order to ease updating "depends" - information. -} - -\author{ -Matthias Kohl \email{Matthias.Kohl at stamats.de} and \cr -Peter Ruckdeschel \email{Peter.Ruckdeschel at itwm.fraunhofer.de},\cr - -\emph{Maintainer:} Matthias Kohl \email{Matthias.Kohl at stamats.de} -} -\references{ -P. Ruckdeschel, M. Kohl, T. Stabla, F. Camphausen (2006): -S4 Classes for Distributions, \emph{R News}, \emph{6}(2), 2-6. -\url{http://CRAN.R-project.org/doc/Rnews/Rnews_2006-2.pdf} - -%a more detailed manual for \pkg{distr}, \pkg{distrSim}, \pkg{distrTEst}, and \pkg{distrEx} may be downloaded from -%\url{http://www.uni-bayreuth.de/departments/math/org/mathe7/DISTR/distr.pdf}\cr - -a vignette for packages \pkg{distr}, \pkg{distrSim}, \pkg{distrTEst}, -and \pkg{distrEx} is included into the mere documentation package \pkg{distrDoc} -and may be called by \code{require("distrDoc");vignette("distr")} - -a homepage to this package is available under\cr -\url{http://distr.r-forge.r-project.org/} - -M. Kohl (2005): \emph{Numerical Contributions to the Asymptotic -Theory of Robustness.} PhD Thesis. Bayreuth. Available as -\url{http://www.stamats.de/ThesisMKohl.pdf} -} -\keyword{package} -\concept{S4 condition class} -\concept{S4 distribution class} -\concept{functional} -\concept{kurtosis} -\concept{median} -\concept{skewness} -\concept{mad} -\concept{IQR} -\concept{var} -\concept{E} -\concept{distribution distance} -\concept{multivariate distribution} -\concept{conditional distribution} -\seealso{ -\code{\link[distr:0distr-package]{distr-package}} -} +\name{distrEx-package} +\alias{distrEx-package} +\alias{distrEx} +\docType{package} +\title{ +distrEx -- Extensions of package distr +} +\description{ +\pkg{distrEx} proides some extensions of package \pkg{distr}: +\itemize{\item expectations in the form + \itemize{\item \code{E(X)} for the expectation of a + distribution object \code{X} + \item \code{E(X,f)} for the expectation of \code{f(X)} + where \code{X} is some distribution object and + \code{f} some function in \code{X} } +\item further functionals: var, sd, IQR, mad, median, skewness, kurtosis +\item truncated moments, +\item distances between distributions + (Hellinger, Cramer von Mises, Kolmogorov, total variation, "convex contamination") +\item lists of distributions, +\item conditional distributions in factorized form +\item conditional expectations in factorized form +} +Support for extreme value distributions has moved to package \pkg{RobExtremes} +} + +\details{ +\tabular{ll}{ +Package: \tab distrEx \cr +Version: \tab 2.6 \cr +Date: \tab 2013-09-18 \cr +Depends: \tab R(>= 2.10.0), methods, distr(>= 2.2) \cr +LazyLoad: \tab yes \cr +License: \tab LGPL-3 \cr +URL: \tab http://distr.r-forge.r-project.org/\cr +SVNRevision: \tab 926 \cr +} +} +\section{Classes}{ +\preformatted{ + +Distribution Classes + +"Distribution" (from distr) +|>"UnivariateDistribution" (from distr) +|>|>"AbscontDistribution" (from distr) +|>|>|>"Gumbel" +|>|>|>"Pareto" +|>|>|>"GPareto" +|>"MultivariateDistribution" +|>|>"DiscreteMVDistribution-class" +|>"UnivariateCondDistribution" +|>|>"AbscontCondDistribution" +|>|>|>"PrognCondDistribution" +|>|>"DiscreteCondDistribution" + + +Condition Classes + +"Condition" +|>"EuclCondition" +|>"PrognCondition" + +Parameter Classes + +"OptionalParameter" (from distr) +|>"Parameter" (from distr) +|>|>"LMParameter" +|>|>"GumbelParameter" +|>|>"ParetoParameter" +} +} +\section{Functions}{ + +\preformatted{ + +Integration: +GLIntegrate Gauss-Legendre quadrature +distrExIntegrate Integration of one-dimensional functions + +Options: +distrExOptions Function to change the global variables of the + package 'distrEx' +Standardization: +make01 Centering and standardization of univariate + distributions + +}} + +\section{Generating Functions}{ +\preformatted{ + +Distribution Classes +ConvexContamination Generic function for generating convex + contaminations +DiscreteMVDistribution + Generating function for + DiscreteMVDistribution-class +Gumbel Generating function for Gumbel-class +LMCondDistribution Generating function for the conditional + distribution of a linear regression model. + +Condition Classes +EuclCondition Generating function for EuclCondition-class + +Parameter Classes +LMParameter Generating function for LMParameter-class + +}} +\section{Methods}{ +\preformatted{ +Distances: +ContaminationSize Generic function for the computation of the + convex contamination (Pseudo-)distance of two + distributions +HellingerDist Generic function for the computation of the + Hellinger distance of two distributions +KolmogorovDist Generic function for the computation of the + Kolmogorov distance of two distributions +TotalVarDist Generic function for the computation of the + total variation distance of two distributions +AsymTotalVarDist Generic function for the computation of the + asymmetric total variation distance of two distributions + (for given ratio rho of negative to positive part of deviation) +OAsymTotalVarDist Generic function for the computation of the minimal (in rho) + asymmetric total variation distance of two distributions +vonMisesDist Generic function for the computation of the + von Mises distance of two distributions + +liesInSupport Generic function for testing the support of a + distribution + + +Functionals: +E Generic function for the computation of + (conditional) expectations +var Generic functions for the computation of + functionals +IQR Generic functions for the computation of + functionals +sd Generic functions for the computation of + functionals +mad Generic functions for the computation of + functionals +median Generic functions for the computation of + functionals +skewness Generic functions for the computation of + functionals +kurtosis Generic functions for the computation of + Functionals + + +truncated Moments: +m1df Generic function for the computation of clipped + first moments +m2df Generic function for the computation of clipped + second moments + +} +} + +\section{Demos}{ +Demos are available --- see \code{demo(package="distrEx")}.} + +\section{Acknowledgement}{ +G. Jay Kerns, \email{gkerns at ysu.edu}, has provided a major contribution, +in particular the functionals \code{skewness} and \code{kurtosis} are due to him. +Natalyia Horbenko, \email{natalyia.horbenko at itwm.fraunhofer.de} has ported +the \pkg{actuar} code for the Pareto distribution to this setup. +} + +\note{ +Some functions of package \pkg{stats} have intentionally been masked, but +completely retain their functionality --- see \code{distrExMASK()}. + +If any of the packages \pkg{e1071}, \pkg{moments}, \pkg{fBasics} is to be used +together with \pkg{distrEx} the latter must be attached \emph{after} any of the +first mentioned. Otherwise \code{kurtosis()} and \code{skewness()} +defined as \emph{methods} in \pkg{distrEx} may get masked.\cr To re-mask, you +may use \code{kurtosis <- distrEx::kurtosis; skewness <- distrEx::skewness}. +See also \code{distrExMASK()} +} + +\section{Start-up-Banner}{ +You may suppress the start-up banner/message completely by setting +\code{options("StartupBanner"="off")} somewhere before loading this package by +\code{library} or \code{require} in your R-code / R-session. + +If option \code{"StartupBanner"} is not defined (default) or setting +\code{options("StartupBanner"=NULL)} or +\code{options("StartupBanner"="complete")} the complete start-up banner is +displayed. + +For any other value of option \code{"StartupBanner"} (i.e., not in +\code{c(NULL,"off","complete")}) only the version information is displayed. + +The same can be achieved by wrapping the \code{library} or \code{require} call +into either \code{suppressStartupMessages()} or +\code{onlytypeStartupMessages(.,atypes="version")}. + +As for general \code{packageStartupMessage}'s, you may also suppress all + the start-up banner by wrapping the \code{library} or \code{require} + call into \code{suppressPackageStartupMessages()} from + \pkg{startupmsg}-version 0.5 on. + } + +\section{Package versions}{ +Note: The first two numbers of package versions do not necessarily reflect + package-individual development, but rather are chosen for the + distrXXX family as a whole in order to ease updating "depends" + information. +} + +\author{ +Matthias Kohl \email{Matthias.Kohl at stamats.de} and \cr +Peter Ruckdeschel \email{Peter.Ruckdeschel at itwm.fraunhofer.de},\cr + +\emph{Maintainer:} Matthias Kohl \email{Matthias.Kohl at stamats.de} +} +\references{ +P. Ruckdeschel, M. Kohl, T. Stabla, F. Camphausen (2006): +S4 Classes for Distributions, \emph{R News}, \emph{6}(2), 2-6. +\url{http://CRAN.R-project.org/doc/Rnews/Rnews_2006-2.pdf} + +%a more detailed manual for \pkg{distr}, \pkg{distrSim}, \pkg{distrTEst}, and \pkg{distrEx} may be downloaded from +%\url{http://www.uni-bayreuth.de/departments/math/org/mathe7/DISTR/distr.pdf}\cr + +a vignette for packages \pkg{distr}, \pkg{distrSim}, \pkg{distrTEst}, +and \pkg{distrEx} is included into the mere documentation package \pkg{distrDoc} +and may be called by \code{require("distrDoc");vignette("distr")} + +a homepage to this package is available under\cr +\url{http://distr.r-forge.r-project.org/} + +M. Kohl (2005): \emph{Numerical Contributions to the Asymptotic +Theory of Robustness.} PhD Thesis. Bayreuth. Available as +\url{http://www.stamats.de/ThesisMKohl.pdf} +} +\keyword{package} +\concept{S4 condition class} +\concept{S4 distribution class} +\concept{functional} +\concept{kurtosis} +\concept{median} +\concept{skewness} +\concept{mad} +\concept{IQR} +\concept{var} +\concept{E} +\concept{distribution distance} +\concept{multivariate distribution} +\concept{conditional distribution} +\seealso{ +\code{\link[distr:0distr-package]{distr-package}} +} Modified: branches/distr-2.6/pkg/distrEx/man/DiscreteMVDistribution.Rd =================================================================== --- branches/distr-2.6/pkg/distrEx/man/DiscreteMVDistribution.Rd 2014-08-14 16:05:27 UTC (rev 960) +++ branches/distr-2.6/pkg/distrEx/man/DiscreteMVDistribution.Rd 2014-08-14 16:20:36 UTC (rev 961) @@ -1,50 +1,50 @@ -\name{DiscreteMVDistribution} -\alias{DiscreteMVDistribution} - -\title{Generating function for DiscreteMVDistribution-class} -\description{ - Generates an object of class \code{"DiscreteMVDistribution"}. -} -\usage{ -DiscreteMVDistribution(supp, prob, Symmetry = NoSymmetry()) -} -\arguments{ - \item{supp}{ numeric matrix whose rows form the support - of the discrete multivariate distribution. } - \item{prob}{ vector of probability weights for the - elements of \code{supp}.} - \item{Symmetry}{you may help \R in calculations if you tell it whether - the distribution is non-symmetric (default) or symmetric with respect - to a center.} -} -\details{ - Typical usages are - \preformatted{ - DiscreteMVDistribution(supp, prob) - DiscreteMVDistribution(supp) - } - Identical rows are collapsed to unique support values. - If \code{prob} is missing, all elements in \code{supp} - are equally weighted. -} -\value{Object of class \code{"DiscreteMVDistribution"}} -%\references{} -\author{Matthias Kohl \email{Matthias.Kohl at stamats.de}} -%\note{} -\seealso{\code{DiscreteMVDistribution-class}} -\examples{ -# Dirac-measure at (0,0,0) -D1 <- DiscreteMVDistribution(supp = c(0,0,0)) -support(D1) - -# simple discrete distribution -D2 <- DiscreteMVDistribution(supp = matrix(c(0,1,0,2,2,1,1,0), ncol=2), - prob = c(0.3, 0.2, 0.2, 0.3)) -support(D2) -r(D2)(10) -} -\concept{multivariate distribution} -\concept{discrete distribution} -\keyword{distribution} -\concept{S4 distribution class} -\concept{generating function} +\name{DiscreteMVDistribution} +\alias{DiscreteMVDistribution} + +\title{Generating function for multivariate discrete distribution} +\description{ + Generates an object of class \code{"DiscreteMVDistribution"}. +} +\usage{ +DiscreteMVDistribution(supp, prob, Symmetry = NoSymmetry()) +} +\arguments{ + \item{supp}{ numeric matrix whose rows form the support + of the discrete multivariate distribution. } + \item{prob}{ vector of probability weights for the + elements of \code{supp}.} + \item{Symmetry}{you may help \R in calculations if you tell it whether + the distribution is non-symmetric (default) or symmetric with respect + to a center.} +} +\details{ + Typical usages are + \preformatted{ + DiscreteMVDistribution(supp, prob) + DiscreteMVDistribution(supp) + } + Identical rows are collapsed to unique support values. + If \code{prob} is missing, all elements in \code{supp} + are equally weighted. +} +\value{Object of class \code{"DiscreteMVDistribution"}} +%\references{} +\author{Matthias Kohl \email{Matthias.Kohl at stamats.de}} +%\note{} +\seealso{\code{\link{DiscreteMVDistribution-class}}} +\examples{ +# Dirac-measure at (0,0,0) +D1 <- DiscreteMVDistribution(supp = c(0,0,0)) +support(D1) + +# simple discrete distribution +D2 <- DiscreteMVDistribution(supp = matrix(c(0,1,0,2,2,1,1,0), ncol=2), + prob = c(0.3, 0.2, 0.2, 0.3)) +support(D2) +r(D2)(10) +} +\concept{multivariate distribution} +\concept{discrete distribution} +\keyword{distribution} +\concept{S4 distribution class} +\concept{generating function} Added: branches/distr-2.6/pkg/distrEx/man/EmpiricalMVDistribution.Rd =================================================================== --- branches/distr-2.6/pkg/distrEx/man/EmpiricalMVDistribution.Rd (rev 0) +++ branches/distr-2.6/pkg/distrEx/man/EmpiricalMVDistribution.Rd 2014-08-14 16:20:36 UTC (rev 961) @@ -0,0 +1,49 @@ +\name{EmpiricalMVDistribution} +\alias{EmpiricalMVDistribution} + +\title{Generating function for mulitvariate discrete distribution} +\description{ + Generates an object of class \code{"DiscreteMVDistribution"}. +} +\usage{ +EmpiricalMVDistribution(data, Symmetry = NoSymmetry()) +} +\arguments{ + \item{data}{ numeric matrix with data where the rows are + interpreted as observations. } + \item{Symmetry}{you may help \R in calculations if you tell it whether + the distribution is non-symmetric (default) or symmetric with respect + to a center.} +} +\details{ + The function is a simple utility function providing a wrapper to the + generating function \code{\link{DiscreteDistribution}}. + + Typical usages are + \preformatted{ + EmpiricalMVDistribution(data) + } + + Identical rows are collapsed to unique support values. + If \code{prob} is missing, all elements in \code{supp} + are equally weighted. +} +\value{Object of class \code{"DiscreteMVDistribution"}} +%\references{} +\author{Matthias Kohl \email{Matthias.Kohl at stamats.de}} +%\note{} +\seealso{\code{\link{DiscreteMVDistribution}}} +\examples{ +## generate some data +X <- matrix(rnorm(50), ncol = 5) + +## empirical distribution of X +D1 <- EmpiricalMVDistribution(data = X) +support(D1) +r(D1)(10) +} +\concept{multivariate distribution} +\concept{empirical distribution} +\keyword{distribution} +\concept{S4 distribution class} +\concept{generating function} Modified: branches/distr-2.6/pkg/distrEx/src/GLaw.c =================================================================== --- branches/distr-2.6/pkg/distrEx/src/GLaw.c 2014-08-14 16:05:27 UTC (rev 960) +++ branches/distr-2.6/pkg/distrEx/src/GLaw.c 2014-08-14 16:20:36 UTC (rev 961) @@ -1,5 +1,5 @@ #include -#define PI 3.141592653589793 +/*#define PI 3.141592653589793*/ #include #include #include /* constants */ @@ -46,4 +46,4 @@ return AW; } -*/ \ No newline at end of file +*/ From noreply at r-forge.r-project.org Thu Aug 14 18:56:30 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 14 Aug 2014 18:56:30 +0200 (CEST) Subject: [Distr-commits] r962 - branches/distr-2.6/pkg/distrEx/inst Message-ID: <20140814165630.82E01187549@r-forge.r-project.org> Author: stamats Date: 2014-08-14 18:56:30 +0200 (Thu, 14 Aug 2014) New Revision: 962 Modified: branches/distr-2.6/pkg/distrEx/inst/NEWS Log: updated NEWS file Modified: branches/distr-2.6/pkg/distrEx/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distrEx/inst/NEWS 2014-08-14 16:20:36 UTC (rev 961) +++ branches/distr-2.6/pkg/distrEx/inst/NEWS 2014-08-14 16:56:30 UTC (rev 962) @@ -1,359 +1,363 @@ -###################################################################### -# News: to package distrEx -###################################################################### - -(first two numbers of package versions do not necessarily reflect - package-individual development, but rather are chosen for the - distrXXX family as a whole in order to ease updating "depends" - information) - -############## -v 2.6 -############## - -under the hood: -+ use particular S3-class "moved2RobExtremeClass" for - former package internal constants EULERMASCHERONICONSTANT and - APERYCONSTANT - - -############## -v 2.5 -############## - -user-visible CHANGES: - -GENERAL ENHANCEMENTS: -+ cleaned DESCRIPTION and NAMESPACE file as to Imports/Depends - -under the hood: -+ use some newly exmported routines which had been internal so far to - avoid calls by ::: -+ added .Rbuildignore - -BUGFIXES: - -############## -v 2.4 -############## - -user-visible CHANGES: -+ moved functionality for extreme value distribution to package RobExtremes --> concerns distributions Gumbel, GEVD, GPareto, and Pareto -+ moved functional and estimator kMAD to package RobExtremes - -under the hood: -+ added DESCRIPTION tag "ByteCompile" to all our packages -+ updating maintainer email address and URL. -+ added argument no.readonly = TRUE to assignments of form opar <- par() -+ deleted no longer needed chm folders - - - -BUGFIXES: - -+ corrected bug in var() (with argument fun in case of symmetry) - -############## -v 2.3 -############## - -user-visible CHANGES: - -+ new default method for CvMDist (i.e. for mu=e2) instead of numerical - integration uses explicit terms => by factor 30 faster! - -+ Nataliya produced a C-version of kMad; integrated to distrEx now - -+ Generalized Extreme Value Distribution is ported to distrEx - -+ Gumbel in distrEx has different parametrization as GEV with shape = 0 - -under the hood: - -+ DESCRIPTION files and package-help files gain a tag - SVNRevision to be filled by get[All]RevNr.R from utils in distr - - -BUGFIXES: - -+ found a bug in setMethod("var", signature(x = "UnivariateDistribution")) - for spherical symmetric distributions - -+ Small bug in Expectation.R was found - -+ Gumbel in distrEx has different parametrization - as GEV with shape = 0 - -+ fixed several buglets in GEV - * small error for xi = 0 in Functionals.R and Expecation.R - * completed unfinished documentation - - -############## -v 2.2 -############## - -user-visible CHANGES: - -+ enhanced E() methods - * expectation gains ... argument to pass on accuracy arguments - -+ enhanced m1df(),m2df() methods - * m1df, m2df gain ... argument to be able to pass on accuracy arguments to E(); - * m1df, m2df can now digest cond, fun arguments... - * particular m1df versions (for Binom, Norm, Chisq, Exp, Pois) - are used in E(object, [fun, cond, ] low=.., upp=.., ...) calls -+ GPareto - * implemented GPareto class (Nataliya) [including functionals) - * allow for negative shape parameter in generalized Pareto ... - -GENERAL ENHANCEMENTS: - -+ added tests/Examples folder with file distrEx-Ex.Rout.save to have - some automatic testing -+ added field "Encoding: latin1" to all DESCRIPTION files in order to avoid problems - with e.g. Windows locale when svn replaces $LastChangedDate -+ added TOBEDONE (sic!) files for each package (by accident also in trunc; these are empty so far) - -INTERNALLY: - -+ introduced helper function .getIntbounds -+ reorganized help for PrognCondDistribution -+ functionals in distrEx now make use of this symmetry slot ... -+ catch errors thrown by qgumbel and qpareto1 when args are not in (0,1) - --> corresp. q-methods now consistently return NaN. -+ m1df,m2df: - *particular methods for m2df for AbscontDistribution, DiscreteDistribution are no longer necessary. - *new/revised methods for m1df, m2df for AfflinDistribution -+ enhanced/corrected methods for Kolmogorov distance - * when one operand is DiscreteDistribution - * yet another (speed) improvement --- important for MDE with KolmogorovDist: - Kolmogorov-dist e1 (discrete) : e2 (ac) is - x <- support(e1) - res <- max(p(e1)(x)-p(e2)(x),p(e2)(x)-p.l(e1)(x)) -+ merged Expectation_LebDec.R into Expectation.R - according to proposal by Kurt Hornik (different Collation order caused - problem in English locale) -+ new expectation methods for UnivarMixingDistribution -+ included new methods for E(): - * for GPareto as well as for Gammad - -> increase the precision for the numerical calculation of certain integrals; - in particular, integrals involving "log" as integrand. - * Expectation for GPareto now has IQR.fac accuracy set to - max(1e4,getdistrExOption("IQR.fac") to enhance accuracy for integration; - -BUGFIXES: - -+ forgot to commit branches/distr-2.2/pkg/distrEx/man/distrExConstants.Rd -+ forgot some source files (GPD) -+ fixed a buglet in m2df method for LatticeDistribution (a catch for existing fun argument was missing). -+ forgot to set corresponding distrExoptions()-default values for accuracy - for m1df, m2df -+ fixed a bug in E-method for AbscontDistribution, function, cond -+ fix for the bug in distrEx: m2df now only uses mc <- match.call() - instead of mc <- match.call(call = sys.call(sys.parent(1))) - (do not completely understand why: - there is method dispatch, though, as in plot(), where sys.call(sys.parent(1)) - is needed, but here match.call() does it... ) -+ fixed some --hard-to-detect/localize-- bug induced with lazy evaluation: - Data-Examples in scripts to ROptEst threw errors: reason --- need an - explicit assignment im ClippedMomemts.R (distrEx) mc$object <- object - to force evaluation of object (otherwise only transmitted as name...) -+ R CMD check threw an error for distrEx .Rd file distrExConstants.Rd : - probably because of a multi-line \deqn{}{} expression modified -+ corrected some bug with match.call() in Var()... -+ forgot to write the expectations of different components into different coordinates -+ Definition for KolmogorovDist for numeric, UnivariateDistribution - by means of ks.test was only oK for AbscontDistributions; changed to - KolmogorovDist(DiscreteDistribution(e1),e2) -+ fixed errors in expectation methods (with upper & lower bounds) - as well as in m1df, m2df methods - - - -############## -v 2.1 -############## - -* Rd-style: - + several buglets detected with the fuzzier checking mechanism - cf [Rd] More intensive checking of R help files, Prof Brian Ripley, 09.01.2009 10:25) - [Rd] Warning: missing text for item ... in \describe? , Prof Brian Ripley, - -* FUNCTIONALS ---Expectation - +expectation gains (optional) low and upp arguments; - these can be passed through to var, skewness, kurtosis - +expectation gains explicit arguments to set accuracy locally; - +also both quantile and scale based methods is used to determine - a sensible integration range in expectation ---Quantiles: - -median and IQR are now defined for UnivariateCondDistribution ---general bug fixes: - -checked and fixed functionals (stirred up by mail by Jay Kerns, gkerns at ysu.edu) - -bug corrected in E for Hyper (thanks to Jay G. Kerns!) ... - -corrected small bug in mad, added new implementation for skewness and - kurtosis for signature "ANY". - -corrected small bug in skewness for AffLinDistribution. - -* DISTRIBUTIONS - + gains distribution Pareto; ported from pkg actuar by Nataliya Horbenko - +new slots d,p,q for Gumbel distribution catching errors, vectorization - and lower.tail, log[.p] argument ... - + new methods for Gumbel distribution ... - -* DISTANCES - + introduced distance OAsymTotalVarDist (minimal - asymmetric total variation distance) - + introduced new asymmetric total variation distance AsymTotalVarDist - + TotalVarDist and HellingerDist gain extra arguments - to better control the integration range and exactness - -* NEW FUNCTIONALS - + m1df for AffLinDistribution - + Expectation, var, IQR, median, skewness, kurtosis available for Pareto - -+... and: had forgotten to document the plot-methods in distrExsome typo's in integration range selection - -############## -v 2.0.3 -############## - - * under the hood: - + enhanced plotting (correct dispatch; opening of new device is controlled - by option("newDevice") ) - + after JMC's changes: - +gone through setIs relations to ensure - "correct" inheritance in Expectation, all the distance functionals - (ContaminationSize, HellingerDist,...), m1df,m2df - + buglet for AffLinDistribution in Skewness - + corrected small bug in mad, added new implementation for - skewness and kurtosis for signature "ANY" - - * moved license to LGPL-3 - * new methods for Gumbel distribution ... - - -############## -v 2.0 -############## - -* moved teaching illustrations to new package 'distrTeach' - -* E methods for class[es] '[AffLin]UnivarLebDecDistribution' - -* distance methods for class '[AffLin]UnivarLebDecDistribution' - -* CvM distance is implemented - -############## -v 1.9 -############## - -* 'distrEx' now behaves exactly the same as the other members - of the distrXXX family as to 'distrExOptions()', 'getdistrExOption()' - -* substantial contributions by Jay Kerns, gkerns at ysu.edu: - + skewness & kurtosis are now available as functionals - + E(), var() return NA in case of T-distribution if not defined - -* disclaimer for possible collisions with other definitions of - kurtosis and skewness - -* added note on masking on startup as well as disrExMASK() - -* enhanced 'illustrateCLT' - + plot includes a title - + for 'DiscreteDistributions' in the "d"-panel, the support is thinned - out if length too long - + Komogoroff-distance is printed out - + 'illustrateCLT' no longer is a generic function but a regular function - + the plotting feature of 'illustrateCLT' is extracted and has become - a generic function 'plotCLT' (now with title and the summands mentioned - in the header) - + there is a TclTk-based demo now (therefore TclTk is a suggested package now) - replaced recursive summation in illustrate-CLT method by 'convpow' - -* new demo 'illustLLN' and function 'illustrateLLN' - + preset strings similar to those of plot-methods from package 'distr' - -* moved some parts from package 'distrEx' to package 'distr' - + generating function 'DiscreteDistribution' - + univariate methods of 'liesInSupport()' - + classes 'DistrList' and 'UnivariateDistrList' - + generating functions EuclideanSpace() ,Reals(), Naturals() - -* mentioned in package-help: startup messages may now also be suppressed by - suppressPackageStartupMessages() (from package 'base') - -* adapted demo() to comply with change in return value of require() - from R-2.5.0patched on - -* formals for slots p,q,d as in package stats to enhance accuracy - - + p(X)(q, [cond,] lower.tail = TRUE, log.p = FALSE) - + q(X)(p, [cond,] lower.tail = TRUE, log.p = FALSE) - + d(X)(x, [cond,] log = FALSE) - - used wherever possible; - but backwards compatibility: - always checked whether lowert.tail / log / log.p are formals - - * some exact formulas for mad, median, and IQR - * new method for IQR for DiscreteDistributions taking care that between upper and lower - quartile there is 50% probability - * E-, var-, IQR-, mad-, median-, kurtosis-, skewness- methods - for new class union AffLinDistribution - -############## -v 1.8 -############## - -* changed to version counting of the remaining distrXXX packages -* corrected minor error in E() and var() method for Nbinom - (thanks to Spencer Graves for drawing our attention to this) -* fixed error in definition of Hellinger distance (HellingerDist) - -############## -v 0.4-4 -############## - -* dim() method for DiscreteMVDistribution -* var() + E() overloaded for DExp-Class -* sd()-method overwritten for Norm-Class to allow function / condition argument - -############## -v 0.4-3 -############## - -* Implementation of functionals: - o evaluation of exact expressions of E (expectation functional) for most specific distributions from stats package - o var, sd methods for UnivariateDistributions; these include calls like - - N <- Norm() - - var(N,function(t)abs(t)^(1/2)) # calculates Var[|N|^(1/2)] - - also (factorized) conditional variance is available - o evaluation of exact expressions of var for most specific distributions from stats package - o median, IQR, mad methods for UnivariateDistributions - o for var, sd, median, IQR, mad: all functionality/arguments of stats methods is/are preserved and - only if first argument / argument x is of class UnivariateDistribution (or descendant) a - different method is applied -* Internationalization: use of gettext, gettextf in output -* C-interface .GLaw() to replace respective R-Code in distrExintegrate.R -* PrognCondDistribution, PrognCondition are included as classes and generating functions (incl. show-method); -* Inclusion of demos (see above) - + PrognCondDistribution, PrognCondition are included as classes and generating functions (incl. show-method); - + illustrateCLT is included and rd-file is done - - -############## -v 0.4-2 -############## - -* ContaminationSize, HellingerDist, KolmogorovDist, TotalVarDist now return a list which consists of the corresponding distributions and their distance -* minor changes in m1df and m2df to increase speed of computation -* minor changes in DiscreteMVDistribution to increase speed of computation -* introduction of a new parameter useApply in methods for function E with default value TRUE +###################################################################### +# News: to package distrEx +###################################################################### + +(first two numbers of package versions do not necessarily reflect + package-individual development, but rather are chosen for the + distrXXX family as a whole in order to ease updating "depends" + information) + +############## +v 2.6 +############## + +user-visible CHANGES: ++ added generating function "EmpiricalMVDistribution" for computing + empirical distribution of multivariate data + +under the hood: ++ use particular S3-class "moved2RobExtremeClass" for + former package internal constants EULERMASCHERONICONSTANT and + APERYCONSTANT + + +############## +v 2.5 +############## + +user-visible CHANGES: + +GENERAL ENHANCEMENTS: ++ cleaned DESCRIPTION and NAMESPACE file as to Imports/Depends + +under the hood: ++ use some newly exmported routines which had been internal so far to + avoid calls by ::: ++ added .Rbuildignore + +BUGFIXES: + +############## +v 2.4 +############## + +user-visible CHANGES: ++ moved functionality for extreme value distribution to package RobExtremes +-> concerns distributions Gumbel, GEVD, GPareto, and Pareto ++ moved functional and estimator kMAD to package RobExtremes + +under the hood: ++ added DESCRIPTION tag "ByteCompile" to all our packages ++ updating maintainer email address and URL. ++ added argument no.readonly = TRUE to assignments of form opar <- par() ++ deleted no longer needed chm folders + + + +BUGFIXES: + ++ corrected bug in var() (with argument fun in case of symmetry) + +############## +v 2.3 +############## + +user-visible CHANGES: + ++ new default method for CvMDist (i.e. for mu=e2) instead of numerical + integration uses explicit terms => by factor 30 faster! + ++ Nataliya produced a C-version of kMad; integrated to distrEx now + ++ Generalized Extreme Value Distribution is ported to distrEx + ++ Gumbel in distrEx has different parametrization as GEV with shape = 0 + +under the hood: + ++ DESCRIPTION files and package-help files gain a tag + SVNRevision to be filled by get[All]RevNr.R from utils in distr + + +BUGFIXES: + ++ found a bug in setMethod("var", signature(x = "UnivariateDistribution")) + for spherical symmetric distributions + ++ Small bug in Expectation.R was found + ++ Gumbel in distrEx has different parametrization + as GEV with shape = 0 + ++ fixed several buglets in GEV + * small error for xi = 0 in Functionals.R and Expecation.R + * completed unfinished documentation + + +############## +v 2.2 +############## + +user-visible CHANGES: + ++ enhanced E() methods + * expectation gains ... argument to pass on accuracy arguments + ++ enhanced m1df(),m2df() methods + * m1df, m2df gain ... argument to be able to pass on accuracy arguments to E(); + * m1df, m2df can now digest cond, fun arguments... + * particular m1df versions (for Binom, Norm, Chisq, Exp, Pois) + are used in E(object, [fun, cond, ] low=.., upp=.., ...) calls ++ GPareto + * implemented GPareto class (Nataliya) [including functionals) + * allow for negative shape parameter in generalized Pareto ... + +GENERAL ENHANCEMENTS: + ++ added tests/Examples folder with file distrEx-Ex.Rout.save to have + some automatic testing ++ added field "Encoding: latin1" to all DESCRIPTION files in order to avoid problems + with e.g. Windows locale when svn replaces $LastChangedDate ++ added TOBEDONE (sic!) files for each package (by accident also in trunc; these are empty so far) + +INTERNALLY: + ++ introduced helper function .getIntbounds ++ reorganized help for PrognCondDistribution ++ functionals in distrEx now make use of this symmetry slot ... ++ catch errors thrown by qgumbel and qpareto1 when args are not in (0,1) + --> corresp. q-methods now consistently return NaN. ++ m1df,m2df: + *particular methods for m2df for AbscontDistribution, DiscreteDistribution are no longer necessary. + *new/revised methods for m1df, m2df for AfflinDistribution ++ enhanced/corrected methods for Kolmogorov distance + * when one operand is DiscreteDistribution + * yet another (speed) improvement --- important for MDE with KolmogorovDist: + Kolmogorov-dist e1 (discrete) : e2 (ac) is + x <- support(e1) + res <- max(p(e1)(x)-p(e2)(x),p(e2)(x)-p.l(e1)(x)) ++ merged Expectation_LebDec.R into Expectation.R + according to proposal by Kurt Hornik (different Collation order caused + problem in English locale) ++ new expectation methods for UnivarMixingDistribution ++ included new methods for E(): + * for GPareto as well as for Gammad + -> increase the precision for the numerical calculation of certain integrals; + in particular, integrals involving "log" as integrand. + * Expectation for GPareto now has IQR.fac accuracy set to + max(1e4,getdistrExOption("IQR.fac") to enhance accuracy for integration; + +BUGFIXES: + ++ forgot to commit branches/distr-2.2/pkg/distrEx/man/distrExConstants.Rd ++ forgot some source files (GPD) ++ fixed a buglet in m2df method for LatticeDistribution (a catch for existing fun argument was missing). ++ forgot to set corresponding distrExoptions()-default values for accuracy + for m1df, m2df ++ fixed a bug in E-method for AbscontDistribution, function, cond ++ fix for the bug in distrEx: m2df now only uses mc <- match.call() + instead of mc <- match.call(call = sys.call(sys.parent(1))) + (do not completely understand why: + there is method dispatch, though, as in plot(), where sys.call(sys.parent(1)) + is needed, but here match.call() does it... ) ++ fixed some --hard-to-detect/localize-- bug induced with lazy evaluation: + Data-Examples in scripts to ROptEst threw errors: reason --- need an + explicit assignment im ClippedMomemts.R (distrEx) mc$object <- object + to force evaluation of object (otherwise only transmitted as name...) ++ R CMD check threw an error for distrEx .Rd file distrExConstants.Rd : + probably because of a multi-line \deqn{}{} expression modified ++ corrected some bug with match.call() in Var()... ++ forgot to write the expectations of different components into different coordinates ++ Definition for KolmogorovDist for numeric, UnivariateDistribution + by means of ks.test was only oK for AbscontDistributions; changed to + KolmogorovDist(DiscreteDistribution(e1),e2) ++ fixed errors in expectation methods (with upper & lower bounds) + as well as in m1df, m2df methods + + + +############## +v 2.1 +############## + +* Rd-style: + + several buglets detected with the fuzzier checking mechanism + cf [Rd] More intensive checking of R help files, Prof Brian Ripley, 09.01.2009 10:25) + [Rd] Warning: missing text for item ... in \describe? , Prof Brian Ripley, + +* FUNCTIONALS +--Expectation + +expectation gains (optional) low and upp arguments; + these can be passed through to var, skewness, kurtosis + +expectation gains explicit arguments to set accuracy locally; + +also both quantile and scale based methods is used to determine + a sensible integration range in expectation +--Quantiles: + -median and IQR are now defined for UnivariateCondDistribution +--general bug fixes: + -checked and fixed functionals (stirred up by mail by Jay Kerns, gkerns at ysu.edu) + -bug corrected in E for Hyper (thanks to Jay G. Kerns!) ... + -corrected small bug in mad, added new implementation for skewness and + kurtosis for signature "ANY". + -corrected small bug in skewness for AffLinDistribution. + +* DISTRIBUTIONS + + gains distribution Pareto; ported from pkg actuar by Nataliya Horbenko + +new slots d,p,q for Gumbel distribution catching errors, vectorization + and lower.tail, log[.p] argument ... + + new methods for Gumbel distribution ... + +* DISTANCES + + introduced distance OAsymTotalVarDist (minimal + asymmetric total variation distance) + + introduced new asymmetric total variation distance AsymTotalVarDist + + TotalVarDist and HellingerDist gain extra arguments + to better control the integration range and exactness + +* NEW FUNCTIONALS + + m1df for AffLinDistribution + + Expectation, var, IQR, median, skewness, kurtosis available for Pareto + ++... and: had forgotten to document the plot-methods in distrExsome typo's in integration range selection + +############## +v 2.0.3 +############## + + * under the hood: + + enhanced plotting (correct dispatch; opening of new device is controlled + by option("newDevice") ) + + after JMC's changes: + +gone through setIs relations to ensure + "correct" inheritance in Expectation, all the distance functionals + (ContaminationSize, HellingerDist,...), m1df,m2df + + buglet for AffLinDistribution in Skewness + + corrected small bug in mad, added new implementation for + skewness and kurtosis for signature "ANY" + + * moved license to LGPL-3 + * new methods for Gumbel distribution ... + + +############## +v 2.0 +############## + +* moved teaching illustrations to new package 'distrTeach' + +* E methods for class[es] '[AffLin]UnivarLebDecDistribution' + +* distance methods for class '[AffLin]UnivarLebDecDistribution' + +* CvM distance is implemented + +############## +v 1.9 +############## + +* 'distrEx' now behaves exactly the same as the other members + of the distrXXX family as to 'distrExOptions()', 'getdistrExOption()' + +* substantial contributions by Jay Kerns, gkerns at ysu.edu: + + skewness & kurtosis are now available as functionals + + E(), var() return NA in case of T-distribution if not defined + +* disclaimer for possible collisions with other definitions of + kurtosis and skewness + +* added note on masking on startup as well as disrExMASK() + +* enhanced 'illustrateCLT' + + plot includes a title + + for 'DiscreteDistributions' in the "d"-panel, the support is thinned + out if length too long + + Komogoroff-distance is printed out + + 'illustrateCLT' no longer is a generic function but a regular function + + the plotting feature of 'illustrateCLT' is extracted and has become + a generic function 'plotCLT' (now with title and the summands mentioned + in the header) + + there is a TclTk-based demo now (therefore TclTk is a suggested package now) + replaced recursive summation in illustrate-CLT method by 'convpow' + +* new demo 'illustLLN' and function 'illustrateLLN' + + preset strings similar to those of plot-methods from package 'distr' + +* moved some parts from package 'distrEx' to package 'distr' + + generating function 'DiscreteDistribution' + + univariate methods of 'liesInSupport()' + + classes 'DistrList' and 'UnivariateDistrList' + + generating functions EuclideanSpace() ,Reals(), Naturals() + +* mentioned in package-help: startup messages may now also be suppressed by + suppressPackageStartupMessages() (from package 'base') + +* adapted demo() to comply with change in return value of require() + from R-2.5.0patched on + +* formals for slots p,q,d as in package stats to enhance accuracy + + + p(X)(q, [cond,] lower.tail = TRUE, log.p = FALSE) + + q(X)(p, [cond,] lower.tail = TRUE, log.p = FALSE) + + d(X)(x, [cond,] log = FALSE) + + used wherever possible; + but backwards compatibility: + always checked whether lowert.tail / log / log.p are formals + + * some exact formulas for mad, median, and IQR + * new method for IQR for DiscreteDistributions taking care that between upper and lower + quartile there is 50% probability + * E-, var-, IQR-, mad-, median-, kurtosis-, skewness- methods + for new class union AffLinDistribution + +############## +v 1.8 +############## + +* changed to version counting of the remaining distrXXX packages +* corrected minor error in E() and var() method for Nbinom + (thanks to Spencer Graves for drawing our attention to this) +* fixed error in definition of Hellinger distance (HellingerDist) + +############## +v 0.4-4 +############## + +* dim() method for DiscreteMVDistribution +* var() + E() overloaded for DExp-Class +* sd()-method overwritten for Norm-Class to allow function / condition argument + +############## +v 0.4-3 +############## + +* Implementation of functionals: + o evaluation of exact expressions of E (expectation functional) for most specific distributions from stats package + o var, sd methods for UnivariateDistributions; these include calls like + + N <- Norm() + + var(N,function(t)abs(t)^(1/2)) # calculates Var[|N|^(1/2)] + + also (factorized) conditional variance is available + o evaluation of exact expressions of var for most specific distributions from stats package + o median, IQR, mad methods for UnivariateDistributions + o for var, sd, median, IQR, mad: all functionality/arguments of stats methods is/are preserved and + only if first argument / argument x is of class UnivariateDistribution (or descendant) a + different method is applied +* Internationalization: use of gettext, gettextf in output +* C-interface .GLaw() to replace respective R-Code in distrExintegrate.R +* PrognCondDistribution, PrognCondition are included as classes and generating functions (incl. show-method); +* Inclusion of demos (see above) + + PrognCondDistribution, PrognCondition are included as classes and generating functions (incl. show-method); + + illustrateCLT is included and rd-file is done + + +############## +v 0.4-2 +############## + +* ContaminationSize, HellingerDist, KolmogorovDist, TotalVarDist now return a list which consists of the corresponding distributions and their distance +* minor changes in m1df and m2df to increase speed of computation +* minor changes in DiscreteMVDistribution to increase speed of computation +* introduction of a new parameter useApply in methods for function E with default value TRUE From noreply at r-forge.r-project.org Mon Aug 18 23:13:33 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 18 Aug 2014 23:13:33 +0200 (CEST) Subject: [Distr-commits] r963 - in pkg: distr utils Message-ID: <20140818211333.3E4821844D5@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-18 23:13:32 +0200 (Mon, 18 Aug 2014) New Revision: 963 Modified: pkg/distr/DESCRIPTION pkg/utils/showsvnlog.R Log: [utils] some further example of showsvnlog.R Modified: pkg/distr/DESCRIPTION =================================================================== --- pkg/distr/DESCRIPTION 2014-08-14 16:56:30 UTC (rev 962) +++ pkg/distr/DESCRIPTION 2014-08-18 21:13:32 UTC (rev 963) @@ -18,4 +18,4 @@ URL: http://distr.r-forge.r-project.org/ LastChangedDate: {$LastChangedDate$} LastChangedRevision: {$LastChangedRevision$} -SVNRevision: 910 +SVNRevision: 947 Modified: pkg/utils/showsvnlog.R =================================================================== --- pkg/utils/showsvnlog.R 2014-08-14 16:56:30 UTC (rev 962) +++ pkg/utils/showsvnlog.R 2014-08-18 21:13:32 UTC (rev 963) @@ -64,6 +64,7 @@ ### some examples showsvnlog(from=500,to=520) showsvnlog(from=300,to=Inf,limit=1000) +showsvnlog(from=912,to=Inf,limit=1000,con="C:/rtest/svnlog-distr-2.6.txt",withChPaths=TRUE) showsvnlog(from=833,to=Inf,limit=1000,con="C:/rtest/svnlog-distr-2.4-3.txt") showsvnlog(from=1,to=73,limit=1000,con="C:/rtest/svnlog-distr-00.txt",withrmtmp = FALSE,tmpfile = "C:/rtest/svnlog-distr-01.txt") showsvnlog("robast",from=1,to=Inf,limit=1000,con="C:/rtest/svnlog-robast.txt") From noreply at r-forge.r-project.org Tue Aug 19 02:11:33 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 19 Aug 2014 02:11:33 +0200 (CEST) Subject: [Distr-commits] r964 - in branches/distr-2.6/pkg/distr: R inst man Message-ID: <20140819001133.AEE831868C1@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-19 02:11:33 +0200 (Tue, 19 Aug 2014) New Revision: 964 Modified: branches/distr-2.6/pkg/distr/R/internalUtils.R branches/distr-2.6/pkg/distr/R/plot-methods.R branches/distr-2.6/pkg/distr/R/plot-methods_LebDec.R branches/distr-2.6/pkg/distr/inst/NEWS branches/distr-2.6/pkg/distr/man/internals.Rd branches/distr-2.6/pkg/distr/man/plot-methods.Rd Log: [distr] arguments panel.first, panel.last for plot-methods can now be lists; still does not work quite as desired (see example (plot)) Modified: branches/distr-2.6/pkg/distr/R/internalUtils.R =================================================================== --- branches/distr-2.6/pkg/distr/R/internalUtils.R 2014-08-18 21:13:32 UTC (rev 963) +++ branches/distr-2.6/pkg/distr/R/internalUtils.R 2014-08-19 00:11:33 UTC (rev 964) @@ -1272,4 +1272,18 @@ } - \ No newline at end of file +.panel.mingle <- function(dots, element){ + pF <- dots[[element]] + if(is.list(pF)) return(pF) + pFr <- if(typeof(pF)=="symbol") eval(pF) else{ + pFc <- as.call(pF) + if(as.list(pFc)[[1]] == "list"){ + lis <- vector("list",length(as.list(pFc))-1) + for(i in 1:length(lis)){ + lis[[i]] <- pFc[[i+1]] + } + lis + }else pF + } + return(pFr) +} Modified: branches/distr-2.6/pkg/distr/R/plot-methods.R =================================================================== --- branches/distr-2.6/pkg/distr/R/plot-methods.R 2014-08-18 21:13:32 UTC (rev 963) +++ branches/distr-2.6/pkg/distr/R/plot-methods.R 2014-08-19 00:11:33 UTC (rev 964) @@ -28,6 +28,18 @@ l.draw <- length(to.draw) + pF <- expression({}) + if(!is.null(dots[["panel.first"]])){ + pF <- .panel.mingle(dots,"panel.first") + } + pF <- .fillList(pF, l.draw) + pL <- expression({}) + if(!is.null(dots[["panel.last"]])){ + pL <- .panel.mingle(dots,"panel.last") + } + pL <- .fillList(pL, l.draw) + + dots$panel.first <- dots$panel.last <- NULL dots$col.hor <- NULL dots.for.points <- .makedotsPt(dots) @@ -231,12 +243,17 @@ } } + plotCount <- 1 o.warn <- getOption("warn"); options(warn = -1) if(1%in%to.draw){ on.exit(options(warn=o.warn)) - do.call(plot, c(list(x = grid, dxg, type = "l", + dots.without.pch$panel.first <- pF[[plotCount]] + dots.without.pch$panel.last <- pL[[plotCount]] + do.call(plot, c(list(x = grid, dxg, type = "l", ylim = ylim1, ylab = ylab0[["d"]], xlab = xlab0[["d"]], log = logpd), dots.without.pch)) + dots.without.pch$panel.first <- dots.without.pch$panel.last <- NULL + plotCount <- plotCount + 1 options(warn = o.warn) title(main = inner.d, line = lineT, cex.main = cex.inner, @@ -249,9 +266,13 @@ if(is.finite(q(x)(1))) {grid <- c(grid,q(x)(1)); pxg <- c(pxg,1)} if(2%in%to.draw){ - do.call(plot, c(list(x = grid, pxg, type = "l", + dots.without.pch$panel.first <- pF[[plotCount]] + dots.without.pch$panel.last <- pL[[plotCount]] + do.call(plot, c(list(x = grid, pxg, type = "l", ylim = ylim2, ylab = ylab0[["p"]], xlab = xlab0[["p"]], log = logpd), dots.without.pch)) + dots.without.pch$panel.first <- dots.without.pch$panel.last <- NULL + plotCount <- plotCount + 1 options(warn = o.warn) title(main = inner.p, line = lineT, cex.main = cex.inner, @@ -289,9 +310,13 @@ if(3%in%to.draw){ options(warn = -1) - do.call(plot, c(list(x = po, xo, type = "n", + dots.without.pch$panel.first <- pF[[plotCount]] + dots.without.pch$panel.last <- pL[[plotCount]] + do.call(plot, c(list(x = po, xo, type = "n", xlim = ylim2, ylim = xlim, ylab = ylab0[["q"]], xlab = xlab0[["q"]], log = logq), dots.without.pch)) + dots.without.pch$panel.first <- dots.without.pch$panel.last <- NULL + plotCount <- plotCount + 1 options(warn = o.warn) @@ -358,10 +383,21 @@ } l.draw <- length(to.draw) + pF <- expression({}) + if(!is.null(dots[["panel.first"]])){ + pF <- .panel.mingle(dots,"panel.first") + } + pF <- .fillList(pF, l.draw) + pL <- expression({}) + if(!is.null(dots[["panel.last"]])){ + pL <- .panel.mingle(dots,"panel.last") + } + pL <- .fillList(pL, l.draw) + dots$panel.first <- dots$panel.last <- NULL + dots$ngrid <- NULL dots.for.points <- .makedotsPt(dots) - print(dots.for.points) dots.lowlevel <- .makedotsLowLevel(dots) dots.without.pch <- dots.lowlevel[! (names(dots.lowlevel) %in% c("col", "pch"))] ### @@ -566,10 +602,17 @@ o.warn <- getOption("warn") options(warn = -1) on.exit(options(warn=o.warn)) + + plotCount <- 1 + if(1%in%to.draw){ + dots.without.pch$panel.first <- pF[[plotCount]] + dots.without.pch$panel.last <- pL[[plotCount]] do.call(plot, c(list(x = supp, dx, type = "h", pch = pch.a, ylim = ylim1, xlim=xlim, ylab = ylab0[["d"]], xlab = xlab0[["d"]], log = logpd), dots.without.pch)) + dots.without.pch$panel.first <- dots.without.pch$panel.last <- NULL + plotCount <- plotCount + 1 options(warn = o.warn) @@ -588,12 +631,16 @@ psupp1 <- c(0,p(x)(supp1)) if(2%in%to.draw){ - do.call(plot, c(list(x = stepfun(x = supp1, y = psupp1), + dots.without.pch$panel.first <- pF[[plotCount]] + dots.without.pch$panel.last <- pL[[plotCount]] + do.call(plot, c(list(x = stepfun(x = supp1, y = psupp1), main = "", verticals = verticals, do.points = FALSE, ylim = ylim2, ylab = ylab0[["p"]], xlab = xlab0[["p"]], col.hor = col.hor, col.vert = col.vert, log = logpd), dots.without.pch)) + dots.without.pch$panel.first <- dots.without.pch$panel.last <- NULL + plotCount <- plotCount + 1 if(do.points) {if(ngrid>1){ do.call(points, c(list(x = supp, y = psupp1[1:ngrid], pch = pch.u, @@ -621,7 +668,9 @@ if(3%in%to.draw){ options(warn = -1) - do.call(plot, c(list(x = stepfun(c(0,p(x)(supp)), + dots.without.pch$panel.first <- pF[[plotCount]] + dots.without.pch$panel.last <- pL[[plotCount]] + do.call(plot, c(list(x = stepfun(c(0,p(x)(supp)), c(NA,supp,NA), right = TRUE), main = "", xlim = ylim2, ylim = c(min(supp),max(supp)), ylab = ylab0[["q"]], xlab = xlab0[["q"]], @@ -630,6 +679,8 @@ col.points = col.points, col.hor = col.hor, col.vert = col.vert, log = logq), dots.without.pch)) + dots.without.pch$panel.first <- dots.without.pch$panel.last <- NULL + plotCount <- plotCount + 1 options(warn = o.warn) Modified: branches/distr-2.6/pkg/distr/R/plot-methods_LebDec.R =================================================================== --- branches/distr-2.6/pkg/distr/R/plot-methods_LebDec.R 2014-08-18 21:13:32 UTC (rev 963) +++ branches/distr-2.6/pkg/distr/R/plot-methods_LebDec.R 2014-08-19 00:11:33 UTC (rev 964) @@ -57,6 +57,19 @@ xlab0.d <- xlab0.c <- list("d"="x", "p"="q", "q"="p") ylab0.d <- ylab0.c <- list("d"="d(x)", "p"="p(q)", "q"="q(p)") + pF <<- expression({}) + if(!is.null(dots[["panel.first"]])){ + pF <<- .panel.mingle(dots,"panel.first") + } + pF <<- .fillList(pF, l.draw) + pL <<- expression({}) + if(!is.null(dots[["panel.last"]])){ + pL <<- .panel.mingle(dots,"panel.last") + } + pL <<- .fillList(pL, l.draw) + dots$panel.first <- dots$panel.last <- NULL + + plotCount <- 1 if(!is(x, "UnivarLebDecDistribution")) x <- .ULC.cast(x) @@ -64,6 +77,8 @@ mcl <- as.list(mc) mcl$to.draw.arg <- (1:3)[( (6:8) %in%to.draw )] mcl$ngrid <- NULL + mcl$panel.first <- pF[plotCount+(0:2)] + mcl$panel.last <- pL[plotCount+(0:2)] if(is.null(mcl$xlab)) mcl$xlab <- xlab0.d if(is.null(mcl$ylab)) mcl$ylab <- ylab0.d if(!is.logical(inner)){ @@ -80,6 +95,8 @@ mcl$col.hor <- NULL if(is.null(mcl$xlab)) mcl$xlab <- xlab0.c if(is.null(mcl$ylab)) mcl$ylab <- ylab0.c + mcl$panel.first <- pF[plotCount+(0:2)] + mcl$panel.last <- pL[plotCount+(0:2)] mcl$to.draw.arg <- (1:3)[( (3:5) %in%to.draw )] if(!is.logical(inner)){ if(length(inner)!=3) @@ -99,6 +116,8 @@ mcl$x <- x mcl$to.draw.arg <- (1:3)[( (6:8) %in%to.draw )] mcl$ngrid <- NULL + mcl$panel.first <- pF[5+mcl$to.draw.arg] + mcl$panel.last <- pL[5+mcl$to.draw.arg] if(!is.logical(inner)){ if(length(inner)!=3) {inner <- .fillList(inner, 8) @@ -116,6 +135,8 @@ mcl$x <- x mcl$to.draw.arg <- (1:3)[( (3:5) %in%to.draw )] mcl$col.hor <- NULL + mcl$panel.first <- pF[2+mcl$to.draw.arg] + mcl$panel.last <- pL[2+mcl$to.draw.arg] if(!is.logical(inner)){ if(length(inner)!=3) {inner <- .fillList(inner, 8) @@ -393,9 +414,13 @@ o.warn <- getOption("warn"); options(warn = -1) if(1 %in% to.draw){ on.exit(options(warn=o.warn)) + dots.without.pch$panel.first <- pF[[plotCount]] + dots.without.pch$panel.last <- pL[[plotCount]] do.call(plot, c(list(x = grid, pxg, type = "l", ylim = ylim2, ylab = ylab0[[1]][["p"]], xlab = xlab0[[1]][["p"]], log = logpd), dots.without.pch)) + dots.without.pch$panel.first <- dots.without.pch$panel.last <- NULL + plotCount <- plotCount + 1 options(warn = o.warn) pxg.d <- p(x)(supp) @@ -451,9 +476,13 @@ if(2 %in% to.draw){ options(warn = -1) + dots.without.pch$panel.first <- pF[[plotCount]] + dots.without.pch$panel.last <- pL[[plotCount]] do.call(plot, c(list(x = po, xo, type = "n", xlim = ylim2, ylim = xlim, ylab = ylab0[[1]][["q"]], xlab = xlab0[[1]][["q"]], log = logq), dots.without.pch), envir = parent.frame(2)) + plotCount <- plotCount + 1 + dots.without.pch$panel.first <- dots.without.pch$panel.last <- NULL options(warn = o.warn) @@ -516,7 +545,10 @@ mc.ac$withSweave <- TRUE mc.ac$to.draw.arg <- (1:3)[( (3:5) %in%to.draw )] if(is.null(mc.ac$cex.inner)) mc.ac$cex.inner <- 0.9 + mc.ac[["panel.first"]] <- pF[plotCount+(0:2)] + mc.ac[["panel.last"]] <- pL[plotCount+(0:2)] do.call(plotC, c(list(acPart(x)),mc.ac), envir = parent.frame(2)) + plotCount <- plotCount + 3 mc.di <- mc if(!is.logical(inner)) @@ -534,7 +566,10 @@ mc.di$withSweave <- TRUE mc.di$to.draw.arg <- (1:3)[( (6:8) %in%to.draw )] if(is.null(mc.di$cex.inner)) mc.di$cex.inner <- 0.9 + mc.di[["panel.first"]] <- pF[plotCount+(0:2)] + mc.di[["panel.last"]] <- pL[plotCount+(0:2)] do.call(plotD, c(list(discretePart(x)),mc.di), envir = parent.frame(2)) + plotCount <- plotCount + 3 return(invisible()) } Modified: branches/distr-2.6/pkg/distr/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distr/inst/NEWS 2014-08-18 21:13:32 UTC (rev 963) +++ branches/distr-2.6/pkg/distr/inst/NEWS 2014-08-19 00:11:33 UTC (rev 964) @@ -16,7 +16,8 @@ + updated references in vignette 'newDistributions' + added generating function "EmpiricalDistribution" which is a simple wrapper to function "DiscreteDistribution" - ++ arguments panel.first, panel.last for plot-methods can now be lists + under the hood: -qqplot: Modified: branches/distr-2.6/pkg/distr/man/internals.Rd =================================================================== --- branches/distr-2.6/pkg/distr/man/internals.Rd 2014-08-18 21:13:32 UTC (rev 963) +++ branches/distr-2.6/pkg/distr/man/internals.Rd 2014-08-19 00:11:33 UTC (rev 964) @@ -59,6 +59,7 @@ \alias{.DistrCollapse} \alias{.convDiscrDiscr} \alias{.inWithTol} +\alias{.panel.mingle} \alias{devNew} \title{Internal functions of package distr} @@ -134,6 +135,7 @@ .getCommonWidth(x1,x2, tol=.Machine$double.eps) .convDiscrDiscr(e1,e2) .inWithTol(x,y,tol=.Machine$double.eps) +.panel.mingle(dots,element) devNew(...) } @@ -241,6 +243,8 @@ \item{n2}{integer argument for \code{.EuclidAlgo}} \item{x1}{width argument for \code{.getCommonWidth}} \item{x2}{width argument for \code{.getCommonWidth}} + \item{dots}{the unevaluated \code{\dots} argument} + \item{element}{the name of the item in the unevaluated \code{\dots} argument} \item{...}{arguments passed through to other functions} } @@ -392,6 +396,13 @@ \code{.convDiscrDiscr} computes the convolution of two discrete distributions by brute force. \code{.inWithTol} works like \code{\%in\%} but with a given tolerance. + +\code{.panel.mingle} is used for mingling arguments \code{panel.first}, +\code{panel.last} in a plot; it returns the evaluated argument \code{element} +within dots, if it is a symbol; else if it can be interpreted as a call, and if +the top call is \code{list}, it returns a list of the items of the call to \code{list}, +unevaluated, and otherwise the unchanged argument. + \code{devNew} opens a new device. This function is for back compatibility with R versions < 2.8.0. } @@ -464,7 +475,12 @@ \item{.convDiscrDiscr}{returns the convolution of two discrete distributions.} \item{.inWithTol}{returns a logical vector of same lenght as \code{x} for the matches (up to tolerance) with vector \code{y}.} -\item{devNew}{returns the return value of the device opened, +\item{.panel.mingle}{used for mingling arguments \code{panel.first}, +\code{panel.last}; returns the evaluated argument \code{element} within dots, +if it is a symbol; else if it can be interpreted as a call, and if the top +call is \code{list}, it returns a list of the items of the call to \code{list}, +unevaluated, and otherwise the unchanged argument.} +\item{devNew}{returns the return value of the device opened, usually invisible \code{NULL}.} } Modified: branches/distr-2.6/pkg/distr/man/plot-methods.Rd =================================================================== --- branches/distr-2.6/pkg/distr/man/plot-methods.Rd 2014-08-18 21:13:32 UTC (rev 963) +++ branches/distr-2.6/pkg/distr/man/plot-methods.Rd 2014-08-19 00:11:33 UTC (rev 964) @@ -204,6 +204,13 @@ for titles. If no character substitutions and mathematical expressions are needed, character vectors of respective length instead of lists are also allowed for arguments \code{xlab}, \code{ylab}. + +In addition, argument \code{\dots} may contain arguments \code{panel.first}, +\code{panel.last}, i.e., hook expressions to be evaluated at the very beginning +and at the very end of each panel (within the then valid coordinates). +To be able to use these hooks for each panel individually, they may also be +lists of expressions (of the same length as the number of panels and +run through in the same order as the panels). } \examples{ @@ -229,6 +236,13 @@ "Pseudo-inverse with param's \%N"), sub = "this plot was correctly generated on \%D", cex.inner = 0.9, cex.sub = 0.8) + +plot(Norm(),panel.first=grid(4,4)) +## does not (yet) work as desired: +plot(Norm(),panel.first=list(grid(5,5),grid(3,3),grid(4,4))) +li <- list(substitute(grid(5,5)),substitute(grid(3,3)),substitute(grid(4,4))) +plot(Norm(),panel.first=li) + plot(Cauchy()) plot(Cauchy(), xlim = c(-4,4)) plot(Chisq()) From noreply at r-forge.r-project.org Tue Aug 19 02:27:04 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 19 Aug 2014 02:27:04 +0200 (CEST) Subject: [Distr-commits] r965 - in branches/distr-2.6/pkg/distrMod: R inst man Message-ID: <20140819002704.B4650187323@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-19 02:27:04 +0200 (Tue, 19 Aug 2014) New Revision: 965 Modified: branches/distr-2.6/pkg/distrMod/R/0distrModUtils.R branches/distr-2.6/pkg/distrMod/R/AllPlot.R branches/distr-2.6/pkg/distrMod/inst/NEWS branches/distr-2.6/pkg/distrMod/man/L2ParamFamily-class.Rd Log: [distrMod] arguments panel.first, panel.last for plot-methods can now be lists (see rev964 for distr) Modified: branches/distr-2.6/pkg/distrMod/R/0distrModUtils.R =================================================================== --- branches/distr-2.6/pkg/distrMod/R/0distrModUtils.R 2014-08-19 00:11:33 UTC (rev 964) +++ branches/distr-2.6/pkg/distrMod/R/0distrModUtils.R 2014-08-19 00:27:04 UTC (rev 965) @@ -709,6 +709,23 @@ return(outC) } +.panel.mingle <- function(dots, element){ + pF <- dots[[element]] + if(is.list(pF)) return(pF) + pFr <- if(typeof(pF)=="symbol") eval(pF) else{ + pFc <- as.call(pF) + if(as.list(pFc)[[1]] == "list"){ + lis <- vector("list",length(as.list(pFc))-1) + for(i in 1:length(lis)){ + lis[[i]] <- pFc[[i+1]] + } + lis + }else pF + } + return(pFr) +} + + #--------------------------------------------------- ### from packages stats: #--------------------------------------------------- Modified: branches/distr-2.6/pkg/distrMod/R/AllPlot.R =================================================================== --- branches/distr-2.6/pkg/distrMod/R/AllPlot.R 2014-08-19 00:11:33 UTC (rev 964) +++ branches/distr-2.6/pkg/distrMod/R/AllPlot.R 2014-08-19 00:27:04 UTC (rev 965) @@ -33,12 +33,25 @@ else if(is.numeric(to.draw.arg)) to.draw <- to.draw.arg } + l.draw <- length(to.draw) + + pF <- expression({}) + if(!is.null(dots[["panel.first"]])){ + pF <- .panel.mingle(dots,"panel.first") + } + pF <- .fillList(pF, l.draw) + pL <- expression({}) + if(!is.null(dots[["panel.last"]])){ + pl <- .panel.mingle(dots,"panel.last") + } + pL <- .fillList(pL, length(to.draw)) + plotCount <- 1 + l2dpl <- to.draw[to.draw > 3] dims0 <- length(l2dpl) nrows <- trunc(sqrt(dims0)) ncols <- ceiling(dims0/nrows) - if(!is.logical(inner)){ if(!is.list(inner)) inner <- as.list(inner) @@ -205,7 +218,10 @@ col.inner = col.inner, cex.inner = cex.innerD), dots, mfColRow = mfColRow) lis0$to.draw.arg <- todrw - do.call(plot, args = lis0) + lis0[["panel.first"]] <- pF[plotCount+(0:2)] + lis0[["panel.last"]] <- pL[plotCount+(0:2)] + do.call(plot, args = lis0) + plotCount <- plotCount + 1 } o.warn <- options("warn") options(warn = -1) @@ -229,11 +245,14 @@ for(i in 1:dims0){ indi <- l2dpl[i]-3 if(!is.null(ylim)) dots$ylim <- ylim[,d.0+d.1+i] + dots$panel.first <- pF[[plotCount]] + dots$panel.last <- pL[[plotCount]] do.call(plot, args=c(list(x=x.vec, y=sapply(x.vec, L2deriv at Map[[indi]]), type = plty, lty = lty, xlab = "x", ylab = expression(paste(L[2], " derivative"))), dots)) + plotCount <- plotCount + 1 if(is(e1, "DiscreteDistribution")){ x.vec1 <- seq(from = min(x.vec), to = max(x.vec), length = 1000) do.call(lines, args=c(list(x.vec1, sapply(x.vec1, L2deriv at Map[[indi]]), Modified: branches/distr-2.6/pkg/distrMod/inst/NEWS =================================================================== --- branches/distr-2.6/pkg/distrMod/inst/NEWS 2014-08-19 00:11:33 UTC (rev 964) +++ branches/distr-2.6/pkg/distrMod/inst/NEWS 2014-08-19 00:27:04 UTC (rev 965) @@ -13,6 +13,7 @@ user-visible CHANGES: + introduced dropZeroDensity argument to ML estimators ++ arguments panel.first, panel.last for plot-methods can now be lists GENERAL ENHANCEMENTS: Modified: branches/distr-2.6/pkg/distrMod/man/L2ParamFamily-class.Rd =================================================================== --- branches/distr-2.6/pkg/distrMod/man/L2ParamFamily-class.Rd 2014-08-19 00:11:33 UTC (rev 964) +++ branches/distr-2.6/pkg/distrMod/man/L2ParamFamily-class.Rd 2014-08-19 00:27:04 UTC (rev 965) @@ -203,6 +203,13 @@ in panels "d.c" and "d.d", and the last two elements are the values for \code{ylim} resp. \code{xlim} in panels "p", "p.c", "p.d" and "q", "q.c", "q.d". + +In addition, argument \code{\dots} may contain arguments \code{panel.first}, +\code{panel.last}, i.e., hook expressions to be evaluated at the very beginning +and at the very end of each panel (within the then valid coordinates). +To be able to use these hooks for each panel individually, they may also be +lists of expressions (of the same length as the number of panels and +run through in the same order as the panels). } From noreply at r-forge.r-project.org Tue Aug 19 03:48:23 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 19 Aug 2014 03:48:23 +0200 (CEST) Subject: [Distr-commits] r966 - branches/distr-2.6/pkg/distr/R Message-ID: <20140819014823.C0D211874EB@r-forge.r-project.org> Author: ruckdeschel Date: 2014-08-19 03:48:22 +0200 (Tue, 19 Aug 2014) New Revision: 966 Modified: branches/distr-2.6/pkg/distr/R/plot-methods_LebDec.R Log: [distr] removed <<- assignment in plot-methods_LebDec.R --- it did not help to fix the glitch with panel.first anyway, and later on RobAStBase complains about it Modified: branches/distr-2.6/pkg/distr/R/plot-methods_LebDec.R =================================================================== --- branches/distr-2.6/pkg/distr/R/plot-methods_LebDec.R 2014-08-19 00:27:04 UTC (rev 965) +++ branches/distr-2.6/pkg/distr/R/plot-methods_LebDec.R 2014-08-19 01:48:22 UTC (rev 966) @@ -57,16 +57,16 @@ xlab0.d <- xlab0.c <- list("d"="x", "p"="q", "q"="p") ylab0.d <- ylab0.c <- list("d"="d(x)", "p"="p(q)", "q"="q(p)") - pF <<- expression({}) + pF <- expression({}) if(!is.null(dots[["panel.first"]])){ - pF <<- .panel.mingle(dots,"panel.first") + pF <- .panel.mingle(dots,"panel.first") } - pF <<- .fillList(pF, l.draw) - pL <<- expression({}) + pF <- .fillList(pF, l.draw) + pL <- expression({}) if(!is.null(dots[["panel.last"]])){ - pL <<- .panel.mingle(dots,"panel.last") + pL <- .panel.mingle(dots,"panel.last") } - pL <<- .fillList(pL, l.draw) + pL <- .fillList(pL, l.draw) dots$panel.first <- dots$panel.last <- NULL plotCount <- 1