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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun May 20 22:35:18 CEST 2012


Author: ruckdeschel
Date: 2012-05-20 22:35:18 +0200 (Sun, 20 May 2012)
New Revision: 469

Modified:
   branches/robast-0.9/pkg/RobAStBase/R/kStepEstimator.R
   branches/robast-0.9/pkg/RobAStBase/man/kStepEstimator.Rd
Log:
RobAStbase: implemented scale estimation on log-scale for kStepEstimator

Modified: branches/robast-0.9/pkg/RobAStBase/R/kStepEstimator.R
===================================================================
--- branches/robast-0.9/pkg/RobAStBase/R/kStepEstimator.R	2012-05-20 14:05:21 UTC (rev 468)
+++ branches/robast-0.9/pkg/RobAStBase/R/kStepEstimator.R	2012-05-20 20:35:18 UTC (rev 469)
@@ -13,7 +13,8 @@
                            IC.UpdateInKer = getRobAStBaseOption("IC.UpdateInKer"),
                            withICList = getRobAStBaseOption("withICList"),
                            withPICList = getRobAStBaseOption("withPICList"),
-                           na.rm = TRUE, startArgList = NULL, ...){
+                           na.rm = TRUE, startArgList = NULL, ...,
+                           scalename = "scale", withLogScale = TRUE){
 ## save call
         es.call <- match.call()
         es.call[[1]] <- as.name("kStepEstimator")
@@ -74,6 +75,9 @@
                          na.rm = na.rm, L2Fam = L2Fam,
                          startList = startArgList)
 
+### use Logtransform here in scale models
+        logtrf <- is(L2Fam, "L2ScaleUnion") &
+                     withLogScale & scalename %in% names(start.val)
 
 ### a starting value in k-space
         u.theta <- start.val
@@ -123,12 +127,25 @@
                                     "EuclRandVariable") else NULL
                      }
                      IC.tot <- IC.tot1 + IC.tot2
-                     u.theta <- u.theta + rowMeans(evalRandVar(IC.tot, x0),
-                                                   na.rm = na.rm)
+                     correct <- rowMeans(evalRandVar(IC.tot, x0), na.rm = na.rm)
+                     names(correct) <- rownames(u.theta)
+                     if(logtrf){
+                        scl <- u.theta[scalename,1]
+                        u.theta <- u.theta + correct
+                        u.theta[scalename,1] <- scl * exp(correct[scalename]/scl)
+                     }else u.theta <- u.theta + correct
+
                      theta <- (tf$fct(u.theta))$fval
                 }else{
-                     theta <- theta + rowMeans(evalRandVar(IC.c, x0),
-                                               na.rm = na.rm )
+                     correct <- rowMeans(evalRandVar(IC.c, x0), na.rm = na.rm )
+                     names(correct) <- rownames(theta)
+                     if(logtrf){
+                        scl <- theta[scalename,1]
+                        theta <- theta + correct
+                        theta[scalename,1] <- scl * exp(correct[scalename]/scl)
+                     }else{
+                        theta <- theta + correct
+                     }
                      IC.tot <- IC.c
                      u.theta <- theta
                 }

Modified: branches/robast-0.9/pkg/RobAStBase/man/kStepEstimator.Rd
===================================================================
--- branches/robast-0.9/pkg/RobAStBase/man/kStepEstimator.Rd	2012-05-20 14:05:21 UTC (rev 468)
+++ branches/robast-0.9/pkg/RobAStBase/man/kStepEstimator.Rd	2012-05-20 20:35:18 UTC (rev 469)
@@ -12,7 +12,8 @@
       IC.UpdateInKer = getRobAStBaseOption("IC.UpdateInKer"),
       withICList = getRobAStBaseOption("withICList"),
       withPICList = getRobAStBaseOption("withPICList"),
-      na.rm = TRUE, startArgList = NULL, ...)
+      na.rm = TRUE, startArgList = NULL, ...,
+      scalename = "scale", withLogScale = TRUE)
 }
 \arguments{
   \item{x}{ sample }
@@ -41,6 +42,10 @@
   \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.}
 }
 \details{
   Given an initial estimation \code{start}, a sample \code{x} 



More information about the Robast-commits mailing list