Skip to contents

Either `status` (treated as line-listing dataset) or `pos` & `tot` (treated as aggregated dataset) must be provided

Usage

polynomial_model(
  age,
  k,
  type,
  pos = NULL,
  tot = NULL,
  status = NULL,
  link = "log"
)

Arguments

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 function.

Value

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

Details

Refers to section 6.1.1

Examples

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)