Here is a list of the potential libraries that can be used for PK/PD study.
https://cran.r-project.org/web/views/Pharmacokinetics.html
# install.packages("PK")
# library(PK)
# install.packages("clinPK")
# library(PKreport)
library(PKNCA)
library(dplyr, quietly=TRUE)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
The weight of the mice is 24.5g The initial dose is 100 ug/kg (edited)
library(readr)
PK_study_BMP7_11112020_csv <- read_csv("PK_study_BMP7_11112020.csv.csv")
##
## -- Column specification --------------------------------------------------------
## cols(
## `time (min)` = col_double(),
## `mice 1 (ng/ml)` = col_double(),
## `mice 2 (ng/ml)` = col_double(),
## `mice 3 (ng/ml)` = col_double()
## )
library(tidyr)
library(dplyr)
conc_list = PK_study_BMP7_11112020_csv %>% gather(Subject_ID, Conc, -"time (min)")
conc_list = conc_list[-2]
colnames(conc_list)[1] = "Time"
# conc_list
mice_sub = c(rep(1, 7), rep(2, 7), rep(3, 7))
weights_ls = c(rep(24.5, 21))
dose_ls = c(rep(100, 21))
conc_list$Subject_ID = mice_sub
conc_list$Wt = weights_ls
conc_list$Dose = dose_ls
conc_list
## # A tibble: 21 x 5
## Time Conc Subject_ID Wt Dose
## <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0 0 1 24.5 100
## 2 3 2.52 1 24.5 100
## 3 10 2.84 1 24.5 100
## 4 15 2.43 1 24.5 100
## 5 30 1.80 1 24.5 100
## 6 60 1.04 1 24.5 100
## 7 120 0.649 1 24.5 100
## 8 0 0 2 24.5 100
## 9 3 NA 2 24.5 100
## 10 10 2.87 2 24.5 100
## # ... with 11 more rows
d_dose <- conc_list[conc_list$Time == 0,]
d_dose$Time <- 0
d_dose
## # A tibble: 3 x 5
## Time Conc Subject_ID Wt Dose
## <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0 0 1 24.5 100
## 2 0 0 2 24.5 100
## 3 0 0 3 24.5 100
conc_obj <- PKNCAconc(conc_list, Conc~Time|Subject_ID)
conc_obj
## Formula for concentration:
## Conc ~ Time | Subject_ID
## With 3 subjects defined in the 'Subject_ID' column.
## Nominal time column is not specified.
##
## First 6 rows of concentration data:
## Time Conc Subject_ID Wt Dose exclude volume duration
## 0 0.0000 1 24.5 100 <NA> NA 0
## 3 2.5164 1 24.5 100 <NA> NA 0
## 10 2.8439 1 24.5 100 <NA> NA 0
## 15 2.4334 1 24.5 100 <NA> NA 0
## 30 1.8048 1 24.5 100 <NA> NA 0
## 60 1.0359 1 24.5 100 <NA> NA 0
dose_obj <- PKNCAdose(d_dose, Dose~Time|Subject_ID)
dose_obj
## Formula for dosing:
## Dose ~ Time | Subject_ID
## Nominal time column is not specified.
##
## Data for dosing:
## Time Conc Subject_ID Wt Dose exclude route duration
## 0 0 1 24.5 100 <NA> extravascular 0
## 0 0 2 24.5 100 <NA> extravascular 0
## 0 0 3 24.5 100 <NA> extravascular 0
data_obj <- PKNCAdata(conc_obj, dose_obj)
data_obj
## Formula for concentration:
## Conc ~ Time | Subject_ID
## With 3 subjects defined in the 'Subject_ID' column.
## Nominal time column is not specified.
##
## First 6 rows of concentration data:
## Time Conc Subject_ID Wt Dose exclude volume duration
## 0 0.0000 1 24.5 100 <NA> NA 0
## 3 2.5164 1 24.5 100 <NA> NA 0
## 10 2.8439 1 24.5 100 <NA> NA 0
## 15 2.4334 1 24.5 100 <NA> NA 0
## 30 1.8048 1 24.5 100 <NA> NA 0
## 60 1.0359 1 24.5 100 <NA> NA 0
## Formula for dosing:
## Dose ~ Time | Subject_ID
## Nominal time column is not specified.
##
## Data for dosing:
## Time Conc Subject_ID Wt Dose exclude route duration
## 0 0 1 24.5 100 <NA> extravascular 0
## 0 0 2 24.5 100 <NA> extravascular 0
## 0 0 3 24.5 100 <NA> extravascular 0
##
## With 6 rows of AUC specifications.
## No options are set differently than default.
results_obj <- pk.nca(data_obj)
## Summarize the results
summary(results_obj)
## start end N auclast cmax tmax half.life aucinf.obs
## 0 24 3 32.9 [15.6] . . . .
## 0 Inf 3 . 2.93 [4.63] 10.0 [3.00, 10.0] 54.7 [3.33] 191 [14.3]
##
## Caption: auclast, cmax, aucinf.obs: geometric mean and geometric coefficient of variation; tmax: median and range; half.life: arithmetic mean and standard deviation