dynamichazard (version 0.5.1)

ddhazard_boot: Bootstrap for ddhazard

Description

See the vignette vignette("Bootstrap_illustration", "dynamichazard"). The do_stratify_with_event may be useful when either cases or non-cases are very rare to ensure that the model estimation succeeds.

Usage

ddhazard_boot(ddhazard_fit, strata, unique_id, R = 100,
  do_stratify_with_event = F, do_sample_weights = F,
  LRs = ddhazard_fit$control$LR * 2^(0:(-4)), print_errors = F)

Arguments

ddhazard_fit

returned object from a ddhazard call.

strata

strata to sample within. These need to be on an individual by individual basis and not rows in the design matrix.

unique_id

unique ids where entries match entries of strata.

R

number of bootstrap estimates.

do_stratify_with_event

TRUE if sampling should be by strata of whether the individual has an event. An interaction factor will be made if strata is provided.

do_sample_weights

TRUE if weights should be sampled instead of individuals.

LRs

learning rates in decreasing order which will be used to estimate the model.

print_errors

TRUE if errors should be printed when estimations fails.

Value

An object like from the boot function.

See Also

ddhazard, plot

Examples

Run this code
# NOT RUN {
library(dynamichazard)
set.seed(56219373)
fit <- ddhazard(
 Surv(time, status == 2) ~ log(bili), pbc, id = pbc$id, max_T = 3000,
 Q_0 = diag(1, 2), Q = diag(1e-4, 2), by = 100,
 control = list(method = "GMA"))
bt <- ddhazard_boot(fit, R = 999)
plot(fit, ddhazard_boot = bt, level = .9)
# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace