-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME.Rmd
More file actions
136 lines (92 loc) · 3.25 KB
/
README.Rmd
File metadata and controls
136 lines (92 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
dpi = 300
)
```
# serosv <img src="logo.svg" align="right" width="120"/>
<!-- badges: start -->
[](https://app.codecov.io/gh/OUCRU-Modelling/serosv?branch=main) [](https://github.com/OUCRU-Modelling/serosv/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
`serosv` is an easy-to-use and efficient tool to estimate infectious diseases parameters (seroprevalence and force of infection) using serological data. The current version is mostly based on the book "Modeling Infectious Disease Parameters Based on Serological and Social Contact Data -- A Modern Statistical Perspective" by [Hens et al., 2012 Springer](https://link.springer.com/book/10.1007/978-1-4614-4072-7).
## Installation
You can install the development version of serosv with:
```{r, eval = FALSE}
# install.packages("devtools")
devtools::install_github("OUCRU-Modelling/serosv")
```
## Feature overview
### Datasets
`serosv` contains 15 built-in serological datasets as provided by [Hens et al., 2012 Springer](https://link.springer.com/book/10.1007/978-1-4614-4072-7). Simply call the name to load a dataset, for example:
``` r
rubella <- rubella_uk_1986_1987
```
### Methods
The following methods are available to estimate seroprevalence and force of infection.
Parametric approaches:
- Frequentist methods:
- Polynomial models:
- Muench's model
- Griffiths' model
- Grenfell and Anderson's model
- Nonlinear models:
- Farrington's model
- Weibull model
- Fractional polynomial models
- Bayesian methods:
- Hierarchical Farrington model
- Hierarchical log-logistic model
Nonparametric approaches:
- Local estimation by polynomials
Semiparametric approaches:
- Penalized splines:
- Penalized likelihood framework
- Generalized Linear Mixed Model framework
## Demo
### Fitting rubella data from the UK
Load the rubella in UK dataset.
```{r}
library(serosv)
rubella <- rubella_uk_1986_1987
```
Fit the data using a fractional polynomial model via `fp_model()`. In this example, the model searches for the best combination of powers within a specified range.
```{r}
rubella_mod <- fp_model(
rubella,
p=list(
p_range=seq(-2,3,0.1), # range of powers to search over
degree=2 # maximum degree for the search
),
monotonic = T, # enforce model to be monotonic
link="logit"
)
rubella_mod
```
Visualize the model
```{r}
plot(rubella_mod)
```
### Fitting Parvo B19 data from Finland
```{r warning=FALSE, message=FALSE}
library(dplyr)
parvob19 <- parvob19_fi_1997_1998
# for linelisting data, either transform it to aggregated
transform_data(
parvob19$age,
parvob19$seropositive,
stratum_col = "age") |>
polynomial_model(k = 1) |>
plot()
# or fit data as is
parvob19 |>
rename(status = seropositive) |>
polynomial_model(k = 1) |>
plot()
```