bootstrap_variance {cmpp}R Documentation

Estimate Variance of Parameters Using Bootstrap Method

Description

This function estimates the variance of model parameters using the bootstrap method. It repeatedly samples the data with replacement, estimates the parameters for each sample, and computes the variance of the estimated parameters.

Usage

bootstrap_variance(features, x, delta1, delta2, initial_params, n_bootstrap, optimMethod)

Arguments

features

A numeric matrix of predictor variables. Each row corresponds to an observation.

x

A numeric vector of failure times corresponding to observations.

delta1

A binary vector indicating the occurrence of the first competing event (1 for observed).

delta2

A binary vector indicating the occurrence of the second event (1 for observed).

initial_params

A numeric vector of initial parameter values to start the optimization.

n_bootstrap

An integer specifying the number of bootstrap samples.

optimMethod

A character string specifying the optimization method to use. Default is "BFGS".

Details

This function performs bootstrap sampling to estimate the variance of the model parameters. It requires the data to be initialized using Initialize before being called.

Value

A list containing:

Examples

library(cmpp)
features <- matrix(rnorm(100), ncol = 5)
x <- rnorm(20)
delta1 <- sample(0:1, 20, replace = TRUE)
delta2 <- 1 - delta1
initial_params <- c(0.01, 0.01, 0.01, 0.01)
n_bootstrap <- 100
results <- bootstrap_variance(features, x, delta1, delta2, 
initial_params, n_bootstrap, optimMethod = "BFGS")
print(results$variances)
print(results$bootstrap_estimates)

[Package cmpp version 0.0.2 Index]