Description Usage Arguments Details Value Author(s) References See Also Examples
Compute and display pointwise confidence intervals
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## S3 method for class 'mboost'
confint(object, parm = NULL, level = 0.95, B = 1000,
B.mstop = 25, newdata = NULL, which = parm,
papply = ifelse(B.mstop == 0, mclapply, lapply),
cvrisk_options = list(), ...)
## S3 method for class 'mboost.ci'
plot(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,...)
## S3 method for class 'mboost.ci'
lines(x, which, level = x$level,
col = rgb(170, 170, 170, alpha = 85, maxColorValue = 255),
raw = FALSE, ...)
## S3 method for class 'glmboost'
confint(object, parm = NULL, level = 0.95,
B = 1000, B.mstop = 25, which = parm, ...)
## S3 method for class 'glmboost.ci'
print(x, which = NULL, level = x$level, pe = FALSE, ...)
|
object |
a fitted model object of class |
parm, which |
a subset of base-learners to take into account for computing
confidence intervals. See |
level |
the confidence level required. |
B |
number of outer bootstrap replicates used to compute the empirical bootstrap confidence intervals. |
B.mstop |
number of inner bootstrap replicates used to determine the optimal
mstop on each of the |
newdata |
optionally, a data frame on which to compute the predictions for the confidence intervals. |
papply |
(parallel) apply function for the outer bootstrap, defaults to
|
cvrisk_options |
(optionally) specify a named list with arguments to the inner
bootstrap. For example use |
x |
a confidence interval object. |
ylim |
limits of the y scale. Per default computed from the data to plot. |
type |
type of graphic for the point estimate, i.e., for the predicted function. Per default a line is plotted. |
col |
color of the point estimate, i.e., for the predicted function. |
ci.col |
color of the confidence interval. |
raw |
logical, should the raw function estimates or the derived confidence estimates be plotted? |
print_levelplot |
logical, should the lattice |
pe |
logical, should the point estimtate (PE) be also returned? |
... |
additional arguments to the outer bootstrap such as |
Use a nested boostrap approach to compute pointwise confidence intervals for the predicted partial functions or regression parameters.
An object of class glmboost.ci
or mboost.ci
with special
print
and/or plot
functions.
Benjamin Hofner <benjamin.hofner@fau.de>
Benjamin Hofner, Thomas Kneib and Torsten Hothorn (2014), A Unified Framework of Constrained Regression. Statistics & Computing. Online first. DOI:10.1007/s11222-014-9520-y.
Preliminary version: http://arxiv.org/abs/1403.7118
cvrisk
for crossvalidation approaches and
mboost_methods
for other methods.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ############################################################
## Do not run these examples automatically as they take
## some time (~ 30 seconds depending on the system)
### a simple linear example
set.seed(1907)
data <- data.frame(x1 = rnorm(100), x2 = rnorm(100),
z = factor(sample(1:3, 100, replace = TRUE)))
data$y <- rnorm(100, mean = data$x1 - data$x2 - 1 * (data$z == 2) +
1 * (data$z == 3), sd = 0.1)
linmod <- glmboost(y ~ x1 + x2 + z, data = data,
control = boost_control(mstop = 200))
## compute confidence interval from 10 samples. Usually one should use
## at least 1000 samples.
CI <- confint(linmod, B = 10, level = 0.9)
CI
## to compute a confidence interval for another level simply change the
## level in the print function:
print(CI, level = 0.8)
## or print a subset (with point estimates):
print(CI, level = 0.8, pe = TRUE, which = "z")
### a simple smooth example
set.seed(1907)
data <- data.frame(x1 = rnorm(100), x2 = rnorm(100))
data$y <- rnorm(100, mean = data$x1^2 - sin(data$x2), sd = 0.1)
gam <- gamboost(y ~ x1 + x2, data = data,
control = boost_control(mstop = 200))
## compute confidence interval from 10 samples. Usually one should use
## at least 1000 samples.
CI_gam <- confint(gam, B = 10, level = 0.9)
par(mfrow = c(1, 2))
plot(CI_gam, which = 1)
plot(CI_gam, which = 2)
## to compute a confidence interval for another level simply change the
## level in the plot or lines function:
lines(CI_gam, which = 2, level = 0.8)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.