Estimates the Maximum A Posteriori (MAP) individual parameters, also known as Empirical Bayes Estimates (EBE).
Usage
poso_estim_map(
dat = NULL,
prior_model = NULL,
return_model = TRUE,
return_ofv = FALSE,
nocb = FALSE
)
Arguments
- dat
Dataframe. An individual subject dataset following the structure of NONMEM/rxode2 event records.
- prior_model
A
posologyr
prior population pharmacokinetics model, a list of six objects.- return_model
A boolean. Returns a rxode2 model using the estimated ETAs if set to
TRUE
.- return_ofv
A boolean. Returns a the Objective Function Value (OFV) if set to
TRUE
.- nocb
A boolean. for time-varying covariates: the next observation carried backward (nocb) interpolation style, similar to NONMEM. If
FALSE
, the last observation carried forward (locf) style will be used. Defaults toFALSE
.
Value
A named list consisting of one or more of the following elements
depending on the input parameters of the function: $eta
a named vector
of the MAP estimates of the individual values of ETA, $model
an rxode2
model using the estimated ETAs, $event
the data.table
used to solve the
returned rxode2 model.
Examples
rxode2::setRxThreads(1) # limit the number of threads
# model
mod_run001 <- function() {
ini({
THETA_Cl <- 4.0
THETA_Vc <- 70.0
THETA_Ka <- 1.0
ETA_Cl ~ 0.2
ETA_Vc ~ 0.2
ETA_Ka ~ 0.2
prop.sd <- sqrt(0.05)
})
model({
TVCl <- THETA_Cl
TVVc <- THETA_Vc
TVKa <- THETA_Ka
Cl <- TVCl*exp(ETA_Cl)
Vc <- TVVc*exp(ETA_Vc)
Ka <- TVKa*exp(ETA_Ka)
K20 <- Cl/Vc
Cc <- centr/Vc
d/dt(depot) = -Ka*depot
d/dt(centr) = Ka*depot - K20*centr
Cc ~ prop(prop.sd)
})
}
# df_patient01: event table for Patient01, following a 30 minutes intravenous
# infusion
df_patient01 <- data.frame(ID=1,
TIME=c(0.0,1.0,14.0),
DV=c(NA,25.0,5.5),
AMT=c(2000,0,0),
EVID=c(1,0,0),
DUR=c(0.5,NA,NA))
# estimate the Maximum A Posteriori individual parameters
poso_estim_map(dat=df_patient01,prior_model=mod_run001)
#>
#>
#>
#>
#> $eta
#> ETA_Cl ETA_Vc ETA_Ka
#> 0.6019038 -0.4291730 0.1278482
#>
#> $model
#> ── Solved rxode2 object ──
#> ── Parameters ($params): ──
#> THETA_Cl THETA_Vc THETA_Ka prop.sd ETA_Cl ETA_Vc ETA_Ka
#> 4.0000000 70.0000000 1.0000000 0.2236068 0.6019038 -0.4291730 0.1278482
#> ── Initial Conditions ($inits): ──
#> depot centr AUC
#> 0 0 0
#> ── First part of data (object): ──
#> # A tibble: 151 × 13
#> time TVCl TVVc TVKa Cl Vc Ka K20 rxCc Cc depot centr
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 0 4 70 1 7.30 45.6 1.14 0.160 0 0 0 0
#> 2 0.1 4 70 1 7.30 45.6 1.14 0.160 0.478 0.478 378. 21.8
#> 3 0.2 4 70 1 7.30 45.6 1.14 0.160 1.83 1.83 716. 83.5
#> 4 0.3 4 70 1 7.30 45.6 1.14 0.160 3.95 3.95 1017. 180.
#> 5 0.4 4 70 1 7.30 45.6 1.14 0.160 6.75 6.75 1286. 307.
#> 6 0.5 4 70 1 7.30 45.6 1.14 0.160 10.1 10.1 1526. 461.
#> # ℹ 145 more rows
#> # ℹ 1 more variable: AUC <dbl>
#>
#> $event
#> id time amt evid dur
#> <int> <num> <num> <int> <num>
#> 1: 1 0.0 NA 0 NA
#> 2: 1 0.0 2000 1 0.5
#> 3: 1 0.1 NA 0 NA
#> 4: 1 0.2 NA 0 NA
#> 5: 1 0.3 NA 0 NA
#> ---
#> 148: 1 14.6 NA 0 NA
#> 149: 1 14.7 NA 0 NA
#> 150: 1 14.8 NA 0 NA
#> 151: 1 14.9 NA 0 NA
#> 152: 1 15.0 NA 0 NA
#>