[Distr-commits] r884 - in branches/distr-2.5/pkg/distrMod: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 13 18:04:47 CET 2013


Author: ruckdeschel
Date: 2013-02-13 18:04:47 +0100 (Wed, 13 Feb 2013)
New Revision: 884

Modified:
   branches/distr-2.5/pkg/distrMod/R/AllClass.R
   branches/distr-2.5/pkg/distrMod/R/SimpleL2ParamFamilies.R
   branches/distr-2.5/pkg/distrMod/man/BetaFamily.Rd
   branches/distr-2.5/pkg/distrMod/man/GammaFamily.Rd
   branches/distr-2.5/pkg/distrMod/man/L2ParamFamily-class.Rd
   branches/distr-2.5/pkg/distrMod/man/NBinomFamily.Rd
Log:
distrMod: For speeding up things, we now have an option withL2derivDistr = TRUE which if FALSE skips computing the image distribution in two dimensional models, i.e., have switched slot L2derivDistr from "DistrList" to "OptionalDistrList". 

Modified: branches/distr-2.5/pkg/distrMod/R/AllClass.R
===================================================================
--- branches/distr-2.5/pkg/distrMod/R/AllClass.R	2013-02-09 22:12:39 UTC (rev 883)
+++ branches/distr-2.5/pkg/distrMod/R/AllClass.R	2013-02-13 17:04:47 UTC (rev 884)
@@ -51,6 +51,8 @@
 setClassUnion("MatrixorFunction", c("matrix", "OptionalFunction"))
 ## matrix, numeric or NULL -- a class for covariance slots
 setClassUnion("OptionalNumericOrMatrix", c("OptionalNumeric", "matrix"))
+## DistrList or NULL -- a class for slot L2DerivDistr below
+setClassUnion("OptionalDistrList", c("DistrList", "NULL"))
 
 ################################
 ##
@@ -163,7 +165,7 @@
             representation(L2deriv = "EuclRandVarList",
                            L2deriv.fct = "function", ## new: a function in theta which produces L2deriv
                            L2derivSymm = "FunSymmList",
-                           L2derivDistr = "DistrList",
+                           L2derivDistr = "OptionalDistrList",
                            L2derivDistrSymm = "DistrSymmList",
                            FisherInfo = "PosSemDefSymmMatrix",
                            FisherInfo.fct = "function" ## new: a function in theta which produces FisherInfo

Modified: branches/distr-2.5/pkg/distrMod/R/SimpleL2ParamFamilies.R
===================================================================
--- branches/distr-2.5/pkg/distrMod/R/SimpleL2ParamFamilies.R	2013-02-09 22:12:39 UTC (rev 883)
+++ branches/distr-2.5/pkg/distrMod/R/SimpleL2ParamFamilies.R	2013-02-13 17:04:47 UTC (rev 884)
@@ -174,7 +174,8 @@
 }
 
 
