Closed jdawa closed 7 years ago
I am afraid what you are trying to do won't work like that for two reasons:
data("inference.results")
). These results are meant to be used with seven age groups, so it will still return those.incidence_function
is passed it currently uses the infectionODEs
function, which again assumes you are using seven groups.I recommend you first try to get the fitting working following the more in-depth inference example. That should get you new fitting results that you can then use for this step.
Thanks. I tried it again using your advice and it worked once I:
Hi, in the vaccination vignette, I’ve tried to change the number of age groups and risk groups from 7 age groups, 3 risk groups to 6 age groups and 2 risk groups. However, when I run the vaccination_scenario to get cases.per.year it seems to provide the number of new infected cases for 14 age groups instead of 12 age groups. The code I used is found below. If you look at cases.per.year1 at the end, it has cases in 14 age groups and not 12. Thanks for the help.
Load package and provide inputs for vaccine calendar
library("fluEvidenceSynthesis")
efficacy <- rep(c(0.7, 0.7, 0.7, 0.7, 0.7, 0.3), 2) calendar <- matrix(rep(0,12*4),ncol = 12) dates <- c(as.Date("2010-10-01"), as.Date("2010-11-01"), as.Date("2010-12-01"), as.Date("2011-01-01"))
Set rate of vaccine uptake for different dates/age groups
In this case the elderly (age group 6) start with a coverage of 0.62 in the first month followed by 0.7 and 0.925 in the second and third month. After three months the total uptake will be.
calendar[1,c(6,12)] <- 0.0 calendar[2,c(6,12)] <- 0.62 calendar[3,c(6,12)] <- 0.77 calendar[4,c(6,12)] <- 0.925
Set coverage for high risk young children
calendar[1,c(7,8)] <- 0.0 calendar[2,c(7,8)] <- 0.62 calendar[3,c(7,8)] <- 0.62 calendar[4,c(7,8)] <- 0.62
vaccine_calendar <- as_vaccination_calendar(efficacy = efficacy, dates = dates, coverage = calendar, no_age_groups = 6, no_risk_groups = 2)
Calculate the outbreak size
data("demography") data("polymod_uk") data("inference.results")
Reduce the number of age groups in polymod_uk to 6 by combining the last two age groups
poly <- polymod_uk[,c(1,2,3,4,5, 6,7,8)] poly[,8] <- rowSums(polymod_uk[,8:9]) polymod_uk <- poly
This returns the total size of the outbreak given the vaccination scenario and the 1000th posterior (mcmc) sample. The outbreak sizes is separated by age group and risk groups
cases.per.year1 <- vaccination_scenario(demography = demography, vaccine_calendar = vaccine_calendar, polymod_data = as.matrix(polymod_uk), contact_ids = inference.results$contact.ids[1000,], parameters = inference.results$batch[1000,], verbose = F )