[Distr-commits] r1338 - branches/distr-2.9/pkg/distrMod branches/distr-2.9/pkg/distrMod/R branches/distr-2.9/pkg/distrMod/inst branches/distr-2.9/pkg/distrMod/man branches/distr-2.9/pkg/distrMod/tests/Examples pkg/distrMod pkg/distrMod/R pkg/distrMod/inst pkg/distrMod/man pkg/distrMod/tests/Examples pkg/utils

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Apr 7 11:57:57 CEST 2019


Author: ruckdeschel
Date: 2019-04-07 11:57:56 +0200 (Sun, 07 Apr 2019)
New Revision: 1338

Modified:
   branches/distr-2.9/pkg/distrMod/NAMESPACE
   branches/distr-2.9/pkg/distrMod/R/L2ParamFamily.R
   branches/distr-2.9/pkg/distrMod/inst/NEWS
   branches/distr-2.9/pkg/distrMod/man/checkL2deriv.Rd
   branches/distr-2.9/pkg/distrMod/tests/Examples/distrMod-Ex.Rout.save
   pkg/distrMod/DESCRIPTION
   pkg/distrMod/NAMESPACE
   pkg/distrMod/R/L2ParamFamily.R
   pkg/distrMod/inst/NEWS
   pkg/distrMod/man/0distrMod-package.Rd
   pkg/distrMod/man/checkL2deriv.Rd
   pkg/distrMod/tests/Examples/distrMod-Ex.Rout.save
   pkg/utils/DESCRIPTIONutilsExamples.R
Log:
[distrMod] 
Kurt Hornik spotted that we failed to really fix the issue about machine-dependent diagnostic output on accuracies in checkL2deriv. This is fixed now in trunk in distrMod_2.8.1 (submitted to CRAN Apr07) and merged back to branch 2.9. From the entry in NEWS 

user-visible CHANGES:
#############
v 2.8.1
#############
user-visible changes 
+ revised code to delete fuzz when checking the centering/consistency of L2deriv varying from  -- relative accuracy is now determined by the size of FI 
under the hood:
+ introduce S3 class "relMatrix" (and S3 method print.relMatrix) to capture the fact that when computing relative differences in consistency matrices, some entries in the denominator may 
  be 0; in order to avoid output of Inf / NaN we catch the output and replace such entries by "."


Modified: branches/distr-2.9/pkg/distrMod/NAMESPACE
===================================================================
--- branches/distr-2.9/pkg/distrMod/NAMESPACE	2019-04-02 19:10:55 UTC (rev 1337)
+++ branches/distr-2.9/pkg/distrMod/NAMESPACE	2019-04-07 09:57:56 UTC (rev 1338)
@@ -97,3 +97,4 @@
 export("addAlphTrsp2col")
 export(".deleteDim",".isUnitMatrix",
        ".CvMMDCovariance", ".oldCvMMDCovariance", ".CvMMDCovarianceWithMux")
+S3method(print, relMatrix)
\ No newline at end of file

Modified: branches/distr-2.9/pkg/distrMod/R/L2ParamFamily.R
===================================================================
--- branches/distr-2.9/pkg/distrMod/R/L2ParamFamily.R	2019-04-02 19:10:55 UTC (rev 1337)
+++ branches/distr-2.9/pkg/distrMod/R/L2ParamFamily.R	2019-04-07 09:57:56 UTC (rev 1338)
@@ -187,22 +187,27 @@
 
         cent <- E(object = L2Fam, fun = L2deriv)
 
+        FI <- as(L2Fam at FisherInfo, "matrix")
+        Prec <- ceiling(12-round(max(log(abs(FI)+1e-14,10)))/2)
+
         if(out){
-     	     PrecCent <- 12-round(max(log(abs(cent)+1e-14)),10)
-           cent.out <- round(cent*10^PrecCent)/10^PrecCent
+           cent.out <- round(cent*10^Prec)/10^Prec
            cat("precision of centering:\t", cent.out, "\n")
         }
         consist <- E(object = L2Fam, fun = L2deriv %*% t(L2deriv))
-        FI <- as(L2Fam at FisherInfo, "matrix")
         consist <- consist - FI
         if(out){
             oldOps <- options()
             on.exit(do.call(options,oldOps))
+            consist.out <- round(consist*10^Prec)/10^Prec
             options(digits=5,scipen=-2)
             cat("precision of Fisher information:\n")
-            print(consist)
+            print(consist.out)
+
             cat("precision of Fisher information - relativ error [%]:\n")
-            print(100*consist/FI)
+            relconsist.out <- round(consist/FI*10^(Prec+2))/10^Prec
+            class(relconsist.out) <- c("relMatrix",class(consist.out))
+            print(relconsist.out)
 
             cat("condition of Fisher information:\n")
             print(kappa(FI))
@@ -216,3 +221,20 @@
         return(invisible(ret.value))
     })
 
+### helper functions/S3 methods for output of rel differences when denominator
+##  can be 0
+
+.toForMat <- function(x){ ## replace NaN positions by "."
+                diX <- dim(x)
+                x0 <- format(x,nsmall=3,digits=3)
+                x0[is.na(x)] <- "."
+                x0[!is.finite(x)] <- "."
+                dim(x0) <- diX
+                x0
+                }
+
+print.relMatrix <- function(x,...){
+                      x1 <- .toForMat(x)
+                      print(x1, quote=FALSE)
+                      return(invisible(NULL))
+                      }
\ No newline at end of file

Modified: branches/distr-2.9/pkg/distrMod/inst/NEWS
===================================================================
--- branches/distr-2.9/pkg/distrMod/inst/NEWS	2019-04-02 19:10:55 UTC (rev 1337)
+++ branches/distr-2.9/pkg/distrMod/inst/NEWS	2019-04-07 09:57:56 UTC (rev 1338)
@@ -8,6 +8,22 @@
  information)
 
 ##############
+v 2.9
+##############
+
+##############
+v 2.8.1
+##############
+user-visible CHANGES:
++ revised code to delete fuzz when checking the centering/consistency of L2deriv varying from 
+  -- relative accuracy is now determined by the size of FI 
+under the hood:
++ introduce S3 class "relMatrix" (and S3 method print.relMatrix) to capture the fact that when 
+  computing relative differences in consistency matrices, some entries in the denominator may 
+  be 0; in order to avoid output of Inf / NaN we catch the output and replace such entries 
+  by "."
+
+##############
 v 2.8
 ##############
 

Modified: branches/distr-2.9/pkg/distrMod/man/checkL2deriv.Rd
===================================================================
--- branches/distr-2.9/pkg/distrMod/man/checkL2deriv.Rd	2019-04-02 19:10:55 UTC (rev 1337)
+++ branches/distr-2.9/pkg/distrMod/man/checkL2deriv.Rd	2019-04-07 09:57:56 UTC (rev 1338)
@@ -1,5 +1,6 @@
 \name{checkL2deriv}
 \alias{checkL2deriv}
+\alias{print.relMatrix}
 
 \title{Generic function for checking L2-derivatives}
 \description{
@@ -8,10 +9,13 @@
 }
 \usage{
 checkL2deriv(L2Fam, ...)
+\method{print}{relMatrix}(x,...)
 }
 \arguments{
   \item{L2Fam}{ L2-differentiable family of probability measures }
-  \item{\dots}{ additional parameters }
+  \item{x}{ argument to be printed }
+  \item{\dots}{ additional parameters (ignored/for compatibility with S3 generic 
+                in case \code{print.relMatrix}) }
 }
 \details{ 
   The precisions of the centering and the Fisher information
@@ -27,7 +31,11 @@
 
 \note{The return value gives the non-rounded values (which will be machine dependent),
       whereas on argument \code{out==TRUE} (the default) we only issue the values up to
-     5 digits which should be independent of the machine.}
+      5 digits which should be independent of the machine. For the output of relative
+	  differences, we adjust accuracy to the size of the maximal (absolute) value of 
+	  the Fisher information. In case of the consistency condition, at positions where
+	  the denominator is 0, we print a "."; this is done through helper S3 method
+	  \code{print.relMatrix}.}
 
 \references{
   Rieder, H. (1994) \emph{Robust Asymptotic Statistics}. New York: Springer.

Modified: branches/distr-2.9/pkg/distrMod/tests/Examples/distrMod-Ex.Rout.save
===================================================================
--- branches/distr-2.9/pkg/distrMod/tests/Examples/distrMod-Ex.Rout.save	2019-04-02 19:10:55 UTC (rev 1337)
+++ branches/distr-2.9/pkg/distrMod/tests/Examples/distrMod-Ex.Rout.save	2019-04-07 09:57:56 UTC (rev 1338)
@@ -92,7 +92,7 @@
 Loading required package: MASS
 Loading required package: stats4
 :distrMod>  Object Oriented Implementation of Probability Models
-:distrMod>  (version 2.8.0)
+:distrMod>  (version 2.8.1)
 :distrMod> 
 :distrMod>  Some functions from pkg's 'base' and 'stats' are
 :distrMod>  intentionally masked ---see distrModMASK().
@@ -174,9 +174,9 @@
 shape1 -1.8511e-05  1.6483e-06
 shape2  1.6483e-06 -1.8511e-05
 precision of Fisher information - relativ error [%]:
-            shape1      shape2
-shape1 -1.8511e-03 -2.5558e-04
-shape2 -2.5558e-04 -1.8511e-03
+     [,1]      [,2]     
+[1,] -1.85e-03 -2.56e-04
+[2,] -2.56e-04 -1.85e-03
 condition of Fisher information:
 [1] 5.2777
 > 
@@ -240,13 +240,13 @@
          prob
 prob 133.3333
 > checkL2deriv(B1)
-precision of centering:	 -1.099042e-15 
+precision of centering:	 0 
 precision of Fisher information:
-           prob
-prob 2.8422e-14
+     prob
+prob    0
 precision of Fisher information - relativ error [%]:
-           prob
-prob 2.1316e-14
+     [,1] 
+[1,] 0.000
 condition of Fisher information:
 [1] 1
 > 
@@ -291,13 +291,13 @@
 loc 0.5
 > ### need smaller integration range:
 > checkL2deriv(C1)
-precision of centering:	 8.456777e-18 
+precision of centering:	 0 
 precision of Fisher information:
-            loc
-loc -1.0603e-13
+    loc
+loc   0
 precision of Fisher information - relativ error [%]:
-            loc
-loc -2.1205e-11
+     [,1]    
+[1,] -2.1e-11
 condition of Fisher information:
 [1] 1
 > 
@@ -348,13 +348,13 @@
 > checkL2deriv(C1)
 precision of centering:	 0 -2e-04 
 precision of Fisher information:
-              loc       scale
-loc   -2.6319e-11  2.1684e-17
-scale  2.1684e-17 -2.0000e-04
+           loc  scale
+loc   -2.6e-11  0e+00
+scale  0.0e+00 -2e-04
 precision of Fisher information - relativ error [%]:
-              loc  scale
-loc   -5.2638e-09    Inf
-scale         Inf -4e-02
+     [,1]      [,2]     
+[1,] -5.26e-09 .        
+[2,] .         -4.00e-02
 condition of Fisher information:
 [1] 1
 > distrExoptions("ElowerTruncQuantile"=1e-7,"EupperTruncQuantile"=1e-7)
@@ -419,7 +419,7 @@
         dimnames = list(nms, nms0))
     list(fval = fval0, mat = mat0)
 }
-<bytecode: 0x0000000009f59f10>
+<bytecode: 0x000000000d34f360>
 Trafo / derivative matrix at which estimate was produced:
        scale shape
 shape  0.000     1
@@ -620,7 +620,7 @@
         1)/c(scale = 1)
     return(y)
 }
-<environment: 0x000000000db0cd30>
+<environment: 0x000000000e638530>
 
 > checkL2deriv(E1)
 precision of centering:	 -2.042661e-06 
@@ -628,8 +628,8 @@
             scale
 scale -3.5986e-05
 precision of Fisher information - relativ error [%]:
-            scale
-scale -3.5986e-03
+     [,1]    
+[1,] -3.6e-03
 condition of Fisher information:
 [1] 1
 > 
@@ -756,9 +756,9 @@
 scale -3.5986e-05 -9.5036e-06
 shape -9.5036e-06 -3.9444e-05
 precision of Fisher information - relativ error [%]:
-            scale       shape
-scale -3.5986e-03 -9.5036e-04
-shape -9.5036e-04 -2.3979e-03
+     [,1]     [,2]    
+[1,] -3.6e-03 -9.5e-04
+[2,] -9.5e-04 -2.4e-03
 condition of Fisher information:
 [1] 10.603
 > 
@@ -789,8 +789,8 @@
 
 Slot "fct":
 function(x) QuadFormNorm(x, A = A)
-<bytecode: 0x000000000c7f2678>
-<environment: 0x000000000c7f57d0>
+<bytecode: 0x000000000d5f1b98>
+<environment: 0x000000000d5f5498>
 
 > 
 > ## The function is currently defined as
@@ -1072,7 +1072,7 @@
         1)/c(meanlog = 1)
     return(y)
 }
-<environment: 0x0000000015b4cde8>
+<environment: 0x00000000065c9f70>
 
 > checkL2deriv(L1)
 precision of centering:	 -0.003003394 
@@ -1080,8 +1080,8 @@
           meanlog
 meanlog -0.010279
 precision of Fisher information - relativ error [%]:
-        meanlog
-meanlog -1.0279
+     [,1]  
+[1,] -1.028
 condition of Fisher information:
 [1] 1
 > 
@@ -1135,13 +1135,13 @@
 > checkL2deriv(L1)
 precision of centering:	 0 -0.5873198 
 precision of Fisher information:
-            location       scale
-location -1.6000e-01 -6.6001e-18
-scale    -6.6001e-18 -8.3493e-01
+         location    scale
+location    -0.16  0.00000
+scale        0.00 -0.83493
 precision of Fisher information - relativ error [%]:
-         location   scale
-location  -48.001    -Inf
-scale        -Inf -58.388
+     [,1]    [,2]   
+[1,] -48.001 .      
+[2,] .       -58.388
 condition of Fisher information:
 [1] 3.6679
 > distrExoptions("ElowerTruncQuantile"=1e-7,"EupperTruncQuantile"=1e-7)
@@ -1711,8 +1711,8 @@
          prob
 prob -0.16012
 precision of Fisher information - relativ error [%]:
-          prob
-prob -0.030022
+     [,1]  
+[1,] -3e-02
 condition of Fisher information:
 [1] 1
 > (N1.w <- NbinomwithSizeFamily(size = 25, prob = 0.25))
@@ -1737,15 +1737,15 @@
 size  0.03044974  -4.0000
 prob -4.00000000 533.3333
 > checkL2deriv(N1.w)
-precision of centering:	 -6.245978e-06 0.001177892 
+precision of centering:	 -6.24598e-06 0.001177892 
 precision of Fisher information:
             size        prob
-size -4.4629e-06  8.4814e-04
+size -4.4628e-06  8.4814e-04
 prob  8.4814e-04 -1.6012e-01
 precision of Fisher information - relativ error [%]:
-          size      prob
-size -0.014656 -0.021204
-prob -0.021204 -0.030022
+     [,1]    [,2]   
+[1,] -0.0147 -0.0212
+[2,] -0.0212 -0.0300
 condition of Fisher information:
 [1] 1194827
 > (N2.w <- NbinomMeanSizeFamily(size = 25, mean = 75))
@@ -1770,15 +1770,15 @@
 size 3.044974e-02     1600.091
 mean 1.600091e+03 85342933.607
 > checkL2deriv(N2.w)
-precision of centering:	 -6.245978e-06 -0.4711755 
+precision of centering:	 -6.25e-06 -0.4711755 
 precision of Fisher information:
             size        mean
-size -4.4629e-06 -3.3927e-01
+size -4.4600e-06 -3.3927e-01
 mean -3.3927e-01 -2.5621e+04
 precision of Fisher information - relativ error [%]:
-          size      mean
-size -0.014656 -0.021203
-mean -0.021203 -0.030021
+     [,1]    [,2]   
+[1,] -0.0147 -0.0212
+[2,] -0.0212 -0.0300
 condition of Fisher information:
 [1] 1.8978e+11
 > 
@@ -1917,9 +1917,9 @@
 mean -5.794e-06  0.0000e+00
 sd    0.000e+00 -1.5722e-04
 precision of Fisher information - relativ error [%]:
