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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Feb 23 20:15:19 CET 2013


Author: ruckdeschel
Date: 2013-02-23 20:15:18 +0100 (Sat, 23 Feb 2013)
New Revision: 890

Modified:
   branches/distr-2.5/pkg/distrMod/R/AllClass.R
   branches/distr-2.5/pkg/distrMod/R/L2ParamFamily.R
   branches/distr-2.5/pkg/distrMod/R/modifyModel.R
   branches/distr-2.5/pkg/distrMod/man/L2ParamFamily-class.Rd
   branches/distr-2.5/pkg/distrMod/man/L2ParamFamily.Rd
   branches/distr-2.5/pkg/distrMod/man/ParamFamily-class.Rd
Log:
distrMod: 
+ ParamFamily gains slot .withEvalAsVar to allow delayed evaluation of variances
+ L2ParamFamily gains slot .withEvalL2derivDistr to allow delayed evaluation of L2derivDistr
+ correspondingly accessor L2derivDistr now checks whether it is a call and if so evaluates
+ in checkL2deriv, in addition, relative tolerances are also issued for Fisher Information


Modified: branches/distr-2.5/pkg/distrMod/R/AllClass.R
===================================================================
--- branches/distr-2.5/pkg/distrMod/R/AllClass.R	2013-02-17 00:52:18 UTC (rev 889)
+++ branches/distr-2.5/pkg/distrMod/R/AllClass.R	2013-02-23 19:15:18 UTC (rev 890)
@@ -144,7 +144,8 @@
                            fam.call = "call",
                            startPar = "function",
                            makeOKPar = "function",
-                           .withMDE = "logical"
+                           .withMDE = "logical",
+                           .withEvalAsVar = "logical"
                            ### <- new !!! (not in thesis!)
                            ### a function with argument theta
                            ###  returning distribution P_theta
@@ -158,7 +159,7 @@
                       makeOKPar = function(param)param,
                       startPar = function(x) {},
                       param = new("ParamFamParameter", main = 0, trafo = matrix(1)),
-                      .withMDE = TRUE),
+                      .withMDE = TRUE, .withEvalAsVar = TRUE),
             contains = "ProbFamily")
 
 
@@ -171,7 +172,8 @@
                            L2derivDistr = "OptionalDistrListOrCall",
                            L2derivDistrSymm = "DistrSymmList",
                            FisherInfo = "PosSemDefSymmMatrix",
-                           FisherInfo.fct = "function" ## new: a function in theta which produces FisherInfo
+                           FisherInfo.fct = "function", ## new: a function in theta which produces FisherInfo
+                           .withEvalL2derivDistr = "logical"
                            ),
             prototype(name = "L_2 differentiable parametric family of probability measures",
                       distribution = new("Norm"),
@@ -189,7 +191,8 @@
                       L2derivDistr = UnivarDistrList(new("Norm")),
                       L2derivDistrSymm = new("DistrSymmList"),
                       FisherInfo.fct = function(theta)return(1),
-                      FisherInfo = new("PosDefSymmMatrix")),
+                      FisherInfo = new("PosDefSymmMatrix"),
+                      .withEvalL2derivDistr = TRUE),
             contains = "ParamFamily",
             validity = function(object){
                 if(is(object at distribution, "UnivariateCondDistribution"))

Modified: branches/distr-2.5/pkg/distrMod/R/L2ParamFamily.R
===================================================================
--- branches/distr-2.5/pkg/distrMod/R/L2ParamFamily.R	2013-02-17 00:52:18 UTC (rev 889)
+++ branches/distr-2.5/pkg/distrMod/R/L2ParamFamily.R	2013-02-23 19:15:18 UTC (rev 890)
@@ -165,7 +165,14 @@
            param = "ParamFamParameter"), 
            function(object, param) object at L2deriv.fct(param))
 setMethod("L2derivSymm", "L2ParamFamily", function(object) object at L2derivSymm)
-setMethod("L2derivDistr", "L2ParamFamily", function(object) object at L2derivDistr)
+setMethod("L2derivDistr", "L2ParamFamily", function(object){
+                             ob <- object at L2derivDistr
+                             if(is.call(ob)){
+                                   ob <- eval(ob)
+                                   eval.parent(object at L2derivDistr <- ob)
+                             }
+                             return(ob)
+                             })
 setMethod("L2derivDistrSymm", "L2ParamFamily", function(object) object at L2derivDistrSymm)
 setMethod("FisherInfo", signature(object = "L2ParamFamily", param = "missing"),
            function(object) object at FisherInfo)
@@ -182,7 +189,8 @@
         if(out) cat("precision of centering:\t", cent, "\n")
 
         consist <- E(object = L2Fam, fun = L2deriv %*% t(L2deriv))