-NbinomwithSizeFamily <- function(size = 1, prob = 0.5, trafo){ 
+NbinomwithSizeFamily <- function(size = 1, prob = 0.5, trafo,
+                withL2derivDistr = TRUE){
     name <- "Negative Binomial family"
     distribution <- Nbinom(size = size, prob = prob)
     distrSymm <- NoSymmetry()
@@ -207,7 +208,10 @@
                    return(list(fct1, fct2))}
 
     L2derivSymm <- FunSymmList(NonSymmetric(), NonSymmetric())
-    L2derivDistr <- UnivarDistrList( digamma(distribution+size)-digamma(size)+log(prob), 
+    L2derivDistr <- NULL
+    if(withL2derivDistr)
+       L2derivDistr <- UnivarDistrList( digamma(distribution+size)-
+                                        digamma(size)+log(prob),
                                     (size/prob- distribution/(1-prob)))
     L2derivDistrSymm <- DistrSymmList(NoSymmetry(), NoSymmetry())
 
@@ -244,7 +248,8 @@
     return(res)
 }
 
-NbinomMeanSizeFamily <- function(size = 1, mean = .5, trafo){ 
+NbinomMeanSizeFamily <- function(size = 1, mean = .5, trafo,
+                                 withL2derivDistr = TRUE){
     name <- "Negative Binomial family"
     prob.0 <- size/(size+mean)
     distribution <- Nbinom(size = size, prob = size/(size+mean))
@@ -290,7 +295,9 @@
     .prob1 <- aggregate(data.frame(prob(as(distribution,"DiscreteDistribution"))),
                  by=list(round(.supp0,5)),sum)[,2]
     .Di2 <- DiscreteDistribution( supp=.supp0, prob=.prob1, .withArith = TRUE)
-    L2derivDistr <- UnivarDistrList( digamma(distribution+size)-digamma(size)+log(prob.0), 
+    L2derivDistr <- NULL
+    if(withL2derivDistr)
+       L2derivDistr <- UnivarDistrList( digamma(distribution+size)-digamma(size)+log(prob.0),
                                      .Di2)
                                      
     L2derivDistrSymm <- DistrSymmList(NoSymmetry(), NoSymmetry())
@@ -333,7 +340,7 @@
 ##################################################################
 ## Gamma family
 ##################################################################
-GammaFamily <- function(scale = 1, shape = 1, trafo){ 
+GammaFamily <- function(scale = 1, shape = 1, trafo, withL2derivDistr = TRUE){
     name <- "Gamma family"
     distribution <- Gammad(scale = scale, shape = shape)
     distrSymm <- NoSymmetry()
@@ -368,7 +375,9 @@
                    return(list(fct1, fct2))}
     L2derivSymm <- FunSymmList(OddSymmetric(SymmCenter = scale*shape),
                                NonSymmetric())
-    L2derivDistr <- UnivarDistrList((Gammad(scale = 1, shape = shape) - 
+    L2derivDistr <- NULL
+    if(withL2derivDistr)
+       L2derivDistr <- UnivarDistrList((Gammad(scale = 1, shape = shape) -
                                             shape)/scale, 
                                     (log(Gammad(scale = 1, shape = shape)) - 
                                             digamma(shape)))
@@ -422,7 +431,7 @@
 ##################################################################
 ## Beta family   :: new  08/08 P.R.
 ##################################################################
-BetaFamily <- function(shape1 = 1, shape2 = 1, trafo){ 
+BetaFamily <- function(shape1 = 1, shape2 = 1, trafo, withL2derivDistr = TRUE){
     name <- "Beta family"
     distribution <- Beta(shape1=shape1, shape2 = shape2)
     distrSymm <- NoSymmetry()
@@ -457,7 +466,9 @@
                         list(shape1 = shape1, shape2 = shape2))
                    return(list(fct1, fct2))}
     L2derivSymm <- FunSymmList(NonSymmetric(), NonSymmetric())
-    L2derivDistr <- UnivarDistrList(log(Beta(shape1 = shape1, shape2 = shape2))-
+    L2derivDistr <- NULL
+    if(withL2derivDistr)
+       L2derivDistr <- UnivarDistrList(log(Beta(shape1 = shape1, shape2 = shape2))-
                                         digamma(shape1)+digamma(shape1+shape2), 
                                     log(Beta(shape1 = shape2, shape2 = shape1))-
                                         digamma(shape2)+digamma(shape1+shape2))

Modified: branches/distr-2.5/pkg/distrMod/man/BetaFamily.Rd
===================================================================
--- branches/distr-2.5/pkg/distrMod/man/BetaFamily.Rd	2013-02-09 22:12:39 UTC (rev 883)
+++ branches/distr-2.5/pkg/distrMod/man/BetaFamily.Rd	2013-02-13 17:04:47 UTC (rev 884)
@@ -7,12 +7,15 @@
   represents a Beta family.
 }
 \usage{
-BetaFamily(shape1 = 1, shape2 = 1, trafo)
+BetaFamily(shape1 = 1, shape2 = 1, trafo, withL2derivDistr = TRUE)
 }
 \arguments{
   \item{shape1}{ positive real: shape1 parameter }
   \item{shape2}{ positive real: shape2 parameter }
   \item{trafo}{ matrix: transformation of the parameter }
+  \item{withL2derivDistr}{logical: shall the distribution of the L2 derivative
+      be computed? Defaults to \code{TRUE}; setting it to \code{FALSE}
+      speeds up computations.}
 }
 \details{
   The slots of the corresponding L2 differentiable 

Modified: branches/distr-2.5/pkg/distrMod/man/GammaFamily.Rd
===================================================================
--- branches/distr-2.5/pkg/distrMod/man/GammaFamily.Rd	2013-02-09 22:12:39 UTC (rev 883)
+++ branches/distr-2.5/pkg/distrMod/man/GammaFamily.Rd	2013-02-13 17:04:47 UTC (rev 884)
@@ -7,12 +7,15 @@
   represents a Gamma family.
 }
 \usage{
-GammaFamily(scale = 1, shape = 1, trafo)
+GammaFamily(scale = 1, shape = 1, trafo, withL2derivDistr = TRUE)
 }
 \arguments{
   \item{scale}{ positive real: scale parameter }
   \item{shape}{ positive real: shape parameter }
   \item{trafo}{ matrix: transformation of the parameter }
+  \item{withL2derivDistr}{logical: shall the distribution of the L2 derivative
+      be computed? Defaults to \code{TRUE}; setting it to \code{FALSE}
+      speeds up computations.}
 }
 \details{
   The slots of the corresponding L2 differentiable 

Modified: branches/distr-2.5/pkg/distrMod/man/L2ParamFamily-class.Rd
===================================================================
--- branches/distr-2.5/pkg/distrMod/man/L2ParamFamily-class.Rd	2013-02-09 22:12:39 UTC (rev 883)
+++ branches/distr-2.5/pkg/distrMod/man/L2ParamFamily-class.Rd	2013-02-13 17:04:47 UTC (rev 884)
@@ -82,7 +82,8 @@
       object of class \code{"FunSymmList"}:
       symmetry of the maps included in \code{L2deriv}. }
     \item{\code{L2derivDistr}}{
-      object of class \code{"UnivarDistrList"}:
+      object of class \code{"OptionalDistrList"} (i.e., \code{NULL} or
+      an object of class \code{"DistrList"}): if non-null, a
       list which includes the distribution of \code{L2deriv}. }
     \item{\code{L2derivDistrSymm}}{
       object of class \code{"DistrSymmList"}:

Modified: branches/distr-2.5/pkg/distrMod/man/NBinomFamily.Rd
===================================================================
--- branches/distr-2.5/pkg/distrMod/man/NBinomFamily.Rd	2013-02-09 22:12:39 UTC (rev 883)
+++ branches/distr-2.5/pkg/distrMod/man/NBinomFamily.Rd	2013-02-13 17:04:47 UTC (rev 884)
@@ -11,14 +11,17 @@
 }
 \usage{
 NbinomFamily(size = 1, prob = 0.5, trafo)
-NbinomwithSizeFamily(size = 1, prob = 0.5, trafo)
-NbinomMeanSizeFamily(size = 1, mean = 0.5, trafo) 
+NbinomwithSizeFamily(size = 1, prob = 0.5, trafo, withL2derivDistr = TRUE)
+NbinomMeanSizeFamily(size = 1, mean = 0.5, trafo, withL2derivDistr = TRUE )
 }
 \arguments{
   \item{size}{ number of trials }
   \item{prob}{ probability of success }
   \item{mean}{ alternative parameter for negative binomial parameter}
   \item{trafo}{ function in \code{param} or matrix: transformation of the parameter }
+  \item{withL2derivDistr}{logical: shall the distribution of the L2 derivative
+      be computed? Defaults to \code{TRUE}; setting it to \code{FALSE}
+      speeds up computations.}
 }
 \details{
   The slots of the corresponding L2 differentiable 



More information about the Distr-commits mailing list