Accounting for the uncertainty on the fitted "glm" model and observed data
Accounting for the uncertainty on the fitted "glm" model and observed data
glmParametricSampling 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 percentile 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 "glm" 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 must include a column called "vaccine" with binary indicator of vaccination status
Data.control: a data frame for the control group, containing the variables in the fitted model; data must include a column called "vaccine" with binary indicator of vaccination status
Returns
a vector of vaccine efficacy values VE_set, with length of nboot
Examples
# Load required packageslibrary(dplyr)# Load an example datasetdata(data_temp)Data.vaccinated <- filter(data_temp, vaccine ==1)Data.control <- filter(data_temp, vaccine ==0)# Fit logistic model relating neutralizing titer to disease statuslogisticFit <- glm(disease_any ~ nAb1, data = data_temp, family = binomial())# Estimate 95\% confidence interval of vaccine efficacy based on the fitted modelefficacySet <- glmParametricSampling(logisticFit, nboot =500, Data.vaccinated, Data.control)CI <- lapply(EfficacyCI(efficacySet),"*",100)