-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
122 lines (87 loc) · 4.34 KB
/
README.Rmd
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
---
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%"
)
```
# predint
<!-- badges: start -->
[![CRAN downloads](https://cranlogs.r-pkg.org/badges/grand-total/predint)](https://CRAN.R-project.org/package=predint)
[![CRAN downloads](https://cranlogs.r-pkg.org/badges/predint)](https://CRAN.R-project.org/package=predint)
<!-- badges: end -->
In many pharmaceutical and biomedical applications such as assay validation, assessment
of historical control data or the detection of anti-drug antibodies, prediction intervals
are of use.
The package predint provides functions to calculate bootstrap calibrated
prediction intervals (or limits) for one or more future observations based on overdispersed
binomial data, overdispersed Poisson data, as well as data that is modeled by
linear random effects models fitted with lme4::lmer(). The main functions are:
* `beta_bin_pi()` for beta-binomial observations (overdispersion differs between clusters)
* `quasi_bin_pi()` for quasi-binomial observations (constant overdispersion between clusters)
* `neg_bin_pi()` for negative_binomial observations (overdispersion differs between clusters)
* `quasi_pois_pi()` for quasi-Poisson observations (constant overdispersion between clusters)
* `lmer_pi_futmat()` for data that is modeled by a linear random effects model.
This function takes the experimental design of the future observations into account
if computed for $M>1$ observations.
For all of these functions, it is assumed that the historical, as well as the future
(or current) observations descend from the same data generating process.
## Installation
You can install the released version of predint from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("predint")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("MaxMenssen/predint")
```
## Example
The following example is based on the scenario described in Menssen and Schaarschmidt
2019: Based on historical control data for the mortality of male B6C3F1-mice
obtained in long term studies at the National Toxicology Program (NTP 2017), prediction
intervals (PI) can be computed in order to validate the observed
mortality in one concurrent (or future) control group.
Similarly to Menssen and Schaarschmidt 2019, it is assumed, that the data is
overdispersed binomial. Hence, the `quasi_bin_pi()` function will be used in the
following two examples.
### Evaluation of one future control group
In this example, the validation of one control group the is comprised of 30 mice
is of interest. For this purpose, a pointwise 95 % prediction interval for one
future observation is computed based on the historical data.
Since the underlying distribution is skewed, the lower and the upper prediction limit
are calibrated independently from each other (by setting `algorithm="MS22mod"`).
```{r example}
# load predint
library(predint)
# Data set
# see Table 1 of the supplementary material of Menssen and Schaarschmidt 2019
mortality_HCD
# PI for one future control group comprised of 30 mice
pi_m1 <- quasi_bin_pi(histdat=mortality_HCD,
newsize=30,
traceplot = FALSE,
alpha=0.05,
algorithm="MS22mod")
pi_m1
```
The mortality of a concurrent control group is in line with the historical knowledge,
if it is not lower than `r round(pi_m1$prediction$lower, 3)` or higher than `r round(pi_m1$prediction$lower, 3)`.
A graphical overview about the prediction interval can be given with
```{r warning=FALSE}
plot(pi_m1)
```
## References
Menssen, M., Schaarschmidt, F.: Prediction intervals for all of M
future observations based on linear random effects models. Statistica Neerlandica.
2022. [DOI: 10.1111/stan.12260](https://doi.org/10.1111/stan.12260)
Menssen M, Schaarschmidt F.: Prediction intervals for overdispersed binomial data
with application to historical controls. Statistics in Medicine. 2019;38:2652-2663.
[DOI:10.1002/sim.8124](https://doi.org/10.1002/sim.8124)
NTP 2017: [Tables of historical controls: pathology tables by route/vehicle.](https://ntp.niehs.nih.gov/data/controls), Accessed
May 17, 2017.