Extracts the variance-covariance matrix of the main parameters (outcome model coefficients)
from a fitted coxphELE model.
Usage
# S3 method for class 'coxphELE'
vcov(object, ...)Examples
library(survival)
set.seed(104)
n <- 200
# 1. Simulate covariates
age_centered <- rnorm(n, 0, 5)
treatment <- rbinom(n, 1, 0.5)
# 2. Simulate true survival times
true_time <- rexp(n, rate = exp(0.05 * age_centered - 0.6 * treatment))
cens_time <- rexp(n, rate = 0.2)
time <- pmin(true_time, cens_time)
status <- as.numeric(true_time <= cens_time)
# 3. Induce 15% Exchangeable Linkage Error (ELE)
mis_idx <- sample(1:n, size = floor(0.15 * n))
linked_age <- age_centered
linked_trt <- treatment
# False links drawn uniformly from the target population
false_link_idx <- sample(1:n, size = length(mis_idx), replace = TRUE)
linked_age[mis_idx] <- age_centered[false_link_idx]
linked_trt[mis_idx] <- treatment[false_link_idx]
linked_data <- data.frame(time = time, status = status,
age = linked_age, treatment = linked_trt)
# 4. Fit the adjusted Cox PH model
adj <- adjELE(linked.data = linked_data, m.rate = 0.15)
fit <- plcoxph(Surv(time, status) ~ age + treatment, adjustment = adj)
# 5. Extract the sandwich variance-covariance matrix
vmat <- vcov(fit)
print(vmat)
#> age treatment
#> age 0.001386645 -0.004720918
#> treatment -0.004720918 0.160148790
