Skip to content

Commit 1165145

Browse files
authored
Merge pull request #16 from levenc/devel
Devel
2 parents ebb8d37 + 948d8bd commit 1165145

File tree

61 files changed

+2042
-646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2042
-646
lines changed

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: posologyr
22
Title: Individual dose optimization using population pharmacokinetics
3-
Version: 0.1.0
3+
Version: 0.1.1
44
Authors@R: c(
55
person("Cyril","Leven",role = c("aut", "cre","cph"),
66
email = "cyril.leven@chu-brest.fr",
@@ -29,6 +29,7 @@ Suggests:
2929
rmarkdown,
3030
testthat (>= 3.0.0),
3131
ggplot2,
32+
magrittr,
3233
data.table
3334
URL: https://levenc.github.io/posologyr/, https://github.com/levenc/posologyr
3435
BugReports: https://github.com/levenc/posologyr/issues

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export(poso_dose_auc)
66
export(poso_dose_ctime)
77
export(poso_estim_map)
88
export(poso_estim_mcmc)
9+
export(poso_inter_cmin)
910
export(poso_simu_pop)
1011
export(poso_time_cmin)
1112
export(posologyr)

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# posologyr 0.1.1
2+
3+
* `poso_time_cmin()`, `poso_dose_ctime()`, and `poso_dose_auc()` now work for multiple dose regimen.
4+
* `poso_inter_cmin()` allows the optimization of the inter-dose interval for multiple dose regimen.
5+
* `vignette("case_study_vancomycin")` illustrates AUC-based optimal dosing, multiple dose regimen, and continuous intravenous infusion.
6+
17
# posologyr 0.1.0
28

39
First public release.

R/data.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#' FICTIONAL IV tobramycin model for test purpose
2020
#'
21-
#' A FICTIONAL bicompartmental population pharmacokinetic
21+
#' A FICTIONAL two-compartment population pharmacokinetic
2222
#' model of intravenous tobramycin.
2323
#'
2424
#' @format A list of six objects:

R/estim_functions.R

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
#' @param object A posologyr list, created by the \code{\link{posologyr}}
3838
#' function.
3939
#' @param n_simul An integer, the number of simulations to be run. For `n_simul
40-
#' = 0`, all ETAs are set to 0.
40+
#' =0`, all ETAs are set to 0.
4141
#' @param return_model A boolean. Returns a RxODE model using the simulated
4242
#' ETAs if set to `TRUE`.
4343
#'
44-
#' @return If `return_model` is set to `FALSE`, a dataframe of the
45-
#' individual values of ETA.
44+
#' @return If `return_model` is set to `FALSE`, a list of one element: a
45+
#' dataframe `$eta` of the individual values of ETA.
4646
#' If `return_model` is set to `TRUE`, a list of the dataframe of the
4747
#' individual values of ETA, and a RxODE model using the simulated ETAs.
4848
#'
@@ -64,7 +64,7 @@
6464
#'
6565
#' @export
6666
poso_simu_pop <- function(object=NULL,n_simul=1000,
67-
return_model = TRUE){
67+
return_model=TRUE){
6868

6969
omega <- object$omega
7070
eta_mat <- matrix(0,nrow=1,ncol=ncol(omega))
@@ -89,7 +89,7 @@ poso_simu_pop <- function(object=NULL,n_simul=1000,
8989
theta <- rbind(object$theta)
9090
covar <- object$tdm_data[1,object$covariates]
9191
names(covar) <- object$covariates
92-
model_pop$params <- cbind(theta,eta_df,covar,row.names = NULL)
92+
model_pop$params <- cbind(theta,eta_df,covar,row.names=NULL)
9393
eta_pop$model <- model_pop
9494
}
9595

@@ -111,10 +111,10 @@ poso_simu_pop <- function(object=NULL,n_simul=1000,
111111
#' (RSE) of the MAP estimates of ETA if set to `TRUE`.
112112
#'
113113
#' @return A named list consisting of one or more of the following elements
114-
#' depending on the input parameters of the function: a named vector of the
115-
#' MAP estimates of the individual values of ETA, an RxODE model using the
116-
#' estimated ETAs, the Fisher information matrix, a named vector of RSEs
117-
#' of the MAP estimates of ETAs.
114+
#' depending on the input parameters of the function: `$eta` a named vector
115+
#' of the MAP estimates of the individual values of ETA, `$model` an RxODE
116+
#' model using the estimated ETAs, `$fim` the Fisher information matrix,
117+
#' `$rse` a named vector of RSEs of the MAP estimates of ETAs.
118118
#'
119119
#' @examples
120120
#' # df_patient01: event table for Patient01, following a 30 minutes intravenous
@@ -133,8 +133,8 @@ poso_simu_pop <- function(object=NULL,n_simul=1000,
133133
#' poso_estim_map(patient01_tobra)
134134
#'
135135
#' @export
136-
poso_estim_map <- function(object=NULL,return_model = TRUE,
137-
return_fim = FALSE,return_rse = FALSE)
136+
poso_estim_map <- function(object=NULL,return_model=TRUE,
137+
return_fim=FALSE,return_rse=FALSE)
138138
{
139139

140140
# Update model predictions with a new set of parameters, for all obs-----
@@ -196,7 +196,7 @@ poso_estim_map <- function(object=NULL,return_model = TRUE,
196196
if(return_rse){
197197
map_se <- sqrt(diag(solve(r$hessian))) #the inverse of the fim is the
198198
# variance-covariance matrix
199-
map_rse <- map_se/abs(eta_map)
199+
map_rse <- map_se/abs(eta_map[ind_eta])
200200
estim_map$rse <- map_rse
201201
}
202202

@@ -231,8 +231,9 @@ poso_estim_map <- function(object=NULL,return_model = TRUE,
231231
#' @param control A list of parameters controlling the Metropolis-Hastings
232232
#' algorithm.
233233
#'
234-
#' @return If `return_model` is set to `FALSE`, a dataframe of ETAs from
235-
#' the posterior distribution, estimated by Markov Chain Monte Carlo.
234+
#' @return If `return_model` is set to `FALSE`, , a list of one element: a
235+
#' dataframe `$eta` of ETAs from the posterior distribution, estimated by
236+
#' Markov Chain Monte Carlo.
236237
#' If `return_model` is set to `TRUE`, a list of the dataframe of the posterior
237238
#' distribution of ETA, and a RxODE model using the estimated distributions of ETAs.
238239
#'
@@ -259,7 +260,7 @@ poso_estim_map <- function(object=NULL,return_model = TRUE,
259260
#' poso_estim_mcmc(patient01_tobra,n_iter=100)
260261
#'
261262
#' @export
262-
poso_estim_mcmc <- function(object=NULL,return_model = TRUE,burn_in=50,
263+
poso_estim_mcmc <- function(object=NULL,return_model=TRUE,burn_in=50,
263264
n_iter=1000,control=list(n_kernel=c(2,2,2),
264265
stepsize_rw=0.4,proba_mcmc=0.3,nb_max=3)){
265266
# Update model predictions with a new set of parameters, for all obs-----
@@ -391,7 +392,7 @@ poso_estim_mcmc <- function(object=NULL,return_model = TRUE,burn_in=50,
391392
theta_return <- rbind(theta)
392393
covar <- dat[1,object$covariates]
393394
names(covar) <- object$covariates
394-
model_mcmc$params <- cbind(theta_return,eta_df_mcmc,covar,row.names = NULL)
395+
model_mcmc$params <- cbind(theta_return,eta_df_mcmc,covar,row.names=NULL)
395396
estim_mcmc$model <- model_mcmc
396397
}
397398

0 commit comments

Comments
 (0)