Learn R Programming

vaxpmx (version 0.0.3)

glmParametricSampling: 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)

Value

a vector of vaccine efficacy values VE_set, with length of nboot

Arguments

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

Examples

Run this code
# 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)

Run the code above in your browser using DataLab