[Robast-commits] r472 - in branches/robast-0.9/pkg/RobAStBase: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 21 02:54:34 CEST 2012


Author: ruckdeschel
Date: 2012-05-21 02:54:33 +0200 (Mon, 21 May 2012)
New Revision: 472

Modified:
   branches/robast-0.9/pkg/RobAStBase/R/kStepEstimator.R
   branches/robast-0.9/pkg/RobAStBase/man/kStepEstimator.Rd
Log:
RobAStBase: fixed some 1-dim vs >1-dim issues in kStepEstimator.R

Modified: branches/robast-0.9/pkg/RobAStBase/R/kStepEstimator.R
===================================================================
--- branches/robast-0.9/pkg/RobAStBase/R/kStepEstimator.R	2012-05-20 21:00:19 UTC (rev 471)
+++ branches/robast-0.9/pkg/RobAStBase/R/kStepEstimator.R	2012-05-21 00:54:33 UTC (rev 472)
@@ -14,7 +14,7 @@
                            withICList = getRobAStBaseOption("withICList"),
                            withPICList = getRobAStBaseOption("withPICList"),
                            na.rm = TRUE, startArgList = NULL, ...,
-                           scalename = "scale", withLogScale = TRUE){
+                           withLogScale = TRUE){
 ## save call
         es.call <- match.call()
         es.call[[1]] <- as.name("kStepEstimator")
@@ -76,9 +76,10 @@
                          startList = startArgList)
 
 ### use Logtransform here in scale models
+        sclname <- ""
+        if(is(L2Fam, "L2ScaleUnion")) sclname <- scalename(L2Fam)
         logtrf <- is(L2Fam, "L2ScaleUnion") &
-                     withLogScale & scalename %in% names(start.val)
-
+                     withLogScale & sclname %in% names(start.val)
 ### a starting value in k-space
         u.theta <- start.val
         theta <- if(is(start.val,"Estimate")) estimate(start.val)
@@ -128,21 +129,25 @@
                      }
                      IC.tot <- IC.tot1 + IC.tot2
                      correct <- rowMeans(evalRandVar(IC.tot, x0), na.rm = na.rm)
-                     names(correct) <- rownames(u.theta)
+                     iM <- is.matrix(u.theta)
+                     names(correct) <- if(iM) rownames(u.theta) else names(u.theta)
                      if(logtrf){
-                        scl <- u.theta[scalename,1]
+                        scl <- if(iM) u.theta[sclname,1] else u.theta[sclname]
                         u.theta <- u.theta + correct
-                        u.theta[scalename,1] <- scl * exp(correct[scalename]/scl)
+                        if(iM) u.theta[sclname,1] <- scl * exp(correct[sclname]/scl) else
+                               u.theta[sclname] <- scl * exp(correct[sclname]/scl)
                      }else u.theta <- u.theta + correct
 
                      theta <- (tf$fct(u.theta))$fval
                 }else{
                      correct <- rowMeans(evalRandVar(IC.c, x0), na.rm = na.rm )
-                     names(correct) <- rownames(theta)
+                     iM <- is.matrix(theta)
+                     names(correct) <- if(iM) rownames(theta) else names(theta)
                      if(logtrf){
-                        scl <- theta[scalename,1]
+                        scl <- if(iM) theta[sclname,1] else theta[sclname]
                         theta <- theta + correct
-                        theta[scalename,1] <- scl * exp(correct[scalename]/scl)
+                        if(iM) theta[sclname,1] <- scl * exp(correct[sclname]/scl) else
+                               theta[sclname] <- scl * exp(correct[sclname]/scl)
                      }else{
                         theta <- theta + correct
                      }

Modified: branches/robast-0.9/pkg/RobAStBase/man/kStepEstimator.Rd
===================================================================
--- branches/robast-0.9/pkg/RobAStBase/man/kStepEstimator.Rd	2012-05-20 21:00:19 UTC (rev 471)
+++ branches/robast-0.9/pkg/RobAStBase/man/kStepEstimator.Rd	2012-05-21 00:54:33 UTC (rev 472)
@@ -13,7 +13,7 @@
       withICList = getRobAStBaseOption("withICList"),
       withPICList = getRobAStBaseOption("withPICList"),
       na.rm = TRUE, startArgList = NULL, ...,
-      scalename = "scale", withLogScale = TRUE)
+      withLogScale = TRUE)
 }
 \arguments{
   \item{x}{ sample }
@@ -42,7 +42,6 @@
   \item{withICList}{logical: shall slot \code{ICList} of return value
   be filled?}
   \item{...}{ additional parameters }
-  \item{scalename}{character; the name of the scale coordinate. }
   \item{withLogScale}{logical; shall a scale component (if existing and found
    with name \code{scalename}) be computed on log-scale and backtransformed
    afterwards? This avoids crossing 0.}



More information about the Robast-commits mailing list