-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify get_exposure_matrix
to allow multiple serosurveys
#72
Comments
Hi @ben18785 . You're right, currently the package requires the user to use as input a single serological survey. It could also happen that a the user uses as input a dataframe including several serological surveys labelled by different values of I think the use of S3 classes can also address this issue (see #66 ). serofoi may be able to identify whether there is a single or several serological surveys in a given dataset by checking the unique values of |
Thanks @ntorresd I agree that we can use the |
What is in the exposure matrix? i.e., in the rows and columns? |
From memory, a row represents an age-group for which we have measurements; the columns are all the possible ages in the sample. Each row has a load of 1s and 0s -- the 1s are used to pick out the FOIs to which that row's age group was exposed, where we start from the oldest FOI. E.g. R code mimicking it: ages <- seq(1, 80, 1)
measured_ages <- c(10, 20, 75)
m_exposure <- matrix(nrow = length(measured_ages),
ncol = length(ages))
for(i in seq_along(measured_ages)) {
age <- measured_ages[i]
n_zeros <- length(ages) - age
n_ones <- age
m_exposure[i, ] <- c(rep(0, n_zeros), rep(1, n_ones))
} |
I get it .. more like counts for cumulative exposure over time .. |
Hi @ntorresd, I just had a chat with @ben18785 and think that we should think of way to code this such that even with multiple serosurveys, we still get a single set of FOIs, and not for each serosurvey. I think we discussed fitting for each serosurvey separately as my task (apologies if I misunderstood!)- so I'll put that on hold for now.. |
Hi @ntorresd , This following code takes in a dataframe with multiple serosurveys, splits it by year of serosurvey, create an exposure matrix using your original code, pads old surveys (to the right) and latest surveys (to the left), and appends (rbind here) all exposure matrices. Let me know what you think:
|
Hi @ntorresd. Updated code:
|
We may have data from multiple years. The current approach assumes a single survey year. This is linked to #70
The text was updated successfully, but these errors were encountered: