exceedProbCoxBoot: Bootstrap confidence intervals for the exceedance probability...

Description Usage Arguments Value Examples

View source: R/ep_cox_boot.R

Description

This function obtains nonparametric bootstrap percentile confidence for Cox model parameters. Beta version.

Usage

1
2
exceedProbCoxBoot(data, cox_fit, j, alpha, R, cutoff = NULL, m = NULL,
  lower_tail = FALSE, sim = "model")

Arguments

data

survival data (data.frame)

cox_fit

(coxph.object) A fitted Cox model

j

Index of parameter for which the exceedance probability is obtained

alpha

Significance level

R

Number of bootstrap resamples

cutoff

Cutoff values (scalar or vector if supplied, otherwise set to +/- 0.5 of theta_hat)

m

Number of observations in the replication study (defaults to n if NULL)

lower_tail

If TRUE, reports lower tail probabilities; otherwise reports upper tail probabilities

sim

type of simulation, input to boot::censboot

Value

ep Exceedance probability with confidence intervals

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
33
34
35
library(exceedProb)
library(survival)

# Cox model -------------------------------------------------------

# Simulate exponential data
n <- 50
baseline_hazard <- 1
theta <- 0.4
p_censor <- 0.3
prop_tx <- 0.5

tx_indicator = rbinom(n = n, size = 1, prob = prop_tx)
event_rate <- baseline_hazard * exp(theta * tx_indicator)
censor_rate <- event_rate * p_censor / (1 - p_censor)

event_time <- rexp(n = n, rate = event_rate)
censor_time <- rexp(n = n, rate = censor_rate)
time <- pmin(event_time, censor_time)
event <- time == event_time
surv_data = data.frame(time = time, event = event, group = tx_indicator)

# Fit Cox model and get bootstrap percentile confidence intervals for the exceedance probability 
# with model-based resampling (see documentation for boot::censboot)
cox_fit <- coxph(Surv(time, event) ~ group, data = surv_data)
ep <- exceedProbCoxBoot(data = surv_data,
                        cox_fit = cox_fit,
                        j = 1, 
                        alpha = 0.05, 
                        R = 500)

# Plot results
with(ep, plot(cutoff, point, type = "l"))
with(ep, lines(cutoff, lower, lty = 2))
with(ep, lines(cutoff, upper, lty = 2))

bdsegal/exceedProb documentation built on Dec. 18, 2019, 3:37 a.m.