[Distr-commits] r1105 - in pkg/distrMod: . R man tests/Examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Apr 23 20:08:55 CEST 2016


Author: ruckdeschel
Date: 2016-04-23 20:08:54 +0200 (Sat, 23 Apr 2016)
New Revision: 1105

Removed:
   pkg/distrMod/man/internalmdeHelpers.Rd
Modified:
   pkg/distrMod/DESCRIPTION
   pkg/distrMod/R/0distrModUtils.R
   pkg/distrMod/R/qqplot.R
   pkg/distrMod/man/0distrMod-package.Rd
   pkg/distrMod/man/internals.Rd
   pkg/distrMod/man/qqplot.Rd
   pkg/distrMod/tests/Examples/distrMod-Ex.Rout.save
Log:
first attempt to get distrMod on CRAN

Modified: pkg/distrMod/DESCRIPTION
===================================================================
--- pkg/distrMod/DESCRIPTION	2016-04-23 17:09:34 UTC (rev 1104)
+++ pkg/distrMod/DESCRIPTION	2016-04-23 18:08:54 UTC (rev 1105)
@@ -1,6 +1,6 @@
 Package: distrMod
 Version: 2.6
-Date: 2015-11-07
+Date: 2016-04-23
 Title: Object Oriented Implementation of Probability Models
 Description: Implements S4 classes for probability models based on packages 'distr' and
         'distrEx'.
@@ -17,4 +17,4 @@
 URL: http://distr.r-forge.r-project.org/
 LastChangedDate: {$LastChangedDate$}
 LastChangedRevision: {$LastChangedRevision$}
-SVNRevision: 1080
+SVNRevision: 1104

Modified: pkg/distrMod/R/0distrModUtils.R
===================================================================
--- pkg/distrMod/R/0distrModUtils.R	2016-04-23 17:09:34 UTC (rev 1104)
+++ pkg/distrMod/R/0distrModUtils.R	2016-04-23 18:08:54 UTC (rev 1105)
@@ -106,56 +106,66 @@
    ## shift L2family to a parameter value as given in main(param)
    param0 <- L2Fam at param
    dim0 <- dimension(param0)
-#   print(param0)
    paramP <- param0
    paramP at main <- main(param)
    paramP at trafo <- diag(dim0)
-#   print(paramP)
    L2Fam <- modifyModel(L2Fam, paramP)
 
-#   print(L2deriv(L2Fam)[[1]]@Map)
    distr <- L2Fam at distribution
    
    ### get a sensible integration range:
-   low0 <- q(distr)(TruncQuantile) 
-   up0 <- q(distr)(TruncQuantile, lower.tail = FALSE) 
-   m0 <- median(distr); s0 <- IQR(distr)
-   low1 <- m0 - IQR.fac * s0
-   up1  <- m0 + IQR.fac * s0
-   low <- max(low0,low1); up <- min(up0,up1)
-
+   if(is(distr,"DiscreteDistribution")){
+       x.seq0 <- x.seq <- support(distr)
+       low <- min(x.seq)
+       up <- max(x.seq) 
+   }else{
    ### get a sensible integration range:
-   if(missing(mu)) mu <- distr
-   low0.mu <- q(mu)(TruncQuantile) 
-   up0.mu <- q(mu)(TruncQuantile, lower.tail = FALSE) 
-   m0.mu <- median(mu); s0.mu <- IQR(mu)
-   low1.mu <- m0.mu - IQR.fac * s0.mu
-   up1.mu  <- m0.mu + IQR.fac * s0.mu
-   low.mu <- max(low0.mu,low1.mu); up.mu <- min(up0.mu,up1.mu)
+       low0 <- q(distr)(TruncQuantile) 
+       up0 <- q(distr)(TruncQuantile, lower.tail = FALSE) 
+       m0 <- median(distr); s0 <- IQR(distr)
+       low1 <- m0 - IQR.fac * s0
+       up1  <- m0 + IQR.fac * s0
+       low <- max(low0,low1); up <- min(up0,up1)
+       if(is(distr,"AbscontDistribution")){
+          x.seq0 <- seq(low, up, length = N1)
+          h0 <- x.seq0[1:2]%*%c(-1,1)
+          x.seq <- x.seq0[odd]
+       }else{ 
+          x.seq0 <- x.seq <- seq(low,up, length = N)
+       }
+   }
 
