Skip to content

Instantly share code, notes, and snippets.

@adamkucharski
Last active April 17, 2023 23:38
Show Gist options
  • Save adamkucharski/8bcacb49dd167e652bd628c6ba4ed559 to your computer and use it in GitHub Desktop.
Save adamkucharski/8bcacb49dd167e652bd628c6ba4ed559 to your computer and use it in GitHub Desktop.
Application of serofoi package to Fiji dengue seroprevalence data
# serofoi analysis on Fiji serosurvey data
# Load libraries
library(remotes)
remotes::install_github("TRACE-LAC/serofoi")
library(serofoi)
library(rio)
# Load Fiji dengue data
url_fiji <- "https://raw.githubusercontent.com/adamkucharski/fiji-denv3-2014/master/data/serology_inputs.csv"
data_fiji <- rio::import(file = url_fiji)
# Format Fiji data - DENV3 positive in 2013 (2015 = DENV3BP)
data_tally <- data_fiji |> group_by(AGE_2015) |> summarise(pos=sum(DENV3BP),tot=n())
# Loading and preparing data for modelling
serodata <- data.frame(age_min=data_tally$AGE_2015, # min age
age_max=(data_tally$AGE_2015+4), #max age
counts=data_tally$pos, # positive for DENV serotype
total=data_tally$tot, # total tested
tsur=2015, # year of survey
survey = "Fiji",
country = "FJI",
test="MIA",
antibody="IgG"
)
# Example from package
# data("serodata")
serodata_test <- prepare_serodata(serodata)
# Model implementation
model_epidemic <- run_seromodel(serodata = serodata_test,
foi_model = "tv_normal_log",
n_iters = 500)
# Visualisation
#plot_seromodel(model_epidemic, size_text = 6)
plot(model_epidemic$foi_cent_est$year,model_epidemic$foi_cent_est$medianv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment