Description Usage Arguments Details Value Examples
Model fitting for serological data
1 2 | serofit(seropositive, N, age.min = use.default(1L:length(seropositive),
"age.min"), age.max = use.default(age.min, "age.max"))
|
seropositive, |
the number of seropositive samples for each age group; length(seropositive) must be at least 3 |
N, |
the total number of samples for each age group; length(N) must equal length(seropositive) |
age.min, |
the low age in age groups; defaults to '1:length(seropositive)', i.e. assumes the seropositive data corresponds to yearly cohorts starting at age 1. |
age.max, |
the upper age in age groups; defaults to 'age.min', i.e. assumes each category corresponds to a single year |
Fits a constant force of infection, two-risk category model using seroprevalence survey data. i.e.:
$$ P_+(A) = p_H * (1-(1-f_H)^A) + (1-p_H) * (1-(1-f_L)^A) $$
This probability is fit to the seroprevalence by age category data,
using maximum likelihood and optim
.
a list of best-fit parameters, all numeric values:
force of infection, for the high risk group
force of infection, for the low risk group
the proportion of the population at high risk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | require(denvax);
data(morrison2010) # has counts by age
fit <- with(morrison2010, serofit(sero=Seropositive, N=Number, age.min=Age))
if (requireNamespace("data.table", quietly = TRUE)) {
data(lazou2016) # has counts by age range, instead of counts for every year
# this example uses `data.table`` functions to simplify processing
# several groups at once
lazou2016[,{
agerange <- data.table::tstrsplit(Age, "-")
serofit(
sero = Seropositive,
N = Number,
age.min = as.integer(agerange[[1]]),
age.max = as.integer(agerange[[2]])
)
}, by = Country]
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.