Title: | Inference and Prediction of Generic Physiologically-Based Kinetic Models |
---|---|
Description: | Fit and simulate any kind of physiologically-based kinetic ('PBK') models whatever the number of compartments. Moreover, it allows to account for any link between pairs of compartments, as well as any link of each of the compartments with the external medium. Such generic PBK models have today applications in pharmacology (PBPK models) to describe drug effects, in toxicology and ecotoxicology (PBTK models) to describe chemical substance effects. In case of exposure to a parent compound (drug or chemical) the 'rPBK' package allows to consider metabolites, whatever their number and their phase (I, II, ...). Last but not least, package 'rPBK' can also be used for dynamic flux balance analysis (dFBA) to deal with metabolic networks. See also Charles et al. (2022) <doi:10.1101/2022.04.29.490045>. |
Authors: | Virgile Baudrot [aut, cre], Sandrine Charles [aut], Christelle Lopes [aut], Ophélia Gestin [ctb], Dominique Lamonica [ctb], Aurélie Siberchicot [ctb] |
Maintainer: | Virgile Baudrot <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.4 |
Built: | 2025-02-09 02:46:25 UTC |
Source: | https://github.com/cran/rPBK |
A dataset containing an example with 4 compartments.
data(dataCompartment4)
data(dataCompartment4)
A data frame with 21 rows and 7 variables:
vector of time
exposure concentration
replicate of experiment
compartiment 'intestin'
compartiment 'caecum'
compartiment 'cephalon'
compartiment 'reste'
#'
A dataset containing an example with a single compartment.
data(dataMaleGammarusSingle)
data(dataMaleGammarusSingle)
A data frame with 22 rows and 4 variables:
vector of time
exposure concentration
replicat of experiment
internal measured concentration
#'
Create a list giving data and parameters to use in the model inference.
dataPBK(object, ...) ## S3 method for class 'data.frame' dataPBK( object, col_time = NA, col_replicate = NA, col_exposure = NA, col_compartment = NA, time_accumulation = NA, ku_nest = NA, ke_nest = NA, k_nest = NA, ... ) nested_model(object) ## S3 method for class 'stanPBKdata' nested_model(object)
dataPBK(object, ...) ## S3 method for class 'data.frame' dataPBK( object, col_time = NA, col_replicate = NA, col_exposure = NA, col_compartment = NA, time_accumulation = NA, ku_nest = NA, ke_nest = NA, k_nest = NA, ... ) nested_model(object) ## S3 method for class 'stanPBKdata' nested_model(object)
object |
An object of class |
... |
Further arguments to be passed to generic methods |
col_time |
Column name of the time column |
col_replicate |
Column name of the replicate column |
col_exposure |
Column name of the exposure column. |
col_compartment |
Column names of the compartment column. If several columns, give a vector with the column names. |
time_accumulation |
A scalar giving accumulation time. |
ku_nest |
Vector of binary (0 or 1) to select the uptake route. Use the
nested_model() on the |
ke_nest |
Vector of binary (0 or 1) to select the excretion route. Use the
nested_model() on the |
k_nest |
Matrix of binary (0 or 1) to select interaction routes. Use the
nested_model() on the |
A list
with data and parameters require for model inference.
# (1) load data file data("dataCompartment4") # (2) prepare data set dataPBK_C4 <- dataPBK( object = dataCompartment4, col_time = "temps", col_replicate = "replicat", col_exposure = "condition", col_compartment = c("intestin", "reste", "caecum", "cephalon"), time_accumulation = 7) # (1) load data file data("dataCompartment4") # (2) prepare data set dataPBK_C4 <- dataPBK( object = dataCompartment4, col_time = "temps", col_replicate = "replicat", col_exposure = "condition", col_compartment = c("intestin", "reste", "caecum", "cephalon"), time_accumulation = 7) # (3) check nesting nested_model(dataPBK_C4) # (2bis) dataPBK_C42 <- dataPBK( object = dataCompartment4, col_time = "temps", col_replicate = "replicat", col_exposure = "condition", col_compartment = c("intestin", "reste", "caecum", "cephalon"), time_accumulation = 7, ku_nest = c(1,1,1,1), # No Change here ke_nest = c(1,1,1,1), # No Change here k_nest = matrix(c( c(0,1,1,1), c(0,0,1,1), c(0,0,0,0), c(0,0,0,0)), ncol=4,nrow=4,byrow=TRUE) # Remove ) # (3bis) re-checking nesting nested_model(dataPBK_C42)
# (1) load data file data("dataCompartment4") # (2) prepare data set dataPBK_C4 <- dataPBK( object = dataCompartment4, col_time = "temps", col_replicate = "replicat", col_exposure = "condition", col_compartment = c("intestin", "reste", "caecum", "cephalon"), time_accumulation = 7) # (1) load data file data("dataCompartment4") # (2) prepare data set dataPBK_C4 <- dataPBK( object = dataCompartment4, col_time = "temps", col_replicate = "replicat", col_exposure = "condition", col_compartment = c("intestin", "reste", "caecum", "cephalon"), time_accumulation = 7) # (3) check nesting nested_model(dataPBK_C4) # (2bis) dataPBK_C42 <- dataPBK( object = dataCompartment4, col_time = "temps", col_replicate = "replicat", col_exposure = "condition", col_compartment = c("intestin", "reste", "caecum", "cephalon"), time_accumulation = 7, ku_nest = c(1,1,1,1), # No Change here ke_nest = c(1,1,1,1), # No Change here k_nest = matrix(c( c(0,1,1,1), c(0,0,1,1), c(0,0,0,0), c(0,0,0,0)), ncol=4,nrow=4,byrow=TRUE) # Remove ) # (3bis) re-checking nesting nested_model(dataPBK_C42)
Compute quantiles 95 credible intervals
df_quant95_(x, ...)
df_quant95_(x, ...)
x |
An object of class |
... |
Additional arguments |
An object of class data.frame
returning median and 95 credible interval
This function export the linear iterpolation implemented in Stan. It can be use to re-sample the exposure profiles.
export_interpolate(x, xpt, ypt, chain = 1, iter = 1, ...)
export_interpolate(x, xpt, ypt, chain = 1, iter = 1, ...)
x |
interpolation point x |
xpt |
a vector of x axis (has to be same size as |
ypt |
a vector of y axis (has to be same size as |
chain |
number of chain |
iter |
number of iteration |
... |
Arguments passed to |
A sample of a stanfit object returning a linear interpolation
Bayesian inference of TK model with Stan
fitPBK(stanPBKdata, ...) ## S3 method for class 'stanPBKdata' fitPBK(stanPBKdata, ...)
fitPBK(stanPBKdata, ...) ## S3 method for class 'stanPBKdata' fitPBK(stanPBKdata, ...)
stanPBKdata |
List of Data require for computing |
... |
Arguments passed to |
An object of class fitPBK
containing two object: stanPBKdata
the data set used for inference and stanfit
returned by rstan::sampling
# (1) load data file data("dataCompartment4") # (2) prepare data set dataPBK_C4 <- dataPBK( object = dataCompartment4, col_time = "temps", col_replicate = "replicat", col_exposure = "condition", col_compartment = c("intestin", "reste", "caecum", "cephalon"), time_accumulation = 7) # (3) run Bayesian fitting: <5 sec to be executed # 1 chain and 10 iterations is fast to run but provide # bad goodness-of-fit fitPBK_C4_FASTbadGOF <- fitPBK(dataPBK_C4, chains = 1, iter = 10) # (3) run Bayesian fitting: > 5 sec to be executed # 4 chains and 2000 iterations provides better estimates fitPBK_C4 <- fitPBK(dataPBK_C4, chains = 4, iter = 2000)
# (1) load data file data("dataCompartment4") # (2) prepare data set dataPBK_C4 <- dataPBK( object = dataCompartment4, col_time = "temps", col_replicate = "replicat", col_exposure = "condition", col_compartment = c("intestin", "reste", "caecum", "cephalon"), time_accumulation = 7) # (3) run Bayesian fitting: <5 sec to be executed # 1 chain and 10 iterations is fast to run but provide # bad goodness-of-fit fitPBK_C4_FASTbadGOF <- fitPBK(dataPBK_C4, chains = 1, iter = 10) # (3) run Bayesian fitting: > 5 sec to be executed # 4 chains and 2000 iterations provides better estimates fitPBK_C4 <- fitPBK(dataPBK_C4, chains = 4, iter = 2000)
A fitPBK object containing Bayesian inference of the
dataCompartment4
data set.
data(fitPBK_C4)
data(fitPBK_C4)
A fitPBK
object with:
original data frame wrap in a formatted list for inference
a stanfit
object resulting from inference with stan
fitPBK
objectsThis is the generic plot
S3 method for the
fitTK
. It plots the fit obtained for each
variable in the original dataset.
## S3 method for class 'fitPBK' plot(x, ...)
## S3 method for class 'fitPBK' plot(x, ...)
x |
And object returned by |
... |
Additional arguments |
a plot of class ggplot
# (1) load a fitPBK object data("fitPBK_C4") # (2) plot result of bayesian fitting plot(fitPBK_C4)
# (1) load a fitPBK object data("fitPBK_C4") # (2) plot result of bayesian fitting plot(fitPBK_C4)
Plots posterior predictive check for fitPBK
ppc(x, ...) ## S3 method for class 'fitPBK' ppc(x, ...)
ppc(x, ...) ## S3 method for class 'fitPBK' ppc(x, ...)
x |
an object used to select a method |
... |
Further arguments to be passed to generic methods |
a plot of class ggplot
# (1) load a fitPBK object data("fitPBK_C4") # (2) plot ppc of bayesian fitting ppc(fitPBK_C4)
# (1) load a fitPBK object data("fitPBK_C4") # (2) plot ppc of bayesian fitting ppc(fitPBK_C4)