[Mboost-commits] r764 - in pkg/mboostDevel: R man tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 24 16:33:40 CET 2014


Author: hofner
Date: 2014-03-24 16:33:40 +0100 (Mon, 24 Mar 2014)
New Revision: 764

Modified:
   pkg/mboostDevel/R/inference.R
   pkg/mboostDevel/man/stabsel.Rd
   pkg/mboostDevel/tests/regtest-inference.R
Log:
- added argumnent eval to stabsel to extract stabsel parameter combinations
  for fitted  mboost models


Modified: pkg/mboostDevel/R/inference.R
===================================================================
--- pkg/mboostDevel/R/inference.R	2014-02-21 09:45:25 UTC (rev 763)
+++ pkg/mboostDevel/R/inference.R	2014-03-24 15:33:40 UTC (rev 764)
@@ -4,7 +4,7 @@
                                B = ifelse(sampling.type == "MB", 100, 50)),
                     assumption = c("unimodal", "r-concave", "none"),
                     sampling.type = c("SS", "MB"),
-                    papply = mclapply, verbose = TRUE, FWER, ...) {
+                    papply = mclapply, verbose = TRUE, FWER, eval = TRUE, ...) {
 
     call <- match.call()
     p <- length(variable.names(object))
@@ -18,10 +18,14 @@
 
     B <- ncol(folds)
 
-    pars <- stabsel_parameters(cutoff = cutoff, q = q,
-                               PFER = PFER, p = p, B = B,
+    pars <- stabsel_parameters(p = p, cutoff = cutoff, q = q,
+                               PFER = PFER, B = B,
                                verbose = verbose, sampling.type = sampling.type,
                                assumption = assumption)
+    ## return parameter combination only if eval == FALSE
+    if (!eval)
+        return(pars)
+
     cutoff <- pars$cutoff
     q <- pars$q
     PFER <- pars$PFER
@@ -77,7 +81,7 @@
     ret
 }
 
-stabsel_parameters <- function(cutoff, q, PFER, p,
+stabsel_parameters <- function(p, cutoff, q, PFER,
                                B = ifelse(sampling.type == "MB", 100, 50),
                                assumption = c("unimodal", "r-concave", "none"),
                                sampling.type = c("SS", "MB"),

Modified: pkg/mboostDevel/man/stabsel.Rd
===================================================================
--- pkg/mboostDevel/man/stabsel.Rd	2014-02-21 09:45:25 UTC (rev 763)
+++ pkg/mboostDevel/man/stabsel.Rd	2014-03-24 15:33:40 UTC (rev 764)
@@ -1,6 +1,8 @@
 \name{stabsel}
 \alias{stabsel}
 \alias{stabsel_parameters}
+\alias{stabsel_parameters.default}
+\alias{stabsel_parameters.mboost}
 \title{
     Stability Selection
 }
@@ -13,11 +15,11 @@
                    B = ifelse(sampling.type == "MB", 100, 50)),
         assumption = c("unimodal", "r-concave", "none"),
         sampling.type = c("SS", "MB"),
-        papply = mclapply, verbose = TRUE, FWER, ...)
+        papply = mclapply, verbose = TRUE, FWER, eval = TRUE, ...)
 
 ## function to compute missing parameter from the other two parameters
 ## (internally used within stabsel)
-stabsel_parameters(cutoff, q, PFER, p,
+stabsel_parameters(p, cutoff, q, PFER,
                    B = ifelse(sampling.type == "MB", 100, 50),
                    assumption = c("unimodal", "r-concave", "none"),
                    sampling.type = c("SS", "MB"),
@@ -56,9 +58,11 @@
     \code{warnings} should be issued. }
   \item{FWER}{ deprecated. Only for compatibility with older versions,
     use PFER instead.}
-  \item{\dots}{additional arguments to \code{\link{cvrisk}} and
-    further arguments to parallel apply methods such as
-    \code{\link{mclapply}}.}
+  \item{eval}{ logical. Determines whether stability selection is
+    evaluated (\code{eval = TRUE}; default) or if only the parameter
+    combination is returned.}
+  \item{\dots}{additional arguments to \code{\link{cvrisk}} and further
+    arguments to parallel apply methods such as \code{\link{mclapply}}.}
 }
 \details{
 
@@ -116,6 +120,8 @@
   ##   p = ncol(bodyfat) - 1 (= Outcome) + 1 ( = Intercept)
   stabsel_parameters(q = 3, PFER = 1, p = ncol(bodyfat) - 1 + 1,
                      sampling.type = "MB")
+  ## the same:
+  stabsel(mod, q = 3, PFER = 1, sampling.type = "MB", eval = FALSE)
 
   ## now run stability selection; to make results reproducible
   set.seed(1234)

Modified: pkg/mboostDevel/tests/regtest-inference.R
===================================================================
--- pkg/mboostDevel/tests/regtest-inference.R	2014-02-21 09:45:25 UTC (rev 763)
+++ pkg/mboostDevel/tests/regtest-inference.R	2014-03-24 15:33:40 UTC (rev 764)
@@ -155,7 +155,10 @@
 (sbody <- stabsel(mod, q = 3, PFER = 0.2, sampling.type = "SS"))
 dim(sbody$phat)
 
+## check interface of stabsel_parameters
+stabsel(mod, q = 3, PFER = 0.2, sampling.type = "SS", eval = FALSE)
 
+
 ## check stabsel_parameters and (theoretical) error control
 cutoff <- 0.6
 for (i in 1:10) {



More information about the Mboost-commits mailing list