format_iboost: Function to calculate selective inference based on sampled...

Description Usage Arguments Details Examples

Description

This function calculates p-values and confidence intervals based on sampled values and weights obtained by the iboost function.

Usage

1
format_iboost_res(res, alpha, method, vT, this_var, computeCI, fac = 2, y)

Arguments

res

list of sampled values either directly obtained in the iboost call or when using iboost with returnSamples = TRUE.

alpha

numeric; level for confidence interval(s)

method

character; method used for sampling

vT

list of test vector(s)

this_var

numeric; variance to be used for inference

computeCI

logical; whether or not to compute confidence intervals

fac

numeric; used in inverse search for confidence interval limits

y

vector; response vector

Details

The specific use of this function is to (internally) compute inference based on samples in the iboost function, to recalculate inference for given samples dist from an iboost object or to calculate inference in the first place when iboost has been ran with argument returnSamples = TRUE. In the first and third case, use format_iboost_res, otherwise format_iboost.

Examples

 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
if(require("mboost")){

set.seed(0)

n <- 200
x1 <- rnorm(n)
x2 <- rnorm(n) + 0.25 * x1
x3 <- rnorm(n)
eta <- 3 * sin(x1) + x2^2
y <- scale(eta + rnorm(n), scale = FALSE)

spline1 <- bbs(x1, knots = 20, df = 4)
knots.x2 <- quantile(x2, c(0.25, 0.5, 0.75))
spline2 <- bbs(x2, knots = knots.x2, df = 4)
spline3 <- bbs(x3, knots = 20, df = 4)

data <- data.frame(y=y, x1=x1, x2=x2, x3=x3)

mod1 <- mboost(y ~ spline1 + spline2 + spline3,
control=boost_control(mstop = 73), offset = 0, 
data = data)

# calculate p-values and intervals for model with 
# fixed stopping iteration:
# this is done with only B = 100 samples for
# demonstrative purposes and should be increased 
# for actual research questions
res <- iboost(mod1, method = "impsamp", B = 100)

# recalculate inference for different variance or alpha level
format_iboost(res, alpha = 0.1, this_var = var(y)*5)
}

davidruegamer/iboost documentation built on May 14, 2019, 3:10 a.m.