-           mean          sd
-mean -5.794e-04         NaN
-sd          NaN -7.8609e-03
+     [,1]      [,2]     
+[1,] -5.79e-04 .        
+[2,] .         -7.86e-03
 condition of Fisher information:
 [1] 1.6667
 > 
@@ -1973,9 +1973,9 @@
 mean -5.794e-06  0.0000e+00
 sd    0.000e+00 -1.5722e-04
 precision of Fisher information - relativ error [%]:
-           mean          sd
-mean -5.794e-04         NaN
-sd          NaN -7.8609e-03
+     [,1]      [,2]     
+[1,] -5.79e-04 .        
+[2,] .         -7.86e-03
 condition of Fisher information:
 [1] 1.6667
 > 
@@ -2026,8 +2026,8 @@
             sd
 sd -1.5722e-04
 precision of Fisher information - relativ error [%]:
-            sd
-sd -7.8609e-03
+     [,1]     
+[1,] -7.86e-03
 condition of Fisher information:
 [1] 1
 > 
@@ -2081,9 +2081,9 @@
 sd   -5.794e-06  0.0000e+00
 mean  0.000e+00 -1.5722e-04
 precision of Fisher information - relativ error [%]:
-             sd        mean
-sd   -5.794e-04         NaN
-mean        NaN -7.8609e-03
+     [,1]      [,2]     
+[1,] -5.79e-04 .        
+[2,] .         -7.86e-03
 condition of Fisher information:
 [1] 1.6667
 > 
@@ -2111,7 +2111,7 @@
     else 
         return(sqrt(colSums(x^2)))
 }
-<bytecode: 0x000000000dbff080>
+<bytecode: 0x000000000d7b0298>
 <environment: namespace:distrMod>
 > name(EuclNorm)
 [1] "EuclideanNorm"
@@ -2143,7 +2143,7 @@
     else 
         return(sqrt(colSums(x^2)))
 }
-<bytecode: 0x000000000dbff080>
+<bytecode: 0x000000000d7b0298>
 <environment: namespace:distrMod>
 
 > 
@@ -2566,8 +2566,8 @@
             lambda
 lambda -3.2684e-06
 precision of Fisher information - relativ error [%]:
-            lambda
-lambda -1.4708e-03
+     [,1]     
+[1,] -1.47e-03
 condition of Fisher information:
 [1] 1
 > 
@@ -2598,8 +2598,8 @@
 
 Slot "fct":
 function(x) QuadFormNorm(x, A= A0)
-<bytecode: 0x0000000017cdd6e0>
-<environment: 0x0000000017ce2fd0>
+<bytecode: 0x0000000014108388>
+<environment: 0x0000000014109fd0>
 
 > 
 > ## The function is currently defined as
@@ -2636,8 +2636,8 @@
 
 Slot "fct":
 function(x) QuadFormNorm(x, A = A)
-<bytecode: 0x0000000017dcdcc0>
-<environment: 0x0000000017dd21c8>
+<bytecode: 0x00000000138dd9d0>
+<environment: 0x00000000138e33d8>
 
 > 
 > ## The function is currently defined as
@@ -3028,7 +3028,7 @@
 > 
 > ### Name: checkL2deriv
 > ### Title: Generic function for checking L2-derivatives
-> ### Aliases: checkL2deriv
+> ### Aliases: checkL2deriv print.relMatrix
 > ### Keywords: models
 > 
 > ### ** Examples
@@ -3040,8 +3040,8 @@
            [,1]
 [1,] -5.794e-06
 precision of Fisher information - relativ error [%]:
-           [,1]
-[1,] -5.794e-04
+     [,1]     
+[1,] -5.79e-04
 condition of Fisher information:
 [1] 1
 > 
@@ -3655,7 +3655,7 @@
     dimnames(mat) <- list(nfval, c("mean", "sd"))
     return(list(fval = fval, mat = mat))
 }
-<bytecode: 0x000000001142a2c8>
+<bytecode: 0x0000000014f4f340>
 > print(param(NS), show.details = "minimal")
 An object of class "ParamWithScaleFamParameter"
 name:	location and scale
@@ -3704,7 +3704,7 @@
     dimnames(mat) <- list(nfval, c("mean", "sd"))
     return(list(fval = fval, mat = mat))
 }
-<bytecode: 0x000000001142a2c8>
+<bytecode: 0x0000000014f4f340>
 Trafo / derivative matrix:
             mean         sd
 mu/sig 0.3668695 -0.3024814
@@ -3747,7 +3747,7 @@
     dimnames(mat) <- list(nfval, c("mean", "sd"))
     return(list(fval = fval, mat = mat))
 }
-<bytecode: 0x000000001142a2c8>
+<bytecode: 0x0000000014f4f340>
 Trafo / derivative matrix:
          mean      sd
 mu/sig 0.3669 -0.3025
@@ -4232,7 +4232,7 @@
 > cleanEx()
 > options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  42.55 1.42 45.75 NA NA 
+Time elapsed:  29.69 0.99 31.06 NA NA 
 > grDevices::dev.off()
 null device 
           1 

Modified: pkg/distrMod/DESCRIPTION
===================================================================
--- pkg/distrMod/DESCRIPTION	2019-04-02 19:10:55 UTC (rev 1337)
+++ pkg/distrMod/DESCRIPTION	2019-04-07 09:57:56 UTC (rev 1338)
@@ -1,6 +1,6 @@
 Package: distrMod
-Version: 2.8.0
-Date: 2019-04-02
+Version: 2.8.1
+Date: 2019-04-07
 Title: Object Oriented Implementation of Probability Models
 Description: Implements S4 classes for probability models based on packages 'distr' and
             'distrEx'.
