glmParametricSampling {vaxpmx} | R Documentation |
Accounting for the uncertainty on the fitted "glm"
model and observed data
Description
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).
Usage
glmParametricSampling(Fit, nboot = 2000, Data.vaccinated, Data.control)
Arguments
Fit |
an object of class inheriting from |
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 |
Value
a vector of vaccine efficacy values VE_set
, with length of nboot
Examples
# Load required packages
library(dplyr)
# Load an example dataset
data(data_temp)
Data.vaccinated <- filter(data_temp, vaccine == 1)
Data.control <- filter(data_temp, vaccine == 0)
# Fit logistic model relating neutralizing titer to disease status, specific to serotype 2
logisticFit <- glm(disease_any ~ nAb1, data = data_temp, family = binomial())
# Estimate 95\% confidence interval of vaccine efficacy based on the fitted model
efficacySet <- glmParametricSampling(logisticFit, nboot = 500, Data.vaccinated, Data.control)
CI <- lapply(EfficacyCI(efficacySet),"*", 100)