[Distr-commits] r550 - branches/distr-2.2/pkg/distrMod/R branches/distr-2.2/pkg/distrMod/chm branches/distr-2.2/pkg/distrMod/man pkg/distrMod/chm

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 25 23:17:48 CEST 2009


Author: ruckdeschel
Date: 2009-08-25 23:17:46 +0200 (Tue, 25 Aug 2009)
New Revision: 550

Modified:
   branches/distr-2.2/pkg/distrMod/R/Confint-class.R
   branches/distr-2.2/pkg/distrMod/R/Estimate.R
   branches/distr-2.2/pkg/distrMod/chm/Estimate-class.html
   branches/distr-2.2/pkg/distrMod/chm/distrMod.chm
   branches/distr-2.2/pkg/distrMod/man/Estimate-class.Rd
   pkg/distrMod/chm/distrMod.chm
Log:
+distrMod:
estimte, untransformed.estimate, main, and nuisance from time to time did not return numerics (instead: items with dim attribute...)

Modified: branches/distr-2.2/pkg/distrMod/R/Confint-class.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/R/Confint-class.R	2009-08-25 17:34:02 UTC (rev 549)
+++ branches/distr-2.2/pkg/distrMod/R/Confint-class.R	2009-08-25 21:17:46 UTC (rev 550)
@@ -10,7 +10,7 @@
 setMethod("samplesize.estimate", signature(object="Confint"),
            function(object, onlycompletecases = TRUE)
   	    (object at samplesize.estimate+
-  	     (1-onlycompletecases)*sum(object at completecases.estimate)))
+  	     (1-onlycompletecases)*sum(object at completecases.estimate==FALSE)))
 setMethod("nuisance.estimate", signature(object="Confint"),
            function(object) object at nuisance.estimate)
 setMethod("trafo.estimate", signature(object="Confint"),

Modified: branches/distr-2.2/pkg/distrMod/R/Estimate.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/R/Estimate.R	2009-08-25 17:34:02 UTC (rev 549)
+++ branches/distr-2.2/pkg/distrMod/R/Estimate.R	2009-08-25 21:17:46 UTC (rev 550)
@@ -6,9 +6,9 @@
 setReplaceMethod("name", "Estimate", 
                   function(object, value) {object at name <- value; object})
 
-setMethod("estimate", "Estimate", function(object) object at estimate)
+setMethod("estimate", "Estimate", function(object) as.numeric(object at estimate))
 setMethod("untransformed.estimate", "Estimate", 
-           function(object) object at untransformed.estimate)
+           function(object) as.numeric(object at untransformed.estimate))
 setMethod("estimate.call", "Estimate", function(object) object at estimate.call)
 
 setMethod("trafo", signature(object = "Estimate", param = "missing"), 
@@ -18,7 +18,7 @@
    function(object, param){
         if(is.function(trafo(param))) 
              return(list(fct = trafo(param), 
-                         mat = (trafo(param)(object at untransformed.estimate))$mat))
+                         mat = (trafo(param)(untransformed.estimate(object)))$mat))
         else return(list(fct = function(x) trafo(param)%*%x, 
                          mat = trafo(param)))
            
@@ -49,12 +49,13 @@
     })
 
 setMethod("samplesize", "Estimate", function(object, onlycompletecases = TRUE)
-  	    object at samplesize+(1-onlycompletecases)*sum(object at completecases))
+  	    object at samplesize+(1-onlycompletecases)*sum(object at completecases==FALSE))
 setMethod("completecases", "Estimate", function(object) object at completecases)
 setMethod("asvar", "Estimate", function(object) object at asvar)
 
 setReplaceMethod("asvar", "Estimate", 
                   function(object, value){ 
+          value <- as.matrix(value)
           mat <- trafo(object)$mat
           if(.isUnitMatrix(mat)){
              object at asvar <- value
@@ -65,7 +66,7 @@
           object})
 
 setMethod("untransformed.asvar", "Estimate", function(object) 
-           object at untransformed.asvar)
+           as.matrix(object at untransformed.asvar))
 
 setMethod("optimwarn", "MCEstimate", function(object) object at optimwarn)
 setMethod("criterion", "MCEstimate", function(object) object at criterion)
@@ -79,12 +80,12 @@
 setMethod("nuisance", "Estimate", function(object) { 
       if(is.null(object at nuis.idx))
          return(NULL)
-      else return (object at estimate[object at nuis.idx])    
+      else return (estimate(object)[object at nuis.idx])
       })
 setMethod("main", "Estimate", function(object) { 
       if(is.null(object at nuis.idx))
-         return(object at estimate)
-      else return (object at estimate[-object at nuis.idx])    
+         return(estimate(object))
+      else return (estimate(object)[-object at nuis.idx])
       })
 
 

Modified: branches/distr-2.2/pkg/distrMod/chm/Estimate-class.html
===================================================================
--- branches/distr-2.2/pkg/distrMod/chm/Estimate-class.html	2009-08-25 17:34:02 UTC (rev 549)
+++ branches/distr-2.2/pkg/distrMod/chm/Estimate-class.html	2009-08-25 21:17:46 UTC (rev 550)
@@ -286,6 +286,11 @@
 <pre>
 x &lt;- rnorm(100)
 Estimator(x, estimator = mean, name = "mean")
+
+x1 &lt;- x; x1[sample(1:100,10)] &lt;- NA
+myEst1 &lt;- Estimator(x1, estimator = mean, name = "mean")
+samplesize(myEst1)
+samplesize(myEst1, onlycomplete = FALSE)
 </pre>
 
 <script Language="JScript">

Modified: branches/distr-2.2/pkg/distrMod/chm/distrMod.chm
===================================================================
(Binary files differ)

Modified: branches/distr-2.2/pkg/distrMod/man/Estimate-class.Rd
===================================================================
--- branches/distr-2.2/pkg/distrMod/man/Estimate-class.Rd	2009-08-25 17:34:02 UTC (rev 549)
+++ branches/distr-2.2/pkg/distrMod/man/Estimate-class.Rd	2009-08-25 21:17:46 UTC (rev 550)
@@ -211,6 +211,11 @@
 \examples{
 x <- rnorm(100)
 Estimator(x, estimator = mean, name = "mean")
+
+x1 <- x; x1[sample(1:100,10)] <- NA
+myEst1 <- Estimator(x1, estimator = mean, name = "mean")
+samplesize(myEst1)
+samplesize(myEst1, onlycomplete = FALSE)
 }
 \concept{estimate}
 \keyword{classes}

Modified: pkg/distrMod/chm/distrMod.chm
===================================================================
(Binary files differ)



More information about the Distr-commits mailing list