poso_estim_map {posologyr}R Documentation

Estimate the Maximum A Posteriori individual parameters

Description

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 to FALSE.

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 <- list(
ppk_model = rxode2::rxode({
  centr(0) = 0;
  depot(0) = 0;

  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;
  d/dt(AUC) = Cc;
}),
error_model = function(f,sigma) {
  dv <- cbind(f,1)
  g <- diag(dv%*%sigma%*%t(dv))
  return(sqrt(g))
},
theta = c(THETA_Cl=4.0, THETA_Vc=70.0, THETA_Ka=1.0),
omega = lotri::lotri({ETA_Cl + ETA_Vc + ETA_Ka ~
    c(0.2,
      0, 0.2,
      0, 0, 0.2)}),
sigma = lotri::lotri({prop + add ~ c(0.05,0.0,0.00)}))
# 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)


[Package posologyr version 1.2.4 Index]