-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathepo_pts.Rmd
executable file
·193 lines (138 loc) · 3.26 KB
/
epo_pts.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
---
title: "Probability of Technical Success - EPO IV/SC QW/TIW"
date: ""
author: "Metrum Research Group, LLC"
output:
html_document:
css: docs/src/styles/styles.css
---
__Population Pharmacokinetic and Pharmacodynamic Model- Based Comparability Assessment of a Recombinant Human Epoetin Alfa and the Biosimilar HX575__
- Xiaoyu Yan, MS, Philip J. Lowe, PhD, Martin Fink, PhD, Alexander Berghout, PhD, Sigrid Balser, PhD, and Wojciech Krzyzanski, PhD
- J Clin Pharmacol. 2012 November ; 52(11): 1624–1644.
- https://www.ncbi.nlm.nih.gov/pubmed/22162538
```{r, message = FALSE}
library(mrgsolve)
library(dplyr)
library(tidyr)
a <- config::get()
#source(a$functions)
#knitr_config()
set.seed(112)
```
```{r}
post <- readRDS(a$epo_post)
head(post)
sam <- dplyr::sample_n(post, 100)
dim(sam)
dim(post)
```
```{r}
mod <- mread_cache("epo", a$epo_project)
see(mod)
```
Drop the initial `HGB` by half
```{r}
mod <- param(mod, THETA19 = mod$THETA19/2)
post <- mutate(post, THETA19 = THETA19/2)
```
```{r}
qw <- ev(amt = 40000, ii = 168, addl = 3, rate = -2)
tiw <- ev_days(ev(amt = 7000, rate = -2), days="m,w,f", addl = 3)
tiw
qw <- filter(tiw, time==0) %>% mutate(amt = 40000)
qw
```
```{r}
data_sc <- bind_rows(tiw,qw) %>% mutate(ID = amt)
data_sc
```
## SC dosing
- When subcuteneous administration, 40,000 IU weekly has similar efficacy
to 100 IU/kg TIW
- We're looking out to 4 weeks here
```{r}
mod %>%
zero_re %>%
mrgsim(data = data_sc, end = 672) %>%
plot(EPOi + HGBi~.)
```
```{r}
data_sc
data_iv <- mutate(data_sc, cmt = 2, rate = 0)
data_iv
```
## IV administration
- But when we look at the TIW versus QW comparison with IV administration,
the once-weekly is less effective than three-times-weekly
```{r}
mod %>%
zero_re %>%
mrgsim(data = data_iv, end = 672) %>%
plot(EPOi + HGBi~.)
```
# Our task
Let's look at the probability of technical success for the QW versus TIW
dosing in the IV case
Let's ramp this up for PTS
## Population data sets
TIW data
```{r}
iv_tiw <- ev_rep(tiw, id = 1:250) %>% mutate(cmt = 2, rate = 0)
```
QW data
```{r}
iv_qw <- filter(iv_tiw, time==0) %>% mutate(amt = 40000, ID = ID + 1000)
```
If we bind this all together, we can simulate both regimens in one go
```{r}
data <- bind_rows(iv_tiw, iv_qw)
data
```
- What about simulating some variatility in Weight?
A simulation function
Arguments
- `i` replicate number
- `mod` the EPO model object
- `data` a template data set
```{r}
sim <- function(i, mod, data) {
mod <- param(mod, slice(post,i))
out <- mrgsim(mod, data = data, obsonly = TRUE,
end = -1, add = 672)
mutate(out, irep = i, qw = as.integer(ID >= 1000))
}
```
Test it out
```{r}
sim(2, mod, data)
```
## Simulate
- Remember to set a seed
- And change the `RNGkind`
- What about uncertainty in the random effect variances?
```{r}
set.seed(10020)
mcRNG()
out <- parallel::mclapply(1:101, mc.cores = 8,
sim, mod, data) %>% bind_rows
```
## Summarize
Our target is HGB > 8.5
```{r}
sum1 <-
out %>%
group_by(irep,qw) %>%
summarise(success = mean(HGBi > 8.5))
sum1
```
Our success criteria is at least 40% of patients hitting the target
```{r}
sum2 <-
sum1 %>%
group_by(qw) %>%
summarise(PR = mean(success > 0.4))
```
The bottom line
```{r}
sum2
```