-
-   if(is(distr,"DiscreteDistribution"))
-       x.seq <-support(distr)
-   else
-       {if(is(distr,"AbscontDistribution")){
-           x.seq0 <- seq(low, up, length = N1)
-           h0 <- x.seq0[1:2]%*%c(-1,1)
-           x.seq <- x.seq0[odd]
-          }else{ 
-           x.seq <- seq(low,up, length = N)
-          }
-       }
-   if(is(mu,"DiscreteDistribution"))
+   ## similar for mu
+   if(missing(mu)){
+      mu <- distr
+      low.mu <- low
+      up.mu <- up
+      x.mu.seq <- x.seq
+      if(is(distr,"AbscontDistribution")){
+         x.mu.seq0 <- x.seq0
+         h0.mu <- h0
+      }   
+   }else{
+     if(is(distr,"DiscreteDistribution")){
        x.mu.seq <- support(mu)
-   else
-       {if(is(mu,"AbscontDistribution")){
+       low.mu <- min(x.mu.seq)
+       up.mu <- max(x.mu.seq)
+     }else{ 
+       low0.mu <- q(mu)(TruncQuantile) 
+       up0.mu <- q(mu)(TruncQuantile, lower.tail = FALSE) 
+       m0.mu <- median(mu); s0.mu <- IQR(mu)
+       low1.mu <- m0.mu - IQR.fac * s0.mu
+       up1.mu  <- m0.mu + IQR.fac * s0.mu
+       low.mu <- max(low0.mu,low1.mu); up.mu <- min(up0.mu,up1.mu)
+       if(is(mu,"AbscontDistribution")){
            x.mu.seq0 <- seq(low.mu, up.mu, length = N1)
            h0.mu <- x.mu.seq0[1:2]%*%c(-1,1)
            x.mu.seq <- x.mu.seq0[odd]
-          }else{ 
+       }else{ 
            x.mu.seq <- seq(low.mu, up.mu, length = N)
-          }
        }
+     }
+   }
    
    L2deriv <- L2deriv(L2Fam)[[1]]
 #   y.seq <- sapply(x.seq, function(x) evalRandVar(L2deriv, x))
@@ -178,30 +188,35 @@
                  d(distr)(x.seq0)
       Delta0 <-  h0*.csimpsum(Delta0x)   
    }else{
-      L2x  <- function(x,y)  (x<=y)*evalRandVar(L2deriv, x)
-      Delta0 <- sapply(x.seq, function(Y){ fct <- function(x) L2x(x,y=Y)
+      if(is(distr,"DiscreteDistribution")){
+         Delta0x <- sapply(x.seq0, function(x) 
+                                evalRandVar(L2deriv, x)) * 
+                    d(distr)(x.seq0)
+         Delta0 <- cumsum(Delta0x)           
+      }else{
+         L2x  <- function(x,y)  (x<=y)*evalRandVar(L2deriv, x)
+         Delta0 <- sapply(x.seq, function(Y){ fct <- function(x) L2x(x,y=Y)
                                         return(E(object=distr, fun = fct))})
+      }                                  
    }
  #  print(Delta0)
    Delta1 <- approxfun(x.seq, Delta0, yleft = 0, yright = 0)
    if(is(distr,"DiscreteDistribution"))         
       Delta <- function(x) Delta1(x) * (x %in% support(distr))
-   else  Delta <- function(x) Delta1(x)
- #  print(Delta(x.seq))
+   else  Delta <- Delta1
+#   print(Delta(x.seq))
  #  print(Delta(rnorm(100)))
 
    ## J = Var_Ptheta Delta
-   J1 <- E(object=distr, fun = Delta)
 #   print(J1)
-   Delta.0 <- function(x) Delta(x) - J1
  #  print(Delta.0(x.seq))
  #  print(Delta.0(r(distr)(100))^2)
    #J <- distrExIntegrate(function(x) d(distr)(x)*Delta.0(x)^2, lower=low, upper=up)
-   J <- E(object=distr, fun = function(x) Delta.0(x)^2 )
+   J <- E(object=distr, fun = function(x) Delta(x)^2 )
 #   print(J)
    
    ### CvM-IC phi
-   phi <- function(x) Delta.0(x)/J
+   phi <- function(x) Delta(x)/J
 
    ## integrand phi x Ptheta in formula (51) [ibid]
    phi1 <- function(x) phi(x) * p(distr)(x)
@@ -236,13 +251,14 @@
    psi.01 <- function(x) psi.0(x)/E3
    if(withplot)
        { dev.new() #windows()
+         
          plot(x.seq, psi.01(x.seq),
                      type = if(is(distr,"DiscreteDistribution")) "p" else "l")
        }
    E4 <- E(object=distr, fun = function(x) psi.01(x)^2)
    psi.01 <- EuclRandVariable(Map = list(psi.01), Domain = Reals())
 
-#   print(list(E2,E4,E2-E4))
+#   print(list(E1,E2,E4,E2-E4))
 
       }else{
 
@@ -380,7 +396,7 @@
 B0 <- BinomFamily(size=8, prob=0.3);.CvMMDCovariance(B0,par=ParamFamParameter("",.3), withplot=TRUE)
 N0 <- NormLocationFamily();.CvMMDCovariance(N0,par=ParamFamParameter("",0), withplot=TRUE, N = 200)
 C0 <- L2LocationFamily(central=Cauchy());.CvMMDCovariance(C0,par=ParamFamParameter("",0), withplot=TRUE, N = 200)
-N1 <- NormScaleFamily(); re=.CvMMDCovariance(N1,par=ParamFamParameter("",1), withICwithplot=TRUE, N = 200)
+N1 <- NormScaleFamily(); re=.CvMMDCovariance(N1,par=ParamFamParameter("",1), withpreIC,withplot=TRUE, N = 200)
 NS <- NormLocationScaleFamily();paramP <- ParamFamParameter(name = "locscale", main = c("loc"=0,"scale"=1),trafo = diag(2));
       .CvMMDCovariance(NS,par=paramP, withplot=TRUE, N = 100)
 cls <- CauchyLocationScaleFamily();.CvMMDCovariance(cls,par=ParamFamParameter("",0:1), withplot=TRUE, N = 200)

Modified: pkg/distrMod/R/qqplot.R
===================================================================
--- pkg/distrMod/R/qqplot.R	2016-04-23 17:09:34 UTC (rev 1104)
+++ pkg/distrMod/R/qqplot.R	2016-04-23 18:08:54 UTC (rev 1105)
@@ -6,7 +6,7 @@
 
 
 ## helper into distrMod
-.labelprep <- function(x,y,lab.pts,col.lbl,cex.lbl,which.lbs,which.Order,order.traf){
+.labelprep <- function(x,y,lab.pts,col.lbl,cex.lbl,adj.lbl,which.lbs,which.Order,order.traf){
       n <- length(x)
       rx <- rank(x)
       xys <- cbind(x,y[rx])
@@ -26,7 +26,8 @@
       col.lbl <- col.lbl[rx]
       lab.pts <- lab.pts[rx]
       cex.lbl <- cex.lbl[rx]
-      return(list(x0=x0,y0=y0,lab=lab.pts[oN],col=col.lbl[oN],cex=cex.lbl[oN]))
+      adj.lbl <- adj.lbl[rx]
+      return(list(x0=x0,y0=y0,lab=lab.pts[oN],col=col.lbl[oN],cex=cex.lbl[oN],adj=adj.lbl[oN]))
 }
 
 
@@ -79,7 +80,7 @@
              col.pch = par("col"),## color for the plotted symbols
              cex.lbl = par("cex"),## magnification factor for the plotted observation labels
              col.lbl = par("col"),## color for the plotted observation labels
-             adj.lbl = NULL,      ## adj parameter for the plotted observation labels
+             adj.lbl = par("adj"),## adj parameter for the plotted observation labels
              alpha.trsp = NA,     ## alpha transparency to be added afterwards
              jit.fac = 0,         ## jittering factor used for discrete distributions
              jit.tol = .Machine$double.eps, ## tolerance for jittering: if distance 
@@ -134,6 +135,7 @@
              function(x,a) x else function(x,a) mapply(x,alp.t,a1=a)
     cex.pch <- .makeLenAndOrder(cex.pch,ord.x)
     cex.lbl <- .makeLenAndOrder(cex.lbl,ord.x)
+    adj.lbl <- .makeLenAndOrder(adj.lbl,ord.x)
     col.pch <- alp.f(.makeLenAndOrder(col.pch,ord.x),alp.v)
     col.lbl <- alp.f(.makeLenAndOrder(col.lbl,ord.x),alp.v)
 
@@ -190,14 +192,14 @@
     if(mfColRow) opar1 <- par(mfrow = c(1,1), no.readonly = TRUE)
 
     ret <- do.call(stats::qqplot, args=mcl)
-
+    lbprep <- NULL
     if(withLab&& plot.it){
        lbprep <- .labelprep(xj,yc,lab.pts,
-                            col.lbl,cex.lbl,which.lbs,which.Order,order.traf)
+                            col.lbl,cex.lbl, adj.lbl,which.lbs,which.Order,order.traf)
        xlb0 <- if(datax) lbprep$x0 else lbprep$y0
        ylb0 <- if(datax) lbprep$y0 else lbprep$x0
        text(x = xlb0, y = ylb0, labels = lbprep$lab,
-            cex = lbprep$cex, col = lbprep$col, adj = adj.lbl)
+            cex = lbprep$cex, col = lbprep$col, adj = lbprep$adj)
     }
 
     qqb <- NULL
@@ -232,6 +234,27 @@
              }
           }
 
