[Mboost-commits] r788 - in pkg/mboostDevel: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jul 28 18:26:02 CEST 2014
Author: hofner
Date: 2014-07-28 18:26:00 +0200 (Mon, 28 Jul 2014)
New Revision: 788
Modified:
pkg/mboostDevel/R/confint.R
pkg/mboostDevel/man/confint.Rd
Log:
improved interface of confint.mboost
Modified: pkg/mboostDevel/R/confint.R
===================================================================
--- pkg/mboostDevel/R/confint.R 2014-07-28 10:02:59 UTC (rev 787)
+++ pkg/mboostDevel/R/confint.R 2014-07-28 16:26:00 UTC (rev 788)
@@ -3,13 +3,21 @@
B = 1000, B.mstop = 25, newdata = NULL,
which = parm,
papply = ifelse(B.mstop == 0, mclapply, lapply),
- papply.mstop = mclapply,
- ...) {
+ cvrisk_options = list(), ...) {
which <- object$which(which, usedonly = FALSE)
if (!all(which %in% object$which(NULL, usedonly = FALSE)))
stop(sQuote("which"), " is wrongly specified")
+ if (!is.list(cvrisk_options))
+ stop(sQuote("cvrisk_options"), " must be a named list")
+ if (length(cvrisk_options) > 0 && is.null(names(cvrisk_options)))
+ stop(sQuote("cvrisk_options"), " must be a named list")
+ if ("folds" %in% names(cvrisk_options))
+ stop("One cannot modify the folds of the inner bootstrap")
+ if ("object" %in% names(cvrisk_options))
+ stop("One cannot specify the model (object) of the inner bootstrap")
+
## create new data and/or restructure data
newdata <- .create_newdata(object, newdata, which)
@@ -25,13 +33,15 @@
risk = "inbag", trace = FALSE)
if (B.mstop > 0) {
## <FIXME> are the weights handled correctly?
- cvr <- cvrisk(mod, folds = cv(model.weights(mod), B = B.mstop),
- papply = papply.mstop, ...)
+ cvr <- do.call("cvrisk",
+ args = c(list(object = mod,
+ folds = cv(model.weights(mod), B = B.mstop)),
+ cvrisk_options))
mod[mstop(cvr)]
}
.predict_confint(mod, newdata = newdata, which = which)
}
- predictions <- papply(1:B, do_update)
+ predictions <- papply(1:B, do_update, ...)
cat("\n")
## prepare returned object
Modified: pkg/mboostDevel/man/confint.Rd
===================================================================
--- pkg/mboostDevel/man/confint.Rd 2014-07-28 10:02:59 UTC (rev 787)
+++ pkg/mboostDevel/man/confint.Rd 2014-07-28 16:26:00 UTC (rev 788)
@@ -17,7 +17,7 @@
\method{confint}{mboost}(object, parm = NULL, level = 0.95, B = 1000,
B.mstop = 25, newdata = NULL, which = parm,
papply = ifelse(B.mstop == 0, mclapply, lapply),
- papply.mstop = mclapply, ...)
+ cvrisk_options = list(), ...)
\method{plot}{mboost.ci}(x, which, level = x$level, ylim = NULL, type = "l", col = "black",
ci.col = rgb(170, 170, 170, alpha = 85, maxColorValue = 255),
raw = FALSE, print_levelplot = TRUE,...)
@@ -65,13 +65,12 @@
computing resources if you use parallel computing for both, the
inner and the outer bootstrap.
}
- \item{papply.mstop}{
- (parallel) apply function for the inner bootstrap, defaults to
- \code{\link[parallel]{mclapply}} if we use an inner bootstrap is to
- determine the optimal stopping iteration. For details see
- argument \code{papply} in \code{\link{cvrisk}}. Be careful with your
- computing resources if you use parallel computing for both, the
- inner and the outer bootstrap.
+ \item{cvrisk_options}{
+ (optionally) specify a named list with arguments to the inner
+ bootstrap. For example use \code{cvrisk_options = list(mc.cores =
+ 2)} to specify that the \code{\link{mclapply}} function within
+ \code{\link{cvrisk}} uses 2 cores to compute the optimal
+ \code{mstop}.
}
\item{x}{
a confidence interval object.
@@ -105,7 +104,7 @@
logical, should the point estimtate (PE) be also returned?
}
\item{\dots}{
- additional arguments
+ additional arguments to the outer bootstrap such as \code{mc.cores}.
}
}
\details{
More information about the Mboost-commits
mailing list