pwcfoi: Piecewise Constant Force of Infection

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
pwcfoi(response, x.var, breaks)

Arguments

response

The response variable.

x.var

The predictor variable.

breaks

The user chosen categories over which a constant force of infection is assumed.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Using Bulgarian HAV data
data("HAV_BUL_64_BUL_64")
a<-c(rep(HAV_BUL_64$Age,HAV_BUL_64$Pos),rep(HAV_BUL_64$Age,HAV_BUL_64$Tot-HAV_BUL_64$Pos))
y<-c(rep(rep(1,length(HAV_BUL_64$Age)),HAV_BUL_64$Pos),rep(rep(0,length(HAV_BUL_64$Age)),
  HAV_BUL_64$Tot-HAV_BUL_64$Pos))
y<-y[order(a)]
a<-a[order(a)]

grid<-sort(unique(round(a)))
neg<-HAV_BUL_64$Tot-HAV_BUL_64$Pos
pos<-HAV_BUL_64$Pos
tot<-neg+pos

# monotone curve
breaks1<-c(0,10,20,40,60,100)
pcwfit1<-pwcfoi(response=y,x.var=a,breaks=breaks1)

# non-monotone curve
breaks2<-c(0,5,11,18,60,100)
pcwfit2<-pwcfoi(response=y,x.var=a,breaks=breaks2)

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