+        qqplotInfo <- list(xy.0=xy, y.0=y, datax = datax, 
+                         withConf.pw=withConf.pw, 
+                         withConf.sim=withConf.sim, 
+                         alpha.CI=alpha.CI ,
+                         col.pCI = col.pCI , lty.pCI = lty.pCI , 
+                         lwd.pCI = lwd.pCI , pch.pCI = pch.pCI, 
+                         cex.pCI = cex.pCI , 
+                         col.sCI = col.sCI , lty.sCI = lty.sCI , 
+                         lwd.sCI = lwd.sCI , pch.sCI = pch.sCI, 
+                         cex.sCI = cex.sCI , 
+                         n = 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, 
+                  debug = debug,
+                  args.stats.qqplot = mcl,
+                  withLab = withLab,
+                  lbprep = lbprep
+                  )
         if(plot.it){
           qqb <- .confqq(xy, y, datax=datax, withConf.pw, withConf.sim, alpha.CI,
                       col.pCI, lty.pCI, lwd.pCI, pch.pCI, cex.pCI,
@@ -247,7 +270,9 @@
         }
        }
     }
-    return(invisible(c(ret,qqb)))
+    qqplotInfo <- c(ret, qqplotInfo, qqb)
+    class(qqplotInfo) <- c("qqplotInfo","DiagnInfo")
+    return(invisible(qqplotInfo))
     })
 
 ## into distrMod

Modified: pkg/distrMod/man/0distrMod-package.Rd
===================================================================
--- pkg/distrMod/man/0distrMod-package.Rd	2016-04-23 17:09:34 UTC (rev 1104)
+++ pkg/distrMod/man/0distrMod-package.Rd	2016-04-23 18:08:54 UTC (rev 1105)
@@ -16,7 +16,7 @@
 \tabular{ll}{
 Package: \tab distrMod \cr
 Version: \tab 2.6 \cr
-Date: \tab 2015-11-07 \cr
+Date: \tab 2016-04-23 \cr
 Depends: \tab R(>= 2.14.0), distr(>= 2.5.2), distrEx(>= 2.4), RandVar(>= 0.6.3), MASS, stats4,
         methods \cr
 Imports: \tab startupmsg, sfsmisc, graphics, stats, grDevices \cr
@@ -24,7 +24,7 @@
 ByteCompile: \tab yes \cr
 License: \tab LGPL-3 \cr
 URL: \tab http://distr.r-forge.r-project.org/\cr
-SVNRevision: \tab 1080 \cr
+SVNRevision: \tab 1104 \cr
 }}
 
 \section{Classes}{

Deleted: pkg/distrMod/man/internalmdeHelpers.Rd
===================================================================
--- pkg/distrMod/man/internalmdeHelpers.Rd	2016-04-23 17:09:34 UTC (rev 1104)
+++ pkg/distrMod/man/internalmdeHelpers.Rd	2016-04-23 18:08:54 UTC (rev 1105)
@@ -1,61 +0,0 @@
-\name{internal_mdehelpers_for_distrMod}
-\alias{internal_mdehelpers_for_distrMod}
-\alias{.CvMMDCovariance}
-
-\title{Internal helper functions for treating MDEstimators in package distrMod}
-
-\description{
-These functions are used internally by function \code{MDEstimator} in 
-package ``distrMod''.}
-
-\usage{
-.CvMMDCovariance<- function(L2Fam, param, mu = distribution(L2Fam),  
-                            withplot = FALSE, withpreIC = FALSE,
-                            N = getdistrOption("DefaultNrGridPoints")+1,
-                            rel.tol=.Machine$double.eps^0.3, 
-                            TruncQuantile = getdistrOption("TruncQuantile"), 
-                            IQR.fac = 15, 
-                            ...)
-}
-
-
-\arguments{
-  \item{L2Fam}{an object of class \code{L2ParamFamily}; 
-              the parametric family at which to evaluate the MCE}
-  \item{param}{an object of class \code{ParamFamParameter}; 
-               contains the parameter value at which to evaluate the 
-			   variance}
-  \item{mu}{an object of class \code{UnivariateDistribution}; 
-            the distribution on the reals at which to integrate the squared
-            distance of the cdf's in the CvM-distance}
-  \item{withplot}{logical; defaults to \code{FALSE}; if \code{TRUE} for diagnostic  
-                  purposes plots the influence function of the CvM-MDE}
-  \item{withpreIC}{logical; should corresponding IC of the CvM-MDE be returned?}
-  \item{\dots}{currently not used} 
-  \item{N}{integer; the number of grid points at which to evaluate the antiderivative
-          in case of an absolutely continuous distribution; more precisely, internally
-		  this becomes \eqn{2N+1}}
-  \item{rel.tol}{numeric; relative tolerance; currently not used}
-  \item{TruncQuantile}{numeric in (0,1); in case of an unbounded support of the 
-                       distribution the quantile level at which to cut the distribution}
-  \item{IQR.fac}{a positive numeric; a factor by which to multiply the IQR of the distribution
-                 to obtain a sensible cut of point for the integration bounds}
- }
-
-\details{
-\code{.CvMMDCovariance} computes the asymptotic covariance of the CvM-MDE according to
-H. Rieder (1994) "Robust Asymptotic Statistics".
- }
-
-\value{
-\item{.CvMMDCovariance}{if argument \code{withpreIC} is \code{TRUE}, then
-a list with elements the IC of the CvM-MDE and its covariance is returned, otherwise
-just the covariance}
-}
-
-\author{
-  Peter Ruckdeschel \email{peter.ruckdeschel at uni-oldenburg.de}
-}
-
-\keyword{internal}
-\concept{utilities}

Modified: pkg/distrMod/man/internals.Rd
===================================================================
--- pkg/distrMod/man/internals.Rd	2016-04-23 17:09:34 UTC (rev 1104)
+++ pkg/distrMod/man/internals.Rd	2016-04-23 18:08:54 UTC (rev 1105)
@@ -18,7 +18,7 @@
 .isUnitMatrix(m)
 .csimpsum(fx)
 .validTrafo(trafo, dimension, dimensionwithN)
-.CvMMDCovariance(L2Fam, param, mu = distribution(L2Fam),
+.CvMMDCovariance(L2Fam, param, mu = distribution(L2Fam),  
                  withplot = FALSE, withpreIC = FALSE,
                  N = getdistrOption("DefaultNrGridPoints")+1,
                  rel.tol=.Machine$double.eps^0.3, 
@@ -42,29 +42,30 @@
   \item{trafo}{an object of class \code{MatrixorFunction}}
   \item{dimension}{a numeric --- length of main part of the parameter}
   \item{dimensionwithN}{a numeric --- length of main and nuisance part of the parameter}
+
   \item{L2Fam}{an object of class \code{L2ParamFamily} --- for
   which we want to determine the IC resp. the as. [co]variance of the corresponding
   Minimum CvM estimator}
-  \item{param}{an object of class \code{ParamFamParameter}, the parameter value
-  at which we want to determine the IC resp. the as. [co]variance of the corresponding
-  Minimum CvM estimator}
   \item{mu}{an object of class \code{UnivariateDistribution}: integration 
             measure (resp. distribution) for CvM distance}
-  \item{rel.tol}{relative tolerance for \code{distrExIntegrate}.} 
-  \item{TruncQuantile}{quantile for quantile based integration range.}
-  \item{lowerTruncQuantile}{lower quantile for quantile based integration range.}
-  \item{upperTruncQuantile}{upper quantile for quantile based integration range.}
-  \item{IQR.fac}{factor for scale based integration range (i.e.; 
-  median of the distribution \eqn{\pm}{+-}\code{IQR.fac}\eqn{\times}{*}IQR).}
-  \item{withplot}{logical: shall we plot corresponding ICs?}
+  \item{withplot}{logical; defaults to \code{FALSE}; if \code{TRUE} for diagnostic  
+                  purposes plots the influence function of the CvM-MDE}
   \item{withpreIC}{logical: shall we return a list with components \code{preIC} 
        and \code{var} or just \code{var}; here \code{var} is the corresponding
        asymptotic variance and \code{preIC} the corresponding
    \code{EuclRandVarList} featuring as argument \code{Curve} in \code{IC}s of
    package \pkg{RobAStBase}}
-  \item{N}{a numeric: the number of gridpoints for constructing the 
-           \eqn{\mu}{mu}- resp. \eqn{P_\theta}{P_theta}-``primitive''
-           function}
+  \item{\dots}{currently not used} 
+  \item{N}{integer; the number of grid points at which to evaluate the antiderivative
+          in case of an absolutely continuous distribution; more precisely, internally
+		  this becomes \eqn{2N+1}}
+  \item{rel.tol}{relative tolerance for \code{distrExIntegrate}.} 
+  \item{TruncQuantile}{numeric in (0,1); in case of an unbounded support of the 
+                       distribution the quantile level at which to cut the distribution}
+  \item{IQR.fac}{a positive numeric; a factor by which to multiply the IQR of the distribution
+                 to obtain a sensible cut of point for the integration bounds}
+  \item{lowerTruncQuantile}{lower quantile for quantile based integration range.}
+  \item{upperTruncQuantile}{upper quantile for quantile based integration range.}
  \item{fx}{a vector of function evaluations multiplied by the gridwidth}
  \item{distr}{an object of class \code{AbscontDistribution}}
   \item{\dots}{further argument to be passed through --- so 
@@ -87,9 +88,8 @@
 
 \code{.validTrafo} checks whether the argument is a valid transformation.
 
-\code{.CvMMDCovariance} determines the IC resp. the as. [co]variance of 
-   the corresponding Minimum CvM estimator. Still some checking / optimization /
-   improvement needed.
+\code{.CvMMDCovariance} computes the asymptotic covariance of the CvM-MDE 
+according to H. Rieder (1994) "Robust Asymptotic Statistics".
 
 \code{.show.with.sd} is code borrowed from \code{print.fitdistr} in  
 package \pkg{MASS} by B.D. Ripley. It pretty-prints estimates with corresponding
@@ -115,6 +115,9 @@
    \code{preIC} and \code{var} ---see above}
 \item{.show.with.sd}{\code{invisible()}}
 \item{.deleteDim}{vector \code{x} without \code{dim} attribute}
+\item{.CvMMDCovariance}{if argument \code{withpreIC} is \code{TRUE}, then
+a list with elements the IC of the CvM-MDE and its covariance is returned, otherwise
+just the covariance}
 }
 
 \author{

Modified: pkg/distrMod/man/qqplot.Rd
===================================================================
--- pkg/distrMod/man/qqplot.Rd	2016-04-23 17:09:34 UTC (rev 1104)
+++ pkg/distrMod/man/qqplot.Rd	2016-04-23 18:08:54 UTC (rev 1105)
@@ -239,9 +239,9 @@
 }
 \examples{
 set.seed(123)
-x <- rnorm(40,mean=15,sd=30)
-qqplot(x, Chisq(df=15))
-NF <- NormLocationScaleFamily(mean=15, sd=30)
+x <- rnorm(40,mean=5,sd=sqrt(10))
+qqplot(x, Chisq(df=5))
+NF <- NormLocationScaleFamily(mean=5, sd=30^.5)
 qqplot(x, NF)
 mlE <- MLEstimator(x, NF)
 qqplot(x, mlE)

Modified: pkg/distrMod/tests/Examples/distrMod-Ex.Rout.save
===================================================================
--- pkg/distrMod/tests/Examples/distrMod-Ex.Rout.save	2016-04-23 17:09:34 UTC (rev 1104)
+++ pkg/distrMod/tests/Examples/distrMod-Ex.Rout.save	2016-04-23 18:08:54 UTC (rev 1105)
@@ -1,3179 +1,3178 @@
-
-R version 3.2.2 Patched (2015-11-06 r69612) -- "Fire Safety"
-Copyright (C) 2015 The R Foundation for Statistical Computing
-Platform: x86_64-pc-linux-gnu (64-bit)
-
-R is free software and comes with ABSOLUTELY NO WARRANTY.
-You are welcome to redistribute it under certain conditions.
-Type 'license()' or 'licence()' for distribution details.
-
-  Natural language support but running in an English locale
-
-R is a collaborative project with many contributors.
-Type 'contributors()' for more information and
-'citation()' on how to cite R or R packages in publications.
-
-Type 'demo()' for some demos, 'help()' for on-line help, or
-'help.start()' for an HTML browser interface to help.
-Type 'q()' to quit R.
-
-> pkgname <- "distrMod"
-> source(file.path(R.home("share"), "R", "examples-header.R"))
-> options(warn = 1)
-> library('distrMod')
-Loading required package: distr
-Loading required package: startupmsg
-:startupmsg>  Utilities for Start-Up Messages (version 0.9.1)
-:startupmsg> 
-:startupmsg>  For more information see ?"startupmsg",
-:startupmsg>  NEWS("startupmsg")
-
-Loading required package: sfsmisc
-Loading required package: SweaveListingUtils
-:SweaveListingUtils>  Utilities for Sweave Together with
-:SweaveListingUtils>  TeX 'listings' Package (version
-:SweaveListingUtils>  0.7)
-:SweaveListingUtils> 
-:SweaveListingUtils>  NOTE: Support for this package
-:SweaveListingUtils>  will stop soon.
-:SweaveListingUtils> 
-:SweaveListingUtils>  Package 'knitr' is providing the
-:SweaveListingUtils>  same functionality in a better
-:SweaveListingUtils>  way.
-:SweaveListingUtils> 
-:SweaveListingUtils>  Some functions from package 'base'
-:SweaveListingUtils>  are intentionally masked ---see
-:SweaveListingUtils>  SweaveListingMASK().
-:SweaveListingUtils> 
-:SweaveListingUtils>  Note that global options are
-:SweaveListingUtils>  controlled by
-:SweaveListingUtils>  SweaveListingoptions() ---c.f.
-:SweaveListingUtils>  ?"SweaveListingoptions".
-:SweaveListingUtils> 
-:SweaveListingUtils>  For more information see
-:SweaveListingUtils>  ?"SweaveListingUtils",
-:SweaveListingUtils>  NEWS("SweaveListingUtils")
-:SweaveListingUtils>  There is a vignette to this
-:SweaveListingUtils>  package; try
-:SweaveListingUtils>  vignette("ExampleSweaveListingUtils").
-
-
-Attaching package: ‘SweaveListingUtils’
-
-The following objects are masked from ‘package:base’:
-
-    library, require
-
-:distr>  Object Oriented Implementation of Distributions (version
-:distr>  2.6)
-:distr> 
-:distr>  Attention: Arithmetics on distribution objects are
-:distr>  understood as operations on corresponding random variables
-:distr>  (r.v.s); see distrARITH().
-:distr> 
-:distr>  Some functions from package 'stats' are intentionally masked
-:distr>  ---see distrMASK().
-:distr> 
-:distr>  Note that global options are controlled by distroptions()
-:distr>  ---c.f. ?"distroptions".
-:distr> 
-:distr>  For more information see ?"distr", NEWS("distr"), as well as
-:distr>    http://distr.r-forge.r-project.org/
-:distr>  Package "distrDoc" provides a vignette to this package as
-:distr>  well as to several extension packages; try
-:distr>  vignette("distr").
-
-
-Attaching package: ‘distr’
-
-The following objects are masked from ‘package:stats’:
-
-    df, qqplot, sd
-
-Loading required package: distrEx
-:distrEx>  Extensions of Package 'distr' (version 2.6)
-:distrEx> 
-:distrEx>  Note: Packages "e1071", "moments", "fBasics" should be
-:distrEx>  attached /before/ package "distrEx". See
-:distrEx>  distrExMASK().Note: Extreme value distribution
-:distrEx>  functionality has been moved to
-:distrEx> 
-:distrEx>        package "RobExtremes". See distrExMOVED().
-:distrEx> 
-:distrEx>  For more information see ?"distrEx", NEWS("distrEx"), as
-:distrEx>  well as
-:distrEx>    http://distr.r-forge.r-project.org/
-:distrEx>  Package "distrDoc" provides a vignette to this package
-:distrEx>  as well as to several related packages; try
-:distrEx>  vignette("distr").
-
-
-Attaching package: ‘distrEx’
-
-The following objects are masked from ‘package:stats’:
-
-    IQR, mad, median, var
-
-Loading required package: RandVar
-:RandVar>  Implementation of random variables (version 0.9.2)
-:RandVar> 
-:RandVar>  For more information see ?"RandVar", NEWS("RandVar"), as
-:RandVar>  well as
-:RandVar>    http://robast.r-forge.r-project.org/
-:RandVar>  This package also includes a vignette; try
-:RandVar>  vignette("RandVar").
-
-Loading required package: MASS
-Loading required package: stats4
-:distrMod>  Object Oriented Implementation of Probability Models
-:distrMod>  (version 2.6)
-:distrMod> 
-:distrMod>  Some functions from pkg's 'base' and 'stats' are
-:distrMod>  intentionally masked ---see distrModMASK().
-:distrMod> 
-:distrMod>  Note that global options are controlled by
-:distrMod>  distrModoptions() ---c.f. ?"distrModoptions".
-:distrMod> 
-:distrMod>  For more information see ?"distrMod",
-:distrMod>  NEWS("distrMod"), as well as
-:distrMod>    http://distr.r-forge.r-project.org/
-:distrMod>  There is a vignette to this package; try
-:distrMod>  vignette("distrMod").
-:distrMod>  Package "distrDoc" provides a vignette to the other
-:distrMod>  distrXXX packages,
-:distrMod>  as well as to several related packages; try
-:distrMod>  vignette("distr").
-
-
-Attaching package: ‘distrMod’
-
-The following object is masked from ‘package:stats4’:
-
-    confint
-
-The following object is masked from ‘package:stats’:
-
-    confint
-
-The following object is masked from ‘package:base’:
-
-    norm
-
-> 
-> base::assign(".oldSearch", base::search(), pos = 'CheckExEnv')
-> cleanEx()
-> nameEx("BetaFamily")
-> ### * BetaFamily
-> 
-> flush(stderr()); flush(stdout())
-> 
-> ### Name: BetaFamily
-> ### Title: Generating function for Beta families
-> ### Aliases: BetaFamily
-> ### Keywords: models
-> 
-> ### ** Examples
-> 
-> (B1 <- BetaFamily())
-An object of class "BetaFamily"
-### name:	Beta family
-
-### distribution:	Distribution Object of Class: Beta
- shape1: 1
- shape2: 1
- ncp: 0
-
-### param:	An object of class "ParamFamParameter"
-name:	shape1 and shape2
-shape1:	1
-shape2:	1
-trafo:
-       shape1 shape2
-shape1      1      0
-shape2      0      1
-
-### props:
-[1] "The Beta family is invariant in the following sense"
-[2] "if (x_i)~Beta(s1,s2) then (1-x_i)~Beta(s2,s1)"      
-> FisherInfo(B1)
-An object of class "PosSemDefSymmMatrix"
-           shape1     shape2
-shape1  1.0000000 -0.6449341
-shape2 -0.6449341  1.0000000
-> checkL2deriv(B1)
-precision of centering:	 3.96327e-05 3.963591e-05 
-precision of Fisher information:
-              shape1        shape2
-shape1 -1.851068e-05  1.648326e-06
-shape2  1.648326e-06 -1.851068e-05
-precision of Fisher information - relativ error [%]:
-              shape1        shape2
-shape1 -0.0018510679 -0.0002555806
-shape2 -0.0002555806 -0.0018510679
-condition of Fisher information:
-[1] 5.277691
-$maximum.deviation
-[1] 3.963591e-05
-
-> 
-> 
-> 
-> cleanEx()
-> nameEx("BiasType-class")
-> ### * BiasType-class
-> 
-> flush(stderr()); flush(stdout())
-> 
-> ### Name: BiasType-class
-> ### Title: Bias Type
-> ### Aliases: BiasType-class name,BiasType-method name<-,BiasType-method
-> ### Keywords: classes
-> 
-> ### ** Examples
-> 
-> aB <- positiveBias()
-> name(aB)
-[1] "positive Bias"
-> 
-> 
-> 
-> cleanEx()
-> nameEx("BinomFamily")
-> ### * BinomFamily
-> 
-> flush(stderr()); flush(stdout())
-> 
-> ### Name: BinomFamily
-> ### Title: Generating function for Binomial families
-> ### Aliases: BinomFamily
-> ### Keywords: models
-> 
-> ### ** Examples
-> 
-> (B1 <- BinomFamily(size = 25, prob = 0.25))
-An object of class "BinomFamily"
-### name:	Binomial family
-
-### distribution:	Distribution Object of Class: Binom
- size: 25
- prob: 0.25
-
-### param:	An object of class "ParamFamParameter"
-name:	probability of success
-prob:	0.25
-fixed part of param.:
-	size:	25
-trafo:
-     prob
-prob    1
-
-### props:
-[1] "The Binomial family is symmetric with respect to prob = 0.5;"
-[2] "i.e., d(Binom(size, prob))(k)=d(Binom(size,1-prob))(size-k)" 
-> plot(B1)
-> FisherInfo(B1)
-An object of class "PosSemDefSymmMatrix"
-         prob
-prob 133.3333
-> checkL2deriv(B1)
-precision of centering:	 -1.099042e-15 
-precision of Fisher information:
-             prob
-prob 2.842171e-14
-precision of Fisher information - relativ error [%]:
-             prob
-prob 2.131628e-14
-condition of Fisher information:
-[1] 1
-$maximum.deviation
-[1] 2.842171e-14
-
-> 
-> 
-> 
-> cleanEx()
-> nameEx("CauchyLocationScaleFamily")
-> ### * CauchyLocationScaleFamily
-> 
-> flush(stderr()); flush(stdout())
-> 
-> ### Name: CauchyLocationScaleFamily
-> ### Title: Generating function for Cauchy location and scale families
-> ### Aliases: CauchyLocationScaleFamily
-> ### Keywords: models
-> 
-> ### ** Examples
-> 
-> (C1 <- CauchyLocationScaleFamily())
-An object of class "CauchyLocationScaleFamily"
-### name:	Cauchy Location and scale family
-
-### distribution:	Distribution Object of Class: Cauchy
- location: 0
- scale: 1
-
-### param:	An object of class "ParamWithScaleFamParameter"
-name:	location and scale
-loc:	0
-scale:	1
-trafo:
-      loc scale
-loc     1     0
-scale   0     1
-
-### props:
-[1] "The Cauchy Location and scale family is invariant under"  
-[2] "the group of transformations 'g(x) = scale*x + loc'"      
-[3] "with location parameter 'loc' and scale parameter 'scale'"
-> plot(C1)
-> FisherInfo(C1)
-An object of class "PosDefSymmMatrix"
-      loc scale
-loc   0.5   0.0
-scale 0.0   0.5
-> ### need smaller integration range:
-> distrExoptions("ElowerTruncQuantile"=1e-4,"EupperTruncQuantile"=1e-4)
-> checkL2deriv(C1)
-precision of centering:	 0 -0.02119711 
-precision of Fisher information:
-                loc       scale
-loc   -3.137524e-05  0.00000000
-scale  0.000000e+00 -0.02118143
-precision of Fisher information - relativ error [%]:
-               loc     scale
-loc   -0.006275047       NaN
-scale          NaN -4.236286
-condition of Fisher information:
-[1] 1
-$maximum.deviation
-[1] 0.02119711
-
-> distrExoptions("ElowerTruncQuantile"=1e-7,"EupperTruncQuantile"=1e-7)
-> 
-> 
-> 
-> cleanEx()
-> nameEx("Confint-class")
-> ### * Confint-class
-> 
-> flush(stderr()); flush(stdout())
-> 
-> ### Name: Confint-class
-> ### Title: Confint-class
-> ### Aliases: Confint-class type,Confint-method call.estimate
-> ###   call.estimate,Confint-method confint,Confint,missing-method
-> ###   name.estimate name.estimate,Confint-method trafo.estimate
-> ###   trafo.estimate,Confint-method samplesize.estimate
-> ###   samplesize.estimate,Confint-method completecases.estimate
-> ###   completecases.estimate,Confint-method nuisance.estimate
-> ###   nuisance.estimate,Confint-method fixed.estimate
-> ###   fixed.estimate,Confint-method show,Confint-method
-> ###   print,Confint-method
-> ### Keywords: classes
-> 
-> ### ** Examples
-> 
-> ## some transformation
-> mtrafo <- function(x){
-+      nms0 <- c("scale","shape")
-+      nms <- c("shape","rate")
-+      fval0 <- c(x[2], 1/x[1])
-+      names(fval0) <- nms
-+      mat0 <- matrix( c(0, -1/x[1]^2, 1, 0), nrow = 2, ncol = 2,
-+                      dimnames = list(nms,nms0))                          
-+      list(fval = fval0, mat = mat0)}
-> 
-> x <- rgamma(50, scale = 0.5, shape = 3)
-> 
-> ## parametric family of probability measures
-> G <- GammaFamily(scale = 1, shape = 2, trafo = mtrafo)
-> ## MLE
-> res <- MLEstimator(x = x, ParamFamily = G)
-> ci <- confint(res)
-> print(ci, digits = 4, show.details="maximal")
-A[n] asymptotic (CLT-based) confidence interval:
-      2.5 % 97.5 %
-shape 2.530  5.591
-rate  1.751  4.097
-Type of estimator: Maximum likelihood estimate
-samplesize:   50
-Call by which estimate was produced:
-MLEstimator(x = x, ParamFamily = G)
-Transformation of main parameter by which estimate was produced:
-function (x) 
-{
-    nms0 <- c("scale", "shape")
-    nms <- c("shape", "rate")
-    fval0 <- c(x[2], 1/x[1])
-    names(fval0) <- nms
-    mat0 <- matrix(c(0, -1/x[1]^2, 1, 0), nrow = 2, ncol = 2, 
-        dimnames = list(nms, nms0))
-    list(fval = fval0, mat = mat0)
-}
-Trafo / derivative matrix at which estimate was produced:
-       scale shape
-shape  0.000     1
-rate  -8.549     0
-> print(ci, digits = 4, show.details="medium")
-A[n] asymptotic (CLT-based) confidence interval:
-      2.5 % 97.5 %
-shape 2.530  5.591
-rate  1.751  4.097
-Type of estimator: Maximum likelihood estimate
-samplesize:   50
-Call by which estimate was produced:
-MLEstimator(x = x, ParamFamily = G)
-> print(ci, digits = 4, show.details="minimal")
-A[n] asymptotic (CLT-based) confidence interval:
-      2.5 % 97.5 %
-shape 2.530  5.591
-rate  1.751  4.097
-> 
-> 
-> 
-> cleanEx()
-> nameEx("Estimate-class")
-> ### * Estimate-class
-> 
-> flush(stderr()); flush(stdout())
-> 
-> ### Name: Estimate-class
-> ### Title: Estimate-class.
-> ### Aliases: Estimate-class name,Estimate-method name<-,Estimate-method
-> ###   estimate estimate,Estimate-method estimate.call
-> ###   estimate.call,Estimate-method Infos Infos,Estimate-method samplesize
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/distr -r 1105


More information about the Distr-commits mailing list