View source: R/polynomial_models.R
| polynomial_model | R Documentation |
Either 'status' (treated as line-listing dataset) or 'pos' & 'tot' (treated as aggregated dataset) must be provided
polynomial_model(
age,
k,
type,
pos = NULL,
tot = NULL,
status = NULL,
link = "log"
)
age |
the age vector. |
k |
degree of the model. |
type |
name of method (Muench, Giffith, Grenfell). |
pos |
the positive count vector (optional if status is provided). |
tot |
the total count vector (optional if status is provided). |
status |
the serostatus vector (optional if pos & tot are provided). |
link |
link function. |
Refers to section 6.1.1
a list of class polynomial_model with 5 items
datatype |
type of datatype used for model fitting (aggregated or linelisting) |
df |
the dataframe used for fitting the model |
info |
fitted "glm" object |
sp |
seroprevalence |
foi |
force of infection |
data <- parvob19_fi_1997_1998[order(parvob19_fi_1997_1998$age), ]
aggregated <- transform_data(data$age, data$seropositive)
# fit with aggregated data
model <- polynomial_model(aggregated$t, pos = aggregated$pos, tot = aggregated$tot, type = "Muench")
# fit with linelisting data
model <- polynomial_model(data$age, status = data$seropositive, type = "Muench")
plot(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.