-        consist <- consist - as(L2Fam at FisherInfo, "matrix")
+        FI <- as(L2Fam at FisherInfo, "matrix")
+        consist <- consist - FI
         if(out){
             cat("precision of Fisher information:\n")
             print(consist)

Modified: branches/distr-2.5/pkg/distrMod/R/modifyModel.R
===================================================================
--- branches/distr-2.5/pkg/distrMod/R/modifyModel.R	2013-02-17 00:52:18 UTC (rev 889)
+++ branches/distr-2.5/pkg/distrMod/R/modifyModel.R	2013-02-23 19:15:18 UTC (rev 890)
@@ -71,7 +71,8 @@
           callIm <- substitute(imageDistr(RandVar = M1l, distr = M2l),
                                           list(M1l=M at L2deriv, M2l=M at distribution)
                                        )
-          if(missing(.withL2derivDistr)) .withL2derivDistr <- M at .withMDE
+          if(missing(.withL2derivDistr))
+                     .withL2derivDistr <- M at .withEvalL2derivDistr
           M at L2derivDistr <- if(.withL2derivDistr) eval(callIm) else callIm
 
           M1 <- existsPIC(M)

Modified: branches/distr-2.5/pkg/distrMod/man/L2ParamFamily-class.Rd
===================================================================
--- branches/distr-2.5/pkg/distrMod/man/L2ParamFamily-class.Rd	2013-02-17 00:52:18 UTC (rev 889)
+++ branches/distr-2.5/pkg/distrMod/man/L2ParamFamily-class.Rd	2013-02-23 19:15:18 UTC (rev 890)
@@ -98,6 +98,9 @@
     \item{\code{FisherInfo}}{
       object of class \code{"PosDefSymmMatrix"}:
       Fisher information of the family. }
+    \item{\code{.withEvalL2derivDistr}}{
+      logical  of length one: if \code{TRUE} slot \code{L2derivDistr} gets
+      evaluated, otherwise it is only kept as call. }
 }}
 \section{Extends}{
 Class \code{"ParamFamily"}, directly.\cr

Modified: branches/distr-2.5/pkg/distrMod/man/L2ParamFamily.Rd
===================================================================
--- branches/distr-2.5/pkg/distrMod/man/L2ParamFamily.Rd	2013-02-17 00:52:18 UTC (rev 889)
+++ branches/distr-2.5/pkg/distrMod/man/L2ParamFamily.Rd	2013-02-23 19:15:18 UTC (rev 890)
@@ -69,14 +69,12 @@
    \code{L2ParamFamily}; but, internally, this generating function is also 
    used to e.g. produce objects of class \code{BinomialFamily}, \code{PoisFamily}
    \code{GammaFamily}, \code{BetaFamily}.}
-    \item{.withMDE}{ logical of length 1:
-           Tells R how to use the function from slot \code{startPar} in case
-           of a \code{kStepEstimator} --- use it as is or to compute the
-           starting point for a minimum distance estimator which in turn then
-           serves as starting point for \code{roptest} / \code{robest}
-           (from package \pkg{ROptEst}). If
-           \code{TRUE} (default) the latter alternative is used.
-           Ignored if \pkg{ROptEst} is not used.}
+    \item{.withMDE}{ logical of length 1: Tells R how to use the function from
+    slot \code{startPar} in case of a \code{kStepEstimator}---use it as is or
+    to compute the starting point for a minimum distance estimator which in
+    turn then serves as starting point for \code{roptest} / \code{robest}
+    (from package \pkg{ROptEst}). If \code{TRUE} (default) the latter
+    alternative is used. Ignored if \pkg{ROptEst} is not used.}
 }
 \details{
   If \code{name} is missing, the default 

Modified: branches/distr-2.5/pkg/distrMod/man/ParamFamily-class.Rd
===================================================================
--- branches/distr-2.5/pkg/distrMod/man/ParamFamily-class.Rd	2013-02-17 00:52:18 UTC (rev 889)
+++ branches/distr-2.5/pkg/distrMod/man/ParamFamily-class.Rd	2013-02-23 19:15:18 UTC (rev 890)
@@ -69,6 +69,10 @@
            (from package \pkg{ROptEst}). If
            \code{TRUE} (default) the latter alternative is used.
            Ignored if \pkg{ROptEst} is not used.}
+    \item{\code{.withEvalAsVar}}{
+           object of class \code{"logical"} (of length 1):
+           Tells R whether in determining \code{kStepEstimator}s one
+           evaluates the asymptotic variance or just produces a call to do so.}
 }}
 \section{Extends}{
 Class \code{"ProbFamily"}, directly.



More information about the Distr-commits mailing list