pwcrate: Piecewise Constant Rate

Description Usage Arguments Examples

Description

Using a piecewise constant force of infection, monotonicity is often achieved by redefining the age categories over which a constant force of infection is assumed.

Usage

1
pwcrate(y.var, x.var, n.var, breaks, startpar)

Arguments

y.var

The response variable (binary, 1=past infection, 0=otherwise).

x.var

Numeric vector of age categories.

n.var

Number of individuals.

breaks

Age categories to be considered.

startpar

Starting values for the “nlm” method used in this function. This is a vector of length(breaks)-1.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Using Belgian B19 data
data("VZV_B19_BE_0103")
VZV_B19_BE_0103 <- VZV_B19_BE_0103[!is.na(VZV_B19_BE_0103$parvores)&!is.na(VZV_B19_BE_0103$age)&
  VZV_B19_BE_0103$age<70&VZV_B19_BE_0103$age>=1,]
VZV_B19_BE_0103 <- VZV_B19_BE_0103[order(VZV_B19_BE_0103$age),]

y <- VZV_B19_BE_0103$parvores
a <- VZV_B19_BE_0103$age

# Age category
breakpoints <- c(0.5,2,6,12,19,31,100)

# Monotonized piecewise constant FOI
pcw.fit <- pwcrate(y.var=y, x.var=a, breaks=breakpoints)

TeaKov/serostat documentation built on May 21, 2019, 1:21 p.m.