Accounting for the uncertainty on the fitted "coxph" model and observed data
Accounting for the uncertainty on the fitted "coxph" model and observed data
coxphParametricSampling is used for vaccine efficacy confidence interval construction. It provides a vector of vaccine efficacy values, with length of nboot. 95% confidence interval, defined by 2.5th and 97.5th quantile of this vector, accounts for the uncertainty on the model fit (via parametric resampling of the posterior distribution of the model parameters) and observed data (via bootstrapping).
Fit: an object of class inheriting from "coxph" representing the fitted model
nboot: a numeric value for number of bootstrap samples for confidence interval construction
Data.vaccinated: a data frame for the vaccinated group, containing the variables in the fitted model
Data.control: a data frame for the control group, containing the variables in the fitted model
Returns
a vector of vaccine efficacy values VE_set, with length of nboot
Examples
# Load required packageslibrary(dplyr)library(survival)# Load an example datasetdata(data_temp)Data.vaccinated <- filter(data_temp, vaccine ==1)Data.control <- filter(data_temp, vaccine ==0)# Fit Cox proportional hazards model relating neutralizing titer # to time to disease or end of follow-upcoxFit <- coxph(Surv(time_event, disease_any)~ nAb1, data = data_temp)# Estimate 95\% confidence interval of vaccine efficacy based on the fitted modelefficacySet <- coxphParametricSampling(coxFit, nboot =500, Data.vaccinated, Data.control)CI <- lapply(EfficacyCI(efficacySet),"*",100)