Learn R Programming

dynamichazard (version 1.0.2)

ddhazard_boot: Bootstrap for ddhazard Object

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 = FALSE,
  do_sample_weights = FALSE,
  LRs = ddhazard_fit$control$LR * 2^(0:(-4)),
  print_errors = FALSE
)

Value

An object like from the boot function.

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.

See Also

ddhazard, plot

Examples

Run this code
# \donttest{
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 = ddhazard_control(method = "GMA"))
bt <- ddhazard_boot(fit, R = 999)
plot(fit, ddhazard_boot = bt, level = .9)
# }


Run the code above in your browser using DataLab