-
Notifications
You must be signed in to change notification settings - Fork 0
/
08.Rmd
123 lines (94 loc) · 3.22 KB
/
08.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
# 통계처리 {#statistics}
## 이 장에서는 {#stat-intro}
생물학적 동등성, 용량 비례성을 확인하는 통계 처리 방법을 알아보겠습니다.
```{r, message = FALSE}
library(tidyverse)
library(BE)
library(psych)
```
## 기술통계량 구하기 {#stat-desc}
앞서 \@ref(noncompart)장에서 구한 `Theoph_nca`를 갖고 기술 통계량 (평균, 표준편차, 최소값, 최대값, skewness, kurtosis)을 구해보겠습니다. `psych::describe()` 함수를 사용하면 간단히 구할 수 있습니다.
```{r include = FALSE}
load('data/Theoph_nca.Rdata')
```
```{r}
desc_stat_Theoph_nca <- describe(Theoph_nca) %>%
select(n, mean, sd, min, max, skew, kurtosis)
knitr::kable(desc_stat_Theoph_nca, digits = 2)
```
## Dose Proportionality {#dp}
DP 처리.
16명의 C~max~와 AUC~last~가 나온 표입니다. Table \@ref(tab:sad-pk)
```{r, sad-pk}
# setup ----
library(readxl)
library(tidyverse)
library(broom)
dp_data <- # Virtual data from 4 dose groups (N=16)
'Dose,Subject,Cmax,AUClast
50,101,860,2000
50,102,510,2300
50,103,620,2900
50,104,540,2400
100,201,1550,6600
100,202,1440,7400
100,203,2000,7300
100,204,1600,7000
200,301,4100,20400
200,302,2800,9500
200,303,3200,8000
200,304,2550,7070
400,401,4800,22000
400,402,5700,23000
400,403,5800,26700
400,404,5760,28884'
sad_indi_pk <- read_csv(dp_data)
knitr::kable(sad_indi_pk, caption = '16명의 C~max~, AUC~last~')
```
그림을 살펴보겠습니다.
```{r sad-indi-pk-log}
sad_indi_pk_log <- sad_indi_pk %>% mutate_all(log)
figA <- ggplot(sad_indi_pk_log, aes(x=Dose, y=Cmax)) +
geom_smooth(method = 'lm')+
geom_boxplot(aes(group = Dose),
size = 1,
outlier.colour = "red",
outlier.shape = 1,
outlier.size = 3) +
theme_bw() +
scale_x_continuous(breaks = c(50, 100, 200, 400)) +
labs(x = 'Dose (mg)', y = expression('C'[max]*' (ng/mL)'),
title = expression('C'[max]))
figA
figB <- ggplot(sad_indi_pk_log, aes(x=Dose, y=AUClast)) +
geom_smooth(method = 'lm')+
geom_boxplot(aes(group = Dose),
size = 1,
outlier.colour = "red",
outlier.shape = 1,
outlier.size = 3) +
theme_bw() +
scale_x_continuous(breaks = c(50, 100, 200, 400)) +
labs(x = 'Dose (mg)', y = expression('AUC'[(0-last)]*' (ng·hr/mL)'),
title = expression('AUC'[(0-last)]))
figB
```
lm() 함수를 써서 구할 수 있습니다.
```{r}
calc_dp <- function(param, fit) {
bind_cols(fit %>% summary %>% tidy %>% filter(term == 'Dose') %>% select(1, 'estimate', 'std.error'),
fit %>% confint(level = 0.95) %>% tidy %>% filter(.rownames == 'Dose'),
fit %>% summary %>% glance
) %>%
filter(term == 'Dose') %>%
select(-.rownames, -term) %>%
mutate(parameters = param) %>%
mutate(est = sprintf('%0.2f (%0.2f)', estimate, std.error)) %>%
mutate(ci = sprintf('%0.2f-%0.2f', X2.5.., X97.5..)) %>%
select(parameters, est, ci, r.squared, p.value)
}
fit_cmax <- lm(formula = Cmax ~ Dose, data = sad_indi_pk_log)
fit_auclast <- lm(formula = AUClast ~ Dose, data = sad_indi_pk_log)
bind_rows(calc_dp(param = 'Cmax', fit = fit_cmax),
calc_dp(param = 'AUClast', fit = fit_auclast))
```