Code Monkey home page Code Monkey logo

combprevnet's Introduction

EpiModel

CRAN Version Build Status Methods


Tools for simulating mathematical models of infectious disease dynamics. Epidemic model classes include deterministic compartmental models, stochastic individual-contact models, and stochastic network models. Network models use the robust statistical methods of exponential-family random graph models (ERGMs) from the Statnet suite of software packages in R. Standard templates for epidemic modeling include SI, SIR, and SIS disease types. EpiModel features an easy application programming interface (API) for extending these templates to address novel scientific research aims.

Lead Authors

Samuel M. Jenness Department of Epidemiology Emory University
Steven M. Goodreau Department of Anthropology University of Washington
Martina Morris Departments of Statistics and Sociology University of Washington
Adrien Le Guillou Department of Epidemiology Emory University
Chad Klumb Center for Studies in Demography and Ecology University of Washington

Additional contributors to EpiModel are listed on the contributors page.

Installation

The current release version can be found on CRAN and installed with:

install.packages("EpiModel", dependencies = TRUE)

To install this development version, use the remotes package:

if (!require("remotes")) install.packages("remotes")
remotes::install_github("EpiModel/EpiModel")

Documentation and Support

Website. The main website for EpiModel, with tutorials and other supporting files, is here: http://www.epimodel.org/.

Methods Paper. A good place to start learning about EpiModel is the main methods paper published in the Journal of Statistical Software. It is available at: https://doi.org/10.18637/jss.v084.i08.

Summer Course. Network Modeling for Epidemics is our annual 5-day course at the University of Washington where we teach the statistical theory, software tools, and applied modeling methods using EpiModel. Our course materials are open-source and updated annually around the time of the course.

Getting Help. Users are encouraged to use Github issues on this repository as a place to ask questions (both technical coding questions and conceptual modeling questions), report bugs, and request new features & functionality. Broader modeling questions can be posted on the Discussions board here.

The EpiModel Gallery

The EpiModel Gallery contains templates of extensions to EpiModel, for now focused on network-based mathematical modeling class. We will be continuing to add new examples the gallery, and encourage users to either file requests for new examples or else to contribute them directly.

Citation

If using EpiModel for teaching or research, please include a citation our main methods paper:

Jenness SM, Goodreau SM and Morris M. EpiModel: An R Package for Mathematical Modeling of Infectious Disease over Networks. Journal of Statistical Software. 2018; 84(8): 1-47. doi: 10.18637/jss.v084.i08

Please also send us an email if you have used EpiModel in your work so we can add the citation below.

Funding

The primary support for the development of these software tools and statistical methods has been by two National Institutes of Health (NIH) grants. Our applied research projects using EpiModel have received funding from the NIH and Centers for Disease Control and Prevention (CDC). Our team also receives institutional support through center-level NIH grants. A full list of our funding support can be found here.

EpiModel in the Scientific Literature

EpiModel and its extension packages have been used in the following scientific journal articles. A list of these articles can be accessed in a wiki page or on Zotero. (If you are aware of others, send us an email at [email protected] to be included in this list.)

Copyright

These materials are distributed under the GPL-3 license, with the following copyright and attribution requirements listed in the LICENSE document above.

combprevnet's People

Contributors

adrienleguillou avatar andsv2 avatar smjenness avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

combprevnet's Issues

Multiple Partner Flagged Testing

In the current workflow, it is possible that an identified partner could be identified in more than one partnership:

p1 p2 ptype start stop
1   5    2        10    NA
72 5    2        20    50

In this scenario 1 and 75 have tested positive and correctly recall individual 5. Should this be treated (as it is now) as one testing event, with two chances for identification or should everything be done at the partnership level?

Restarting ART's for Identified Partners

@smjenness

In hivtx_msm we wanted to allow individuals who have been identified through the elicitation process to possibly reinitialize ART services at a higher rate. Is this meant to only occur at the time they are identified, or, like halting of ART services, meant to be ongoing and based only on the part.art parameter (identifies if someone has been on ART's and identified through the identification process).

  ## Restarting (partner services)
  part.tx.reinit.elig <- which(tx.status == 0 & part.art == 1 & part.ident == at)

Pull Out Identification into a separate module

Currently, partner identification and screening for HIV occurs within hivtest_msm. Instead, we would like to pull out the identification process into it's own separate module (part.ident) and update hivtest_msm to account for individuals who are testing during a general testing process and those who are testing due to partner notification.

Failure to update plist for edges dropped in mod.departure

Currently in EpiModel, the plist is updated at every step. In particular, the time at which a relationship ends will be recorded based on results of a call to tergmLite::simulate_network. Unless specified otherwise, code comes from here:
https://github.com/EpiModel/EpiModelHIV-p/blob/CombPrev/R/mod.simnet.R

dat$el[[1]] <- tergmLite::simulate_network(p = dat$p[[1]],
                                             el = dat$el[[1]],
                                             coef.form = nwparam.m$coef.form,
                                             coef.diss = nwparam.m$coef.diss$coef.adj,
                                             save.changes = TRUE)

plist1 <- update_plist(dat, at, ptype = 1)

Thus, the entries in plist that are assigned are based on the updated edgelist (specifically the "changes" attribute of the dat$el[[ptype]] object):

update_plist <- function(dat, at, ptype) {
  # pull existing partner type specific list
  plist1 <- dat$temp$plist[dat$temp$plist[, "ptype"] == ptype, ]

  # look up dissolutions, update stop time
  uid <- dat$attr$uid
  news <- attr(dat$el[[ptype]], "changes")
  news_uid <- cbind(matrix(uid[news[, 1:2]], ncol = 2), news[, 3])
  news_uid_stop <- news_uid[news_uid[, 3] == 0, , drop = FALSE]
  pid_plist1 <- plist1[, 1]*1e7 + plist1[, 2]
  pid_stop <- news_uid_stop[, 1]*1e7 + news_uid_stop[, 2]
  matches_stop <- match(pid_stop, pid_plist1)
  plist1[matches_stop, "stop"] <- at

  # look up new formations, row bind them
  news_uid_start <- news_uid[news_uid[, 3] == 1, , drop = FALSE]
  plist1 <- rbind(plist1, cbind(news_uid_start[, 1:2, drop = FALSE], ptype, at, NA))

  return(plist1)
}

Then, the plist is updated latter on by dropping those who's relationships have stopped:

  if (dat$control$truncate.plist == TRUE) {
    to.keep <- which(is.na(dat$temp$plist[, "stop"]))
    dat$temp$plist <- dat$temp$plist[to.keep, ]
  }

However, this method for dropping individuals from the plist fails to drop relationships that are ended by an ego exiting the population (I think). Code in the mod.departure script drops edges:

  if (length(idsDepAll) > 0) {
    dat$attr$active[idsDepAll] <- 0
    for (i in 1:3) {
      dat$el[[i]] <- tergmLite::delete_vertices(dat$el[[i]], idsDepAll)
    }
    dat$attr <- deleteAttr(dat$attr, idsDepAll)
    if (unique(sapply(dat$attr, length)) != attributes(dat$el[[1]])$n) {
      stop("mismatch between el and attr length in departures mod")
    }
  }

However, I don't think these changes are stored in the dat$el[[ptype]] changes attribute as a result, these relationships stored in the plist will never be assigned a date for the relationship ending, and thus the will never be dropped from the plist.

I am not sure how important this is to anyone else, or how clear this is. If anyone has questions, just let me know. Thanks!

New parameter to limit index patients by minimum cumulative degree

parameter name: part.index.degree
default: 1
function: this would limit index patients in the cumulative partner list to those with a degree of part.index.degree or greater. For example, part.index.degree = 3, would remove from the list any index patients who show up in the list only 1 or 2 times.

Partner Identification Should Be Stochastic

Identification of partners for testing should not be fixed; instead introduce identification probability parameter based on partnership type; e.g. part.ident = c(0.75, 0.5, 0.1).

Update Validation Scripts for Internal Consistency

Along with checks on signal output, there should be a check on internal consistency of simulation results. As an example part.identified, the attribute tracking total number of partners identified within some timing window, should be equal to or less than part.screened, the attribute tracking whether an identified partner screened or not.

PreP Start

All partners who screen negative during partner based screening - HIV never tested, screen negative at time at and previously screened HIV negative individuals - are then started on PreP. This will be an update of the module for starting of prep: prep.net.

R and Package Updates

Update R to 4.x
Update all packages to current.
Use current CRAN version of statnet packages
Use current CRAN version of tergmLite
Use Github master of EpiModel

Update library, then run renv::snapshot(), then commit the renv.lock file

Wording of recent.diag param

This is unclear:

#' @param recent.diag The number of time steps back that a HIV+ MSM may be considered
#'        to be incident for purposes of partner elicitation.

Partner Recall Period

Partner lookback, the time interval used to identify partners of newly HIV diagnosed individuals, should be flexible and based initially on partnership type.

Option: Reduced Halting of ART Services

With new HIV+ identified through partner process (either through screening, or previous HIV diagnosis) we want to add the option that potentially individuals are engaged in supportive HIV care services, e.g. a reduction in dropout.

Add Internal Validation of New Model Code to Wiki Pages

This should be done whenever new functionality is developed for the project:

  • internal test to see the model runs without error
  • run code in debug model to catch any "silent errors"
  • run simulations across a range of parameter values, including the extreme parameter values (e.g., probability parameters of 0 and 1)
  • demonstrate parameter signal by showing relationship between inputs and outputs

Nodematch on age group error

Following updates to ergm and tergm, errors now introduced during network resimulation related to age.group missing data.

New Attribute: Time Identified

Addition of the attribute time.ident to partners identified for testing at time step at. At the end of testing, update attribute to denote when partner is identified, to make sure we are not duplicating testing of individuals within the "lookback period" for partner identification. Once at - time.ident is greater than partner lookback period, reset this to NA to allow for reentry into partner eligible testing.

Partnership Type Subsetting

Incorporate a parameter that allows for partner identification to be based on partnership type: e.g. ptype.lookback = c(1, 2, 3) or any combination of the three partnership types for partner notification.

Process 2: Partner PreP Start Time

In EpiModelHIV, initiation of PreP services is done when the parameter prep.start has passed a predefined step. For CombPrevNet, we want to include a separate parameter that handles initiation of PreP services for partners identified: prep.start.part.

Partner Identification versus Identified Partner Testing

As detailed here, under Discussion, if the partner lookback period is too high, MSM identified through partner elicitation are more likely to have had a recent test than if the lookback period was shorter. This is because eligibility for testing is tied up in partner identification, when - logically - the two should be separate: individuals are identified regardless of testing status of the identified partner; it is only in hivtest_msm that an individuals testing elig. should be evaluated. However, because this eligibility depends on partnership type, this is calculated at the same time when calculations are done using the temporary parntership list.

This has the effect of dampening total partners identified and partners tested, when it should in fact dampen only partners tested.

Documentation

Update documentation for EpiModelHIV@CombPrevNet.

hiv.scrn.rate parameter in 01-validation missing

In code below, hiv.scrn.rate is nowhere in EpiModelHIV

param <- param_msm(epistats = epistats,
                   netstats = netstats,
                   hiv.scrn.rate = c(1, 1, 1),
                   part.identification = 1,
                   part.lookback.main = 52,
                   part.lookback.casl = 52,
                   part.lookback.ooff = 52,
                   part.ident.main = 1,
                   part.ident.casl = 1,
                   part.ident.ooff = 1,
                   ptype.lookup = c(1, 2, 3)
)

Check logic for diag.time and recent positive selection

In my two recent commits on EpiModelHIV:

  1. ed9af66061d9cfe54867efb454e48a7b80ea5bd2
  2. 1c72dc069fdc60c5b85b8d6cef738662b47261e8

I fixed when diag.time was greater than present in the init status fx, and then the logic for recent positive diagnosis selection in the partner ident fx.

Please double-check this makes sense.

Rework truncate.plist param so that it accepts a numerical input

Instead of TRUE/FALSE, it would retain all partnerships that have stopped within X number of time steps. For example, if X was 12, then we would keep all active partnerships and those that have ended within the past 12 time steps. This will improve model efficiency.

New Attribute: part.art

Introduce a new attribute so that we are keeping track of people who are eligible for ART services through partner identification: we want to make sure that if someone screens negative through partner identification, and then subsequently screens positive during general testing - that they are not onboarding to ART (or PreP is general screening negative) at an elevated rate.

Model Schematic 3: HIV+ Linkage to Care

Create wikipedia page for schematic breakdown of linking HIV+ partners to care through hivtx_msm. Note: use work on Model Schematic 2 as a guide for this process.

HIV tx module questions

For halting, the process is split into PN and individual-level processes:

  ## Halting: Identified through partner elicitation
  tx.halt.part.elig <- which(tx.status == 1 & tt.traj == 1 & part.art == 1)
  rates.part <- part.tx.halt.part.prob[race[tx.halt.part.elig]]
  tx.halt.part <- tx.halt.part.elig[rbinom(length(tx.halt.part.elig), 1, rates.part) == 1]

  tx.halt.full.elig <- which(tx.status == 1 & tt.traj == 2 & part.art == 1)
  rates.full <- part.tx.halt.part.prob[race[tx.halt.full.elig]] * tx.halt.full.rr[race[tx.halt.full.elig]]
  tx.halt.full <- tx.halt.full.elig[rbinom(length(tx.halt.full.elig), 1, rates.full) == 1]

  tx.halt.dur.elig <- which(tx.status == 1 & tt.traj == 3 & part.art == 1)
  rates.dur <- part.tx.halt.part.prob[race[tx.halt.dur.elig]] * tx.halt.dur.rr[race[tx.halt.dur.elig]]
  tx.halt.dur <- tx.halt.dur.elig[rbinom(length(tx.halt.dur.elig), 1, rates.dur) == 1]

  tx.halt <- c(tx.halt.part, tx.halt.full, tx.halt.dur)

  ## Halting
  tx.halt.part.elig <- which(tx.status == 1 & tt.traj == 1)
  rates.part <- tx.halt.part.prob[race[tx.halt.part.elig]]
  tx.halt.part <- tx.halt.part.elig[rbinom(length(tx.halt.part.elig), 1, rates.part) == 1]

  tx.halt.full.elig <- which(tx.status == 1 & tt.traj == 2)
  rates.full <- tx.halt.part.prob[race[tx.halt.full.elig]] * tx.halt.full.rr[race[tx.halt.full.elig]]
  tx.halt.full <- tx.halt.full.elig[rbinom(length(tx.halt.full.elig), 1, rates.full) == 1]

  tx.halt.dur.elig <- which(tx.status == 1 & tt.traj == 3)
  rates.dur <- tx.halt.part.prob[race[tx.halt.dur.elig]] * tx.halt.dur.rr[race[tx.halt.dur.elig]]
  tx.halt.dur <- tx.halt.dur.elig[rbinom(length(tx.halt.dur.elig), 1, rates.dur) == 1]

  tx.halt <- c(tx.halt.part, tx.halt.full, tx.halt.dur)

But the IDs that halt from the PN process would be overwritten by the individual-level process because you are using tx.halt to track both. Can you explain what is going on here?

New/Updated Epitrackers

With the addition of partnership level testing, current epitrackers need to be updated and new epitrackers introduced. Some examples: total testing (updated), newly diagnosed (updated), last negative test (updated), total partners identified (new), total partners screened for testing (new), etc.

Use of tergmLite in calibration

It looks like tergmLite is not being used in model calibration:

control <- control_msm(simno = fsimno,
                       nsteps = 52*60,
                       nsims = ncores,
                       ncores = ncores,
                       save.nwstats = FALSE,
                       save.clin.hist = FALSE,
                       tergmLite = FALSE)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.