@@ -18,4 +18,4 @@
 URL: http://distr.r-forge.r-project.org/
 LastChangedDate: {$LastChangedDate$}
 LastChangedRevision: {$LastChangedRevision$}
-VCS/SVNRevision: 1336
+VCS/SVNRevision: 1337

Modified: pkg/distrMod/NAMESPACE
===================================================================
--- pkg/distrMod/NAMESPACE	2019-04-02 19:10:55 UTC (rev 1337)
+++ pkg/distrMod/NAMESPACE	2019-04-07 09:57:56 UTC (rev 1338)
@@ -97,3 +97,4 @@
 export("addAlphTrsp2col")
 export(".deleteDim",".isUnitMatrix",
        ".CvMMDCovariance", ".oldCvMMDCovariance", ".CvMMDCovarianceWithMux")
+S3method(print, relMatrix)
\ No newline at end of file

Modified: pkg/distrMod/R/L2ParamFamily.R
===================================================================
--- pkg/distrMod/R/L2ParamFamily.R	2019-04-02 19:10:55 UTC (rev 1337)
+++ pkg/distrMod/R/L2ParamFamily.R	2019-04-07 09:57:56 UTC (rev 1338)
@@ -187,22 +187,27 @@
 
         cent <- E(object = L2Fam, fun = L2deriv)
 
+        FI <- as(L2Fam at FisherInfo, "matrix")
+        Prec <- ceiling(12-round(max(log(abs(FI)+1e-14,10)))/2)
+
         if(out){
-     	     PrecCent <- 12-round(max(log(abs(cent)+1e-14,10)))
-           cent.out <- round(cent*10^PrecCent)/10^PrecCent
+           cent.out <- round(cent*10^Prec)/10^Prec
            cat("precision of centering:\t", cent.out, "\n")
         }
         consist <- E(object = L2Fam, fun = L2deriv %*% t(L2deriv))
-        FI <- as(L2Fam at FisherInfo, "matrix")
         consist <- consist - FI
         if(out){
             oldOps <- options()
             on.exit(do.call(options,oldOps))
+            consist.out <- round(consist*10^Prec)/10^Prec
             options(digits=5,scipen=-2)
             cat("precision of Fisher information:\n")
-            print(consist)
+            print(consist.out)
+
             cat("precision of Fisher information - relativ error [%]:\n")
-            print(100*consist/FI)
+            relconsist.out <- round(consist/FI*10^(Prec+2))/10^Prec
+            class(relconsist.out) <- c("relMatrix",class(consist.out))
+            print(relconsist.out)
 
             cat("condition of Fisher information:\n")
             print(kappa(FI))
@@ -216,3 +221,20 @@
         return(invisible(ret.value))
     })
 
+### helper functions/S3 methods for output of rel differences when denominator
+##  can be 0
+
+.toForMat <- function(x){ ## replace NaN positions by "."
+                diX <- dim(x)
+                x0 <- format(x,nsmall=3,digits=3)
+                x0[is.na(x)] <- "."
+                x0[!is.finite(x)] <- "."
+                dim(x0) <- diX
+                x0
+                }
+
+print.relMatrix <- function(x,...){
+                      x1 <- .toForMat(x)
+                      print(x1, quote=FALSE)
+                      return(invisible(NULL))
+                      }
\ No newline at end of file

Modified: pkg/distrMod/inst/NEWS
===================================================================
--- pkg/distrMod/inst/NEWS	2019-04-02 19:10:55 UTC (rev 1337)
+++ pkg/distrMod/inst/NEWS	2019-04-07 09:57:56 UTC (rev 1338)
@@ -8,6 +8,18 @@
  information)
 
 ##############
+v 2.8.1
+##############
+user-visible CHANGES:
++ revised code to delete fuzz when checking the centering/consistency of L2deriv varying from 
+  -- relative accuracy is now determined by the size of FI 
+under the hood:
++ introduce S3 class "relMatrix" (and S3 method print.relMatrix) to capture the fact that when 
+  computing relative differences in consistency matrices, some entries in the denominator may 
+  be 0; in order to avoid output of Inf / NaN we catch the output and replace such entries 
+  by "."
+
+##############
 v 2.8
 ##############
 
@@ -44,9 +56,6 @@
   the help files to generator L2ParamFamily and to L2ParamFamily-class.
 + E() methods with signature(object = "L2ParamFamily" , ...) gain argument diagnostic
   (like E()-methods in distrEx v 2.8.0)
-+ triggered by a mail by K. Hornik who spotted output in checking the centering of L2deriv varying from 
-  architecture to architecture, (which is below machine accuracy hence to be ignored) we now delete 
-  non-significant digits in centering 
   
 bug fixes
 + discovered some issues with local variables in L2Families (global values were used instead...)  

Modified: pkg/distrMod/man/0distrMod-package.Rd
===================================================================
--- pkg/distrMod/man/0distrMod-package.Rd	2019-04-02 19:10:55 UTC (rev 1337)
+++ pkg/distrMod/man/0distrMod-package.Rd	2019-04-07 09:57:56 UTC (rev 1338)
@@ -13,8 +13,8 @@
 \details{
 \tabular{ll}{
 Package: \tab distrMod \cr
-Version: \tab 2.8.0 \cr
-Date: \tab 2019-04-02 \cr
+Version: \tab 2.8.1 \cr
+Date: \tab 2019-04-07 \cr
 Depends: \tab R(>= 3.4), distr(>= 2.8.0), distrEx(>= 2.8.0), RandVar(>= 1.2.0), MASS, stats4,methods \cr
 Imports: \tab startupmsg, sfsmisc, graphics, stats, grDevices \cr
 Suggests: \tab ismev, evd, \cr
@@ -22,7 +22,7 @@
 ByteCompile: \tab yes \cr
 License: \tab LGPL-3 \cr
 URL: \tab http://distr.r-forge.r-project.org/\cr
-VCS/SVNRevision: \tab 1336 \cr
+VCS/SVNRevision: \tab 1337 \cr
 }}
 \section{Classes}{
 \preformatted{

Modified: pkg/distrMod/man/checkL2deriv.Rd
===================================================================
--- pkg/distrMod/man/checkL2deriv.Rd	2019-04-02 19:10:55 UTC (rev 1337)
+++ pkg/distrMod/man/checkL2deriv.Rd	2019-04-07 09:57:56 UTC (rev 1338)
@@ -1,5 +1,6 @@
 \name{checkL2deriv}
 \alias{checkL2deriv}
+\alias{print.relMatrix}
 
 \title{Generic function for checking L2-derivatives}
 \description{
@@ -8,10 +9,13 @@
 }
 \usage{
 checkL2deriv(L2Fam, ...)
+\method{print}{relMatrix}(x,...)
 }
 \arguments{
   \item{L2Fam}{ L2-differentiable family of probability measures }
-  \item{\dots}{ additional parameters }
+  \item{x}{ argument to be printed }
+  \item{\dots}{ additional parameters (ignored/for compatibility with S3 generic 
+                in case \code{print.relMatrix}) }
 }
 \details{ 
   The precisions of the centering and the Fisher information
@@ -27,7 +31,11 @@
 
 \note{The return value gives the non-rounded values (which will be machine dependent),
       whereas on argument \code{out==TRUE} (the default) we only issue the values up to
-     5 digits which should be independent of the machine.}
+      5 digits which should be independent of the machine. For the output of relative
+	  differences, we adjust accuracy to the size of the maximal (absolute) value of 
+	  the Fisher information. In case of the consistency condition, at positions where
+	  the denominator is 0, we print a "."; this is done through helper S3 method
+	  \code{print.relMatrix}.}
 
 \references{
   Rieder, H. (1994) \emph{Robust Asymptotic Statistics}. New York: Springer.

Modified: pkg/distrMod/tests/Examples/distrMod-Ex.Rout.save
===================================================================
--- pkg/distrMod/tests/Examples/distrMod-Ex.Rout.save	2019-04-02 19:10:55 UTC (rev 1337)
+++ pkg/distrMod/tests/Examples/distrMod-Ex.Rout.save	2019-04-07 09:57:56 UTC (rev 1338)
@@ -92,7 +92,7 @@
 Loading required package: MASS
 Loading required package: stats4
 :distrMod>  Object Oriented Implementation of Probability Models
-:distrMod>  (version 2.8.0)
+:distrMod>  (version 2.8.1)
 :distrMod> 
 :distrMod>  Some functions from pkg's 'base' and 'stats' are
 :distrMod>  intentionally masked ---see distrModMASK().
@@ -174,9 +174,9 @@
 shape1 -1.8511e-05  1.6483e-06
 shape2  1.6483e-06 -1.8511e-05
 precision of Fisher information - relativ error [%]:
-            shape1      shape2
-shape1 -1.8511e-03 -2.5558e-04
-shape2 -2.5558e-04 -1.8511e-03
+     [,1]      [,2]     
+[1,] -1.85e-03 -2.56e-04
+[2,] -2.56e-04 -1.85e-03
 condition of Fisher information:
 [1] 5.2777
 > 
@@ -240,13 +240,13 @@
          prob
 prob 133.3333
 > checkL2deriv(B1)
-precision of centering:	 -1.099042e-15 
+precision of centering:	 0 
 precision of Fisher information:
-           prob
-prob 2.8422e-14
+     prob
+prob    0
 precision of Fisher information - relativ error [%]:
-           prob
-prob 2.1316e-14
+     [,1] 
+[1,] 0.000
 condition of Fisher information:
 [1] 1
 > 
@@ -291,13 +291,13 @@
 loc 0.5
 > ### need smaller integration range:
 > checkL2deriv(C1)
-precision of centering:	 8.456777e-18 
+precision of centering:	 0 
 precision of Fisher information:
-            loc
-loc -1.0603e-13
+    loc
+loc   0
 precision of Fisher information - relativ error [%]:
-            loc
-loc -2.1205e-11
+     [,1]    
+[1,] -2.1e-11
 condition of Fisher information:
 [1] 1
 > 
@@ -348,13 +348,13 @@
 > checkL2deriv(C1)
 precision of centering:	 0 -2e-04 
 precision of Fisher information:
-              loc       scale
-loc   -2.6319e-11  2.1684e-17
-scale  2.1684e-17 -2.0000e-04
+           loc  scale
+loc   -2.6e-11  0e+00
+scale  0.0e+00 -2e-04
 precision of Fisher information - relativ error [%]:
-              loc  scale
-loc   -5.2638e-09    Inf
-scale         Inf -4e-02
+     [,1]      [,2]     
+[1,] -5.26e-09 .        
+[2,] .         -4.00e-02
 condition of Fisher information:
 [1] 1
 > distrExoptions("ElowerTruncQuantile"=1e-7,"EupperTruncQuantile"=1e-7)
@@ -419,7 +419,7 @@
         dimnames = list(nms, nms0))
     list(fval = fval0, mat = mat0)
 }
-<bytecode: 0x0000000009f59f10>
+<bytecode: 0x000000000d34f360>
 Trafo / derivative matrix at which estimate was produced:
        scale shape
 shape  0.000     1
@@ -620,7 +620,7 @@
         1)/c(scale = 1)
     return(y)
 }
-<environment: 0x000000000db0cd30>
+<environment: 0x000000000e638530>
 
 > checkL2deriv(E1)
 precision of centering:	 -2.042661e-06 
@@ -628,8 +628,8 @@
             scale
 scale -3.5986e-05
 precision of Fisher information - relativ error [%]:
-            scale
-scale -3.5986e-03
+     [,1]    
+[1,] -3.6e-03
 condition of Fisher information:
 [1] 1
 > 
@@ -756,9 +756,9 @@
 scale -3.5986e-05 -9.5036e-06
 shape -9.5036e-06 -3.9444e-05
 precision of Fisher information - relativ error [%]:
-            scale       shape
-scale -3.5986e-03 -9.5036e-04
-shape -9.5036e-04 -2.3979e-03
+     [,1]     [,2]    
+[1,] -3.6e-03 -9.5e-04
+[2,] -9.5e-04 -2.4e-03
 condition of Fisher information:
 [1] 10.603
 > 
@@ -789,8 +789,8 @@
 
 Slot "fct":
 function(x) QuadFormNorm(x, A = A)
-<bytecode: 0x000000000c7f2678>
-<environment: 0x000000000c7f57d0>
+<bytecode: 0x000000000d5f1b98>
+<environment: 0x000000000d5f5498>
 
 > 
 > ## The function is currently defined as
@@ -1072,7 +1072,7 @@
         1)/c(meanlog = 1)
     return(y)
 }
-<environment: 0x0000000015b4cde8>
+<environment: 0x00000000065c9f70>
 
 > checkL2deriv(L1)
 precision of centering:	 -0.003003394 
@@ -1080,8 +1080,8 @@
           meanlog
 meanlog -0.010279
 precision of Fisher information - relativ error [%]:
-        meanlog
-meanlog -1.0279
+     [,1]  
+[1,] -1.028
 condition of Fisher information:
 [1] 1
 > 
@@ -1135,13 +1135,13 @@
 > checkL2deriv(L1)
 precision of centering:	 0 -0.5873198 
 precision of Fisher information:
-            location       scale
-location -1.6000e-01 -6.6001e-18
-scale    -6.6001e-18 -8.3493e-01
+         location    scale
+location    -0.16  0.00000
+scale        0.00 -0.83493
 precision of Fisher information - relativ error [%]:
-         location   scale
-location  -48.001    -Inf
-scale        -Inf -58.388
+     [,1]    [,2]   
+[1,] -48.001 .      
+[2,] .       -58.388
 condition of Fisher information:
 [1] 3.6679
 > distrExoptions("ElowerTruncQuantile"=1e-7,"EupperTruncQuantile"=1e-7)
@@ -1711,8 +1711,8 @@
          prob
 prob -0.16012
 precision of Fisher information - relativ error [%]:
-          prob
-prob -0.030022
+     [,1]  
+[1,] -3e-02
 condition of Fisher information:
 [1] 1
 > (N1.w <- NbinomwithSizeFamily(size = 25, prob = 0.25))
@@ -1737,15 +1737,15 @@
 size  0.03044974  -4.0000
 prob -4.00000000 533.3333
 > checkL2deriv(N1.w)
-precision of centering:	 -6.245978e-06 0.001177892 
+precision of centering:	 -6.24598e-06 0.001177892 
 precision of Fisher information:
             size        prob
-size -4.4629e-06  8.4814e-04
+size -4.4628e-06  8.4814e-04
 prob  8.4814e-04 -1.6012e-01
 precision of Fisher information - relativ error [%]:
-          size      prob
-size -0.014656 -0.021204
-prob -0.021204 -0.030022
+     [,1]    [,2]   
+[1,] -0.0147 -0.0212
+[2,] -0.0212 -0.0300
 condition of Fisher information:
 [1] 1194827
 > (N2.w <- NbinomMeanSizeFamily(size = 25, mean = 75))
@@ -1770,15 +1770,15 @@
 size 3.044974e-02     1600.091
 mean 1.600091e+03 85342933.607
 > checkL2deriv(N2.w)
-precision of centering:	 -6.245978e-06 -0.4711755 
+precision of centering:	 -6.25e-06 -0.4711755 
 precision of Fisher information:
             size        mean
-size -4.4629e-06 -3.3927e-01
+size -4.4600e-06 -3.3927e-01
 mean -3.3927e-01 -2.5621e+04
 precision of Fisher information - relativ error [%]:
-          size      mean
-size -0.014656 -0.021203
-mean -0.021203 -0.030021
+     [,1]    [,2]   
+[1,] -0.0147 -0.0212
+[2,] -0.0212 -0.0300
 condition of Fisher information:
 [1] 1.8978e+11
 > 
@@ -1917,9 +1917,9 @@
 mean -5.794e-06  0.0000e+00
 sd    0.000e+00 -1.5722e-04
 precision of Fisher information - relativ error [%]:
-           mean          sd
-mean -5.794e-04         NaN
-sd          NaN -7.8609e-03
+     [,1]      [,2]     
+[1,] -5.79e-04 .        
+[2,] .         -7.86e-03
 condition of Fisher information:
 [1] 1.6667
 > 
@@ -1973,9 +1973,9 @@
 mean -5.794e-06  0.0000e+00
 sd    0.000e+00 -1.5722e-04
 precision of Fisher information - relativ error [%]:
-           mean          sd
-mean -5.794e-04         NaN
-sd          NaN -7.8609e-03
+     [,1]      [,2]     
+[1,] -5.79e-04 .        
+[2,] .         -7.86e-03
 condition of Fisher information:
 [1] 1.6667
 > 
@@ -2026,8 +2026,8 @@
             sd
 sd -1.5722e-04
 precision of Fisher information - relativ error [%]:
-            sd
-sd -7.8609e-03
+     [,1]     
+[1,] -7.86e-03
 condition of Fisher information:
 [1] 1
 > 
@@ -2081,9 +2081,9 @@
 sd   -5.794e-06  0.0000e+00
 mean  0.000e+00 -1.5722e-04
 precision of Fisher information - relativ error [%]:
-             sd        mean
-sd   -5.794e-04         NaN
-mean        NaN -7.8609e-03
+     [,1]      [,2]     
+[1,] -5.79e-04 .        
+[2,] .         -7.86e-03
 condition of Fisher information:
 [1] 1.6667
 > 
@@ -2111,7 +2111,7 @@
     else 
         return(sqrt(colSums(x^2)))
 }
-<bytecode: 0x000000000dbff080>
+<bytecode: 0x000000000d7b0298>
 <environment: namespace:distrMod>
 > name(EuclNorm)
 [1] "EuclideanNorm"
@@ -2143,7 +2143,7 @@
     else 
         return(sqrt(colSums(x^2)))
 }
-<bytecode: 0x000000000dbff080>
+<bytecode: 0x000000000d7b0298>
 <environment: namespace:distrMod>
 
 > 
@@ -2566,8 +2566,8 @@
             lambda
 lambda -3.2684e-06
 precision of Fisher information - relativ error [%]:
-            lambda
-lambda -1.4708e-03
+     [,1]     
+[1,] -1.47e-03
 condition of Fisher information:
 [1] 1
 > 
@@ -2598,8 +2598,8 @@
 
 Slot "fct":
 function(x) QuadFormNorm(x, A= A0)
-<bytecode: 0x0000000017cdd6e0>
-<environment: 0x0000000017ce2fd0>
+<bytecode: 0x0000000014108388>
+<environment: 0x0000000014109fd0>
 
 > 
 > ## The function is currently defined as
@@ -2636,8 +2636,8 @@
 
 Slot "fct":
 function(x) QuadFormNorm(x, A = A)
-<bytecode: 0x0000000017dcdcc0>
-<environment: 0x0000000017dd21c8>
+<bytecode: 0x00000000138dd9d0>
+<environment: 0x00000000138e33d8>
 
 > 
 > ## The function is currently defined as
@@ -3028,7 +3028,7 @@
 > 
 > ### Name: checkL2deriv
 > ### Title: Generic function for checking L2-derivatives
-> ### Aliases: checkL2deriv
+> ### Aliases: checkL2deriv print.relMatrix
 > ### Keywords: models
 > 
 > ### ** Examples
@@ -3040,8 +3040,8 @@
            [,1]
 [1,] -5.794e-06
 precision of Fisher information - relativ error [%]:
-           [,1]
-[1,] -5.794e-04
+     [,1]     
+[1,] -5.79e-04
 condition of Fisher information:
 [1] 1
 > 
@@ -3655,7 +3655,7 @@
     dimnames(mat) <- list(nfval, c("mean", "sd"))
     return(list(fval = fval, mat = mat))
 }
-<bytecode: 0x000000001142a2c8>
+<bytecode: 0x0000000014f4f340>
 > print(param(NS), show.details = "minimal")
 An object of class "ParamWithScaleFamParameter"
 name:	location and scale
@@ -3704,7 +3704,7 @@
     dimnames(mat) <- list(nfval, c("mean", "sd"))
     return(list(fval = fval, mat = mat))
 }
-<bytecode: 0x000000001142a2c8>
+<bytecode: 0x0000000014f4f340>
 Trafo / derivative matrix:
             mean         sd
 mu/sig 0.3668695 -0.3024814
@@ -3747,7 +3747,7 @@
     dimnames(mat) <- list(nfval, c("mean", "sd"))
     return(list(fval = fval, mat = mat))
 }
-<bytecode: 0x000000001142a2c8>
+<bytecode: 0x0000000014f4f340>
 Trafo / derivative matrix:
          mean      sd
 mu/sig 0.3669 -0.3025
@@ -4232,7 +4232,7 @@
 > cleanEx()
 > options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  42.55 1.42 45.75 NA NA 
+Time elapsed:  29.69 0.99 31.06 NA NA 
 > grDevices::dev.off()
 null device 
           1 

Modified: pkg/utils/DESCRIPTIONutilsExamples.R
===================================================================
--- pkg/utils/DESCRIPTIONutilsExamples.R	2019-04-02 19:10:55 UTC (rev 1337)
+++ pkg/utils/DESCRIPTIONutilsExamples.R	2019-04-07 09:57:56 UTC (rev 1338)
@@ -170,6 +170,24 @@
                   ReqDistrPkgVersion =ReqDistrPkgVersion0)
 }
 
+if(FALSE){## Version 2.8 in trunk third shift 20190407
+Pkgs <- c("distrMod")
+Names <- c("Version")
+Values <- matrix(c("2.8.1"),1,length(Pkgs))
+ReqRVersion0 <- c(rep("R(>= 3.4)",length(Pkgs)))
+ReqDistrPkgVersion0 <- vector("list",length(Pkgs))
+names(ReqDistrPkgVersion0) <- Pkgs
+ReqDistrPkgVersion0[["RandVar"]] <- NA
+for(pk in Pkgs) ReqDistrPkgVersion0[[pk]] <- c("distr"="distr(>= 2.8.0)",
[TRUNCATED]

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


More information about the Distr-commits mailing list