View source: R/sampling_utils.R
sampleIDs2 | R Documentation |
Function to sample IDs based on sampled time and metadata. This function will sample individuals that are diagnosed and active (individuals can or cannot be on ART) at the time of sampling.
sampleIDs2(
perc,
start_date,
end_date,
art_init,
departure,
diag_info,
origin,
tm,
location
)
perc |
Percentage of the population to be sampled: Numbers should be between 0 and 1. |
start_date |
Start date for sampling times in decimal year. |
end_date |
End date for sampling times in decimal year. |
art_init |
Dataframe of IDs and time each ID initiated antiretroviral treatment (ART). Time must be in decimal year. |
departure |
Dataframe of IDs and their time of departure. Time must be in decimal year. |
diag_info |
Dataframe of IDs and their time of diagnosis. Time must be in decimal year. |
tm |
Transmission matrix of who transmitted to whom. |
location |
Character of location at time of transmission to get IDs to sample from. Location can take the value of "region" or "global". |
This function will get all IDs in transmission matrix (tm) from location. From those IDs, it selected all IDs that have been diagnosed during a simulation run. From all diagnosed IDs, it will select all IDs that have been diagnosed before sampled time. Then, from this new list of IDs, it select all IDs that have been active before time of sampling. Finally, from active and diagnosed IDs before sampled times, it will get all IDs that never initiated ART before sample times. From those IDs not on ART, the function will random sample a ID to be associated to the sampled time. This function is to mimic the idea of sampling individuals on HIV studies.
Dataframe of IDs and their sampled times
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.