Title: | A Model Library for 'nlmixr2' |
---|---|
Description: | A model library for 'nlmixr2'. The models include (and plan to include) pharmacokinetic, pharmacodynamic, and disease models used in pharmacometrics. Where applicable, references for each model are included in the meta-data for each individual model. The package also includes model composition and modification functions to make model updates easier. |
Authors: | Richard Hooijmaijers [aut], Matthew Fidler [aut] , Bill Denney [aut, cre] |
Maintainer: | Bill Denney <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.3.0 |
Built: | 2024-12-07 06:31:27 UTC |
Source: | CRAN |
Add baseline that decays exponential with time
addBaseline1exp(ui, effect = "effect", eb = "Eb", time = "time", kb = "kb")
addBaseline1exp(ui, effect = "effect", eb = "Eb", time = "time", kb = "kb")
ui |
rxode2 model |
effect |
the effect variable that will be modeled |
eb |
baseline constant parameter |
time |
the time or other variable used for baseline decay |
kb |
the first order baseline decay constant |
model with baseline constant
Matthew L. Fidler
Other PD:
addBaselineConst()
,
addBaselineExp()
,
addBaselineLin()
,
addDirectLin()
,
convertEmax()
,
convertLogLin()
,
convertQuad()
readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertQuad() |> addBaseline1exp()
readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertQuad() |> addBaseline1exp()
Add an estimated baseline constant
addBaselineConst(ui, effect = "effect", eb = "Eb")
addBaselineConst(ui, effect = "effect", eb = "Eb")
ui |
rxode2 model |
effect |
the effect variable that will be modeled |
eb |
baseline constant parameter |
model with baseline constant
Matthew L. Fidler
Other PD:
addBaseline1exp()
,
addBaselineExp()
,
addBaselineLin()
,
addDirectLin()
,
convertEmax()
,
convertLogLin()
,
convertQuad()
readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertQuad() |> addBaselineConst()
readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertQuad() |> addBaselineConst()
Add baseline that decays exponential with time
addBaselineExp(ui, effect = "effect", eb = "Eb", time = "time", kb = "kb")
addBaselineExp(ui, effect = "effect", eb = "Eb", time = "time", kb = "kb")
ui |
rxode2 model |
effect |
the effect variable that will be modeled |
eb |
baseline constant parameter |
time |
the time or other variable used for baseline decay |
kb |
the first order baseline decay constant |
model with baseline constant
Matthew L. Fidler
Other PD:
addBaseline1exp()
,
addBaselineConst()
,
addBaselineLin()
,
addDirectLin()
,
convertEmax()
,
convertLogLin()
,
convertQuad()
readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertQuad() |> addBaselineExp()
readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertQuad() |> addBaselineExp()
Add an estimated baseline linear constant
addBaselineLin(ui, effect = "effect", eb = "Eb", time = "time")
addBaselineLin(ui, effect = "effect", eb = "Eb", time = "time")
ui |
rxode2 model |
effect |
the effect variable that will be modeled |
eb |
baseline constant parameter |
time |
the time or other variable used for baseline decay |
model with baseline linear constant
Matthew L. Fidler
Other PD:
addBaseline1exp()
,
addBaselineConst()
,
addBaselineExp()
,
addDirectLin()
,
convertEmax()
,
convertLogLin()
,
convertQuad()
readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertQuad() |> addBaselineLin()
readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertQuad() |> addBaselineLin()
Add a property to a compartment
addCmtProp(ui, prop = c("f", "lag", "dur", "rate", "ini"), cmt) addBioavailability(ui, cmt) addLag(ui, cmt) addDur(ui, cmt) addRate(ui, cmt) addIni(ui, cmt)
addCmtProp(ui, prop = c("f", "lag", "dur", "rate", "ini"), cmt) addBioavailability(ui, cmt) addLag(ui, cmt) addDur(ui, cmt) addRate(ui, cmt) addIni(ui, cmt)
ui |
rxode2 ui object |
prop |
property to add to a compartment: - - - - - |
cmt |
compartment to apply the property to |
rxode2 ui object with property applied
addBioavailability()
: Adds the bioavailability to a compartment in the model
addLag()
: Adds the lag-time to a compartment in the model
addDur()
: Adds the modeled duration to a compartment in the model
addRate()
: Adds the modeled rate to a compartment in the model
addIni()
: Adds the initial value to the compartment
Matthew L. Fidler
readModelDb("PK_3cmt_des") |> addCmtProp("f", "depot") readModelDb("PK_3cmt_des") |> addBioavailability(depot) readModelDb("PK_3cmt_des") |> addLag(depot) readModelDb("PK_3cmt_des") |> addDur(depot) readModelDb("PK_3cmt_des") |> addRate(depot) readModelDb("PK_3cmt_des") |> addIni(depot)
readModelDb("PK_3cmt_des") |> addCmtProp("f", "depot") readModelDb("PK_3cmt_des") |> addBioavailability(depot) readModelDb("PK_3cmt_des") |> addLag(depot) readModelDb("PK_3cmt_des") |> addDur(depot) readModelDb("PK_3cmt_des") |> addRate(depot) readModelDb("PK_3cmt_des") |> addIni(depot)
To convert from infusion/intravenous administration to first-order oral absorption
addDepot(ui, central = "central", depot = "depot", ka = "ka")
addDepot(ui, central = "central", depot = "depot", ka = "ka")
ui |
The model as a function (or something convertible to an rxUi object) |
central |
central compartment name |
depot |
depot compartment name |
ka |
absorption rate parameter name |
a model with the depot added
# most of the examples in the model library already have a depot # the PK_2cmt_no_depot is an exception readModelDb("PK_2cmt_no_depot") |> addDepot()
# most of the examples in the model library already have a depot # the PK_2cmt_no_depot is an exception readModelDb("PK_2cmt_no_depot") |> addDepot()
Add direct linear effect with baseline=0
addDirectLin(ui, ek = "Ek", cc = c("Ce", "Cc"), effect = "effect")
addDirectLin(ui, ek = "Ek", cc = c("Ce", "Cc"), effect = "effect")
ui |
rxode2 model |
ek |
simulation linear constant |
cc |
the concentration value |
effect |
the effect variable that will be modeled |
model with direct linear effect added (baseline=0)
Matthew L. Fidler
Other PD:
addBaseline1exp()
,
addBaselineConst()
,
addBaselineExp()
,
addBaselineLin()
,
convertEmax()
,
convertLogLin()
,
convertQuad()
# Direct linear model readModelDb("PK_2cmt_no_depot") |> addDirectLin() # Direct emax model readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertEmax()
# Direct linear model readModelDb("PK_2cmt_no_depot") |> addDirectLin() # Direct emax model readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertEmax()
Add a directory to the modeldb
addDirToModelDb(dir, modeldb = data.frame()) addFileToModelDb(dir, file, modeldb)
addDirToModelDb(dir, modeldb = data.frame()) addFileToModelDb(dir, file, modeldb)
dir |
Directory name containing model files |
modeldb |
The starting modeldb data.frame |
file |
The file name (without the directory name) |
The updated modeldb data.frame
the model database
addFileToModelDb()
: Add a file to the modeldb
Add effect compartment
addEffectCmtLin( ui, ke0 = "ke0", cc = "Cc", ce = "Ce", ek = "Ek", effect = "effect" )
addEffectCmtLin( ui, ke0 = "ke0", cc = "Cc", ce = "Ce", ek = "Ek", effect = "effect" )
ui |
rxode2 model |
ke0 |
This is the effect compartment keo rate |
cc |
the concentration value |
ce |
This is the concentration in the effect compartment |
ek |
simulation linear constant |
effect |
the effect variable that will be modeled |
a model with an effect compartment attached
Matthew L. Fidler
readModelDb("PK_2cmt_no_depot") |> addEffectCmtLin() # Can also be changed to the more typical Emax with constant (estimated) baselie readModelDb("PK_2cmt_no_depot") |> addEffectCmtLin() |> convertEmaxHill() |> addBaselineConst()
readModelDb("PK_2cmt_no_depot") |> addEffectCmtLin() # Can also be changed to the more typical Emax with constant (estimated) baselie readModelDb("PK_2cmt_no_depot") |> addEffectCmtLin() |> convertEmaxHill() |> addBaselineConst()
Add random effects to a model
addEta( ui, eta, priorName = getOption("nlmixr2lib.priorEta", TRUE), etaCombineType = c("default", "snake", "camel", "dot", "blank") )
addEta( ui, eta, priorName = getOption("nlmixr2lib.priorEta", TRUE), etaCombineType = c("default", "snake", "camel", "dot", "blank") )
ui |
The model as a function |
eta |
vector with the parameters to add random effects (sometimes referred to as inter-individual variability, IIV) on |
priorName |
logical, if TRUE, the parameter name specified in 'eta' will be used to add the eta value prior name is used instead of the left handed side of the equation. |
etaCombineType |
the option for the how to combine the eta with the parameter name. Can be: "default", "snake", "camel", "dot", "blank" |
The model with eta added to the requested parameters
Bill Denney, Richard Hooijmaijers & Matthew L. Fidler
library(rxode2) readModelDb("PK_1cmt") |> addEta("ka")
library(rxode2) readModelDb("PK_1cmt") |> addEta("ka")
Add an indirect response model to a PK model
addIndirect( ui, stim = c("in", "out"), inhib = c("in", "out"), hill = FALSE, ek = "Ek", ik = "Ik", emax = "Emax", ec50 = "EC50", imax = "Imax", ic50 = "IC50", kin = "kin", kout = "kout", g = "g", cc = "Cc", R = "R", effect = "effect" )
addIndirect( ui, stim = c("in", "out"), inhib = c("in", "out"), hill = FALSE, ek = "Ek", ik = "Ik", emax = "Emax", ec50 = "EC50", imax = "Imax", ic50 = "IC50", kin = "kin", kout = "kout", g = "g", cc = "Cc", R = "R", effect = "effect" )
ui |
rxode2 model |
stim |
what type of stimulation indirect response model: - 'in': stimulation of input - 'out': stimulation of output |
inhib |
what type of inhibition indirect response model: - 'in': inhibition of input - 'out': inhibition of output |
hill |
Boolean stating if a hill sigmoid coefficient will be added |
ek |
simulation linear constant |
ik |
inhibition linear constant |
emax |
Emax parameter |
ec50 |
EC50 parameter |
imax |
maximum inhibitory concentration |
ic50 |
concentration where half of the Imax occurs |
kin |
this is the kin parameter name |
kout |
this is the kout parameter name |
g |
hill coefficient |
cc |
the concentration value |
R |
drug response compartment |
effect |
the effect variable that will be modeled |
pk model with indirect response model added
Matthew L. Fidler
Other Indirect response:
addIndirectLin()
,
convertKinR0()
readModelDb("PK_2cmt_no_depot") |> addIndirect(stim="in",hill=TRUE) readModelDb("PK_2cmt_no_depot") |> addIndirect(inhib="out", imax=1)
readModelDb("PK_2cmt_no_depot") |> addIndirect(stim="in",hill=TRUE) readModelDb("PK_2cmt_no_depot") |> addIndirect(inhib="out", imax=1)
Add linear indirect response model
addIndirectLin( ui, stim = c("in", "out"), inhib = c("in", "out"), ek = "Ek", ik = "Ik", kin = "kin", kout = "kout", cc = "Cc", R = "R", effect = "effect" )
addIndirectLin( ui, stim = c("in", "out"), inhib = c("in", "out"), ek = "Ek", ik = "Ik", kin = "kin", kout = "kout", cc = "Cc", R = "R", effect = "effect" )
ui |
rxode2 model |
stim |
what type of stimulation indirect response model: - 'in': stimulation of input - 'out': stimulation of output |
inhib |
what type of inhibition indirect response model: - 'in': inhibition of input - 'out': inhibition of output |
ek |
simulation linear constant |
ik |
inhibition linear constant |
kin |
this is the kin parameter name |
kout |
this is the kout parameter name |
cc |
the concentration value |
R |
drug response compartment |
effect |
the effect variable that will be modeled |
model with linear indirect effect added
Note that while linear indirect effects are not common, it allows an easier hook to produce other standard effect curves like Emax/Imax, Hill, etc.
Matthew L. Fidler
Other Indirect response:
addIndirect()
,
convertKinR0()
readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="in") readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="out") readModelDb("PK_2cmt_no_depot") |> addIndirectLin(inhib="in") readModelDb("PK_2cmt_no_depot") |> addIndirectLin(inhib="out")
readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="in") readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="out") readModelDb("PK_2cmt_no_depot") |> addIndirectLin(inhib="in") readModelDb("PK_2cmt_no_depot") |> addIndirectLin(inhib="out")
Add log estimates to a model
addLogEstimates(ui, vars, extraLines = NULL, beforeCmt = NULL)
addLogEstimates(ui, vars, extraLines = NULL, beforeCmt = NULL)
ui |
rxode2 model |
vars |
estimates to add they will be parameterized as:
where |
extraLines |
this is a list of additional lines to add to the
model just after the variables are defined. It must be
|
beforeCmt |
if the model is compartmental you can specify the preferred names where the estimates and extra lines are added before |
rxode2 model with log estimates added (and possibly extra lines)
Matthew L. Fidler
# Change the transformation of the PK model from cl to k readModelDb("PK_3cmt_des") |> removeLinesAndInis(c("kel", "k12", "k21", "k13", "k31", "vc")) |> addLogEstimates(c("kel", "k12", "k21", "k13", "k31", "vc")) # You can also label the parameters by using a named character # vector with the names of the parameters representing the # variables and the values representing the labels: readModelDb("PK_3cmt_des") |> removeLinesAndInis(c("kel", "k12", "k21", "k13", "k31", "vc")) |> addLogEstimates(c(kel="elimination", k12="k12 constant", k21="k21 constant", k13="k13 constant", k31="k31 constant", vc="volume of central compartment"))
# Change the transformation of the PK model from cl to k readModelDb("PK_3cmt_des") |> removeLinesAndInis(c("kel", "k12", "k21", "k13", "k31", "vc")) |> addLogEstimates(c("kel", "k12", "k21", "k13", "k31", "vc")) # You can also label the parameters by using a named character # vector with the names of the parameters representing the # variables and the values representing the labels: readModelDb("PK_3cmt_des") |> removeLinesAndInis(c("kel", "k12", "k21", "k13", "k31", "vc")) |> addLogEstimates(c(kel="elimination", k12="k12 constant", k21="k21 constant", k13="k13 constant", k31="k31 constant", vc="volume of central compartment"))
Add residual error to a model
addResErr(ui, reserr, endpoint)
addResErr(ui, reserr, endpoint)
ui |
The model as a function |
reserr |
The type or types of residual error (currently
|
endpoint |
the endpoint to apply the error; will default to the first error in the model |
For reserr
, the parameter will be named with the dependent
variable from the model as a prefix. For example, if the dependent
variable in the model is Cc
, the parameter name for propSd
will become CcpropSd
.
The model with residual error modified
library(rxode2) readModelDb("PK_1cmt") |> addResErr("addSd") readModelDb("PK_1cmt") |> addResErr("lnormSd") readModelDb("PK_1cmt") |> addResErr(c("addSd", "propSd"))
library(rxode2) readModelDb("PK_1cmt") |> addResErr("addSd") readModelDb("PK_1cmt") |> addResErr("lnormSd") readModelDb("PK_1cmt") |> addResErr(c("addSd", "propSd"))
To add transit compartments to the model
addTransit( ui, ntransit, central = "central", depot = "depot", transit = "transit", ktr = "ktr", ka = "ka" )
addTransit( ui, ntransit, central = "central", depot = "depot", transit = "transit", ktr = "ktr", ka = "ka" )
ui |
The model as a function |
ntransit |
the number of transit compartments to be added |
central |
central compartment name |
depot |
depot compartment name |
transit |
the transit compartment prefix |
ktr |
the parameter name for the transit compartment rate |
ka |
absorption rate parameter name |
a model with transit compartment added
This matches
'dose->a0->a1->abs cmt->central'
But 'a0' is depot so dosing records labeled depot do not need to be changed
The abs cmt becomes the last "transit" compartment
This is simply for convenience
Other absorption:
addWeibullAbs()
,
removeTransit()
readModelDb("PK_1cmt_des") |> addTransit(3)
readModelDb("PK_1cmt_des") |> addTransit(3)
Converts first order absorption model to Weibull absorption model
addWeibullAbs( ui, ntransit, central = "central", depot = "depot", transit = "transit", wa = "wa", wb = "wb", ka = "ka", ktr = "ktr" )
addWeibullAbs( ui, ntransit, central = "central", depot = "depot", transit = "transit", wa = "wa", wb = "wb", ka = "ka", ktr = "ktr" )
ui |
The model as a function |
ntransit |
the number of transit compartments to be added |
central |
central compartment name |
depot |
depot compartment name |
transit |
the transit compartment prefix |
wa |
Weibull alpha parameter name |
wb |
Weibull beta parameter name |
ka |
absorption rate parameter name |
ktr |
the parameter name for the transit compartment rate |
model where first order absorption is changed to Weibull absorption model
Matthew L. Fidler
Other absorption:
addTransit()
,
removeTransit()
readModelDb("PK_1cmt_des") |> addWeibullAbs()
readModelDb("PK_1cmt_des") |> addWeibullAbs()
Combine two in a manner similar to 'paste()' strings using the default combine type
combinePaste2( a, b, combineType = c("default", "snake", "camel", "dot", "blank") )
combinePaste2( a, b, combineType = c("default", "snake", "camel", "dot", "blank") )
a |
first string to combine |
b |
second string to combine |
combineType |
is the type of combination; can be: - - - - - |
Combined strings separated with 'defaultCombine()'
Matthew L. Fidler
combinePaste2("f", "depot") combinePaste2("f", "depot", "snake") combinePaste2("f", "depot", "dot") combinePaste2("f", "depot", "blank")
combinePaste2("f", "depot") combinePaste2("f", "depot", "snake") combinePaste2("f", "depot", "dot") combinePaste2("f", "depot", "blank")
Convert linear effect to Emax effect
convertEmax( ui, emax = "Emax", ec50 = "EC50", imax = "Imax", ic50 = "IC50", ek = c("Ik", "Ek"), cc = c("Ec", "Cc") )
convertEmax( ui, emax = "Emax", ec50 = "EC50", imax = "Imax", ic50 = "IC50", ek = c("Ik", "Ek"), cc = c("Ec", "Cc") )
ui |
rxode2 model |
emax |
Emax parameter |
ec50 |
EC50 parameter |
imax |
Imax parameter used when input model contains "Ik" instead of "Ek" |
ic50 |
IC50 parameter used when input model contains "Ik" instead of "Ek" |
ek |
simulation linear constant |
cc |
the concentration value |
Model with the linear effect converted to an Emax effect
Matthew L. Fidler
Other PD:
addBaseline1exp()
,
addBaselineConst()
,
addBaselineExp()
,
addBaselineLin()
,
addDirectLin()
,
convertLogLin()
,
convertQuad()
readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="in") |> convertEmax() # When emax=1 readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="in") |> convertEmax(emax=1)
readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="in") |> convertEmax() # When emax=1 readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="in") |> convertEmax(emax=1)
Convert linear effect to Emax-Hill effect
convertEmaxHill( ui, emax = "Emax", ec50 = "EC50", g = "g", imax = "Imax", ic50 = "IC50", ek = c("Ik", "Ek"), cc = c("Ec", "Cc") )
convertEmaxHill( ui, emax = "Emax", ec50 = "EC50", g = "g", imax = "Imax", ic50 = "IC50", ek = c("Ik", "Ek"), cc = c("Ec", "Cc") )
ui |
rxode2 model |
emax |
Emax parameter |
ec50 |
EC50 parameter |
g |
hill coefficient |
imax |
Imax parameter used when input model contains "Ik" instead of "Ek" |
ic50 |
IC50 parameter used when input model contains "Ik" instead of "Ek" |
ek |
simulation linear constant |
cc |
the concentration value |
Model with the linear effect converted to an Emax effect
Matthew L. Fidler
readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="in") |> convertEmaxHill() # can also specify as emax=1 readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="in") |> convertEmaxHill(emax=1)
readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="in") |> convertEmaxHill() # can also specify as emax=1 readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="in") |> convertEmaxHill(emax=1)
This replaces the kin/kout parameterization to the R0 and kout parameterization
convertKinR0(ui, kin = "kin", kout = "kout", R = "R", R0 = "R0")
convertKinR0(ui, kin = "kin", kout = "kout", R = "R", R0 = "R0")
ui |
a rxode2 user function |
kin |
the kin variable (by default is "kin") |
kout |
the kout variable (by default is "kout") |
R |
the compartment variable (by default is "R") |
R0 |
the R0 variable (by default is "R0") |
a model where the estimated kin is changed to the estimated R0
Matthew L. Fidler
Other Indirect response:
addIndirect()
,
addIndirectLin()
addIndirect(stim="in") |> convertKinR0()
addIndirect(stim="in") |> convertKinR0()
Converts a linear effect to a log-linear effect
convertLogLin(ui, ek = c("Ik", "Ek"), cc = c("Ce", "Cc"))
convertLogLin(ui, ek = c("Ik", "Ek"), cc = c("Ce", "Cc"))
ui |
rxode2 model |
ek |
simulation linear constant |
cc |
the concentration value |
model converted from linear to log-linear effect
Matthew L. Fidler
Other PD:
addBaseline1exp()
,
addBaselineConst()
,
addBaselineExp()
,
addBaselineLin()
,
addDirectLin()
,
convertEmax()
,
convertQuad()
readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertLogLin() readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="out") |> convertLogLin()
readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertLogLin() readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="out") |> convertLogLin()
Convert models from linear elimination to Michaelis-Menten elimination
convertMM( ui, central = "central", elimination = "kel", vm = "vm", km = "km", vc = "vc" )
convertMM( ui, central = "central", elimination = "kel", vm = "vm", km = "km", vc = "vc" )
ui |
model to convert |
central |
the central compartment where the elimination is present |
elimination |
variable for the elimination constant in the model |
vm |
variable name for Vmax in the model |
km |
variable name for Km in the model |
vc |
variable name for Vc in the model |
new model changing linear elimination to Michaelis-Menten elimination
Matthew L. Fidler
readModelDb("PK_1cmt_des") |> convertMM() readModelDb("PK_2cmt_des") |> convertMM() readModelDb("PK_3cmt_des") |> convertMM() readModelDb("PK_3cmt_des") |> removeDepot() |> convertMM()
readModelDb("PK_1cmt_des") |> convertMM() readModelDb("PK_2cmt_des") |> convertMM() readModelDb("PK_3cmt_des") |> convertMM() readModelDb("PK_3cmt_des") |> removeDepot() |> convertMM()
Convert linear elimination to quadratic elimination
convertQuad(ui, ek = c("Ik", "Ek"), cc = c("Ce", "Cc"), ek2 = "Ek2")
convertQuad(ui, ek = c("Ik", "Ek"), cc = c("Ce", "Cc"), ek2 = "Ek2")
ui |
rxode2 model |
ek |
simulation linear constant |
cc |
the concentration value |
ek2 |
quadratic coefficient |
model with linear effect converted to quadratic effect
Matthew L. Fidler
Other PD:
addBaseline1exp()
,
addBaselineConst()
,
addBaselineExp()
,
addBaselineLin()
,
addDirectLin()
,
convertEmax()
,
convertLogLin()
readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="out") |> convertQuad() readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertQuad() readModelDb("PK_2cmt_no_depot") |> addEffectCmtLin() |> convertQuad()
readModelDb("PK_2cmt_no_depot") |> addIndirectLin(stim="out") |> convertQuad() readModelDb("PK_2cmt_no_depot") |> addDirectLin() |> convertQuad() readModelDb("PK_2cmt_no_depot") |> addEffectCmtLin() |> convertQuad()
Default combine strings
defaultCombine(...) snakeCombine(...) camelCombine(...) dotCombine(...) blankCombine(...)
defaultCombine(...) snakeCombine(...) camelCombine(...) dotCombine(...) blankCombine(...)
... |
uses default to combine strings |
combined strings
snakeCombine()
: use snake_case to combine 2 strings
camelCombine()
: use camelCase to combine strings
dotCombine()
: use the default method for combining two strings
blankCombine()
: combine using a blank separator
Matthew L. Fidler
# default combine defaultCombine("f", "depot") defaultCombine(list(c("a", "funny", "c"))) defaultCombine(c("a", "funny", "c")) # snake combine snakeCombine("f", "depot") snakeCombine(list(c("a", "funny", "c"))) snakeCombine(c("a", "funny", "c")) # dot combine dotCombine("f", "depot") dotCombine(list(c("a", "funny", "c"))) dotCombine(c("a", "funny", "c")) # blank combine blankCombine("f", "depot") blankCombine(list(c("a", "funny", "c"))) blankCombine(c("a", "funny", "c"))
# default combine defaultCombine("f", "depot") defaultCombine(list(c("a", "funny", "c"))) defaultCombine(c("a", "funny", "c")) # snake combine snakeCombine("f", "depot") snakeCombine(list(c("a", "funny", "c"))) snakeCombine(c("a", "funny", "c")) # dot combine dotCombine("f", "depot") dotCombine(list(c("a", "funny", "c"))) dotCombine(c("a", "funny", "c")) # blank combine blankCombine("f", "depot") blankCombine(list(c("a", "funny", "c"))) blankCombine(c("a", "funny", "c"))
Fake blank Cc for creating PD only models
fakeCc(fun, ..., cc = "Cc")
fakeCc(fun, ..., cc = "Cc")
fun |
function to that requires Cc |
... |
arguments sent PD function |
cc |
character name of the concentration in the central compartment that will be faked to allow models that require Cc to change to models with Cc as a covariate |
Model where Cc is a covariate
Matthew L. Fidler
fakeCc(addDirectLin) |> convertEmaxHill()
fakeCc(addDirectLin) |> convertEmaxHill()
This is a data frame of the available models in nlmixr2lib, it is generated with the package. Custom modeldb may be used.
modeldb
modeldb
A data frame with 52 rows and 9 columns
Model name that can be used to extract the model from the model library
Model description in free from text; in model itself
A comma separated string listing either the parameter in the model defined by population/individual effects or a population effect parameter
The definition of the dependent variable(s)
Logical flag indicating if solved models are used (TRUE) or not (FALSE)
Logical flag indicating if the model is purely algebraic: TRUE no linCmt() and no ODEs; FALSE otherwise
A comma separated string of identified dosing compartments
A comma separated string of objects the model depends on
Filename of the model. By default these are installed in the model library and read on demand
This function gets a model from the available model library
modellib(name = NULL, eta = NULL, reserr = NULL)
modellib(name = NULL, eta = NULL, reserr = NULL)
name |
character with the name of the model to load (if |
eta |
vector with the parameters to add random effects (sometimes referred to as inter-individual variability, IIV) on |
reserr |
The type or types of residual error (currently
|
This is a very first draft just to look at the proof of concept
The function returns a function the model code (or NULL
if the
model = NULL
)
modellib(name = "PK_1cmt") modellib(name = "PK_1cmt", eta = c("ka", "vc"), reserr = "addSd") modellib(name = "PK_1cmt", reserr = "addSd")
modellib(name = "PK_1cmt") modellib(name = "PK_1cmt", eta = c("ka", "vc"), reserr = "addSd") modellib(name = "PK_1cmt", reserr = "addSd")
Change the transformation type for PK models
pkTrans( ui, type = c("k", "k21", "vss", "aob", "alpha"), k13 = "k13", k31 = "k31", k12 = "k12", k21 = "k21", kel = "kel", vc = "vc", cl = "cl", vp = "vp", q = "q", vp2 = "vp2", q2 = "q2", vss = "vss", aob = "aob", alpha = "alpha", beta = "beta", gam = "gam", A = "A", B = "B", C = "C", s = "s", p = "p", tmp = "tmp", beforeCmt = c("depot", "central") )
pkTrans( ui, type = c("k", "k21", "vss", "aob", "alpha"), k13 = "k13", k31 = "k31", k12 = "k12", k21 = "k21", kel = "kel", vc = "vc", cl = "cl", vp = "vp", q = "q", vp2 = "vp2", q2 = "q2", vss = "vss", aob = "aob", alpha = "alpha", beta = "beta", gam = "gam", A = "A", B = "B", C = "C", s = "s", p = "p", tmp = "tmp", beforeCmt = c("depot", "central") )
ui |
A model in terms of Clearance |
type |
the type of PK transformation to make: - - - - - |
k13 |
name of rate constant from central to periph2 |
k31 |
name of rate constant from periph2 to central |
k12 |
name of rate constant from central to periph1 |
k21 |
name of rate constant from periph1 to central |
kel |
name of elimination rate constant |
vc |
name of central compartment volume |
cl |
name of clearance |
vp |
name of volume of periph1 |
q |
name of intercompartmental clearance between central and periph1 |
vp2 |
name of volume of periph2 |
q2 |
name of intercompartmental clearance between central and periph2 |
vss |
name of volume of distribution at steady state |
aob |
A/B ratio |
alpha |
macro constant name for first exponential decay term |
beta |
macro constant name for second exponential decay term |
gam |
macro constant name for third exponential decay term |
A |
macro coefficient for the first exponential decay term (corresponds with alpha) |
B |
macro coefficient for the second exponential decay term (corresponds with beta) |
C |
macro coefficient for the third exponential decay term (corresponds with gam) |
s |
sum constant name for the k12 three compartment |
p |
product constant name for the k12 three compartment |
tmp |
name of temporary variable for the three compartment with 'A', 'B', 'C', 'alpha', 'beta' and 'gam'. |
beforeCmt |
if the model is compartmental you can specify the preferred names where the estimates and extra lines are added before |
ui with no PK parameters estimated
Matthew L. Fidler
# Three compartment model translations readModelDb("PK_3cmt_des") |> pkTrans("k") readModelDb("PK_3cmt_des") |> pkTrans("k21") readModelDb("PK_3cmt_des") |> pkTrans("alpha") # The most types of transformations are # available for 2 compartment models readModelDb("PK_2cmt_des") |> pkTrans("k") readModelDb("PK_2cmt_des") |> pkTrans("vss") readModelDb("PK_2cmt_des") |> pkTrans("aob") readModelDb("PK_2cmt_des") |> pkTrans("k21") readModelDb("PK_2cmt_des") |> pkTrans("alpha") # One compartment transformations are also available: readModelDb("PK_1cmt_des") |> pkTrans("k") readModelDb("PK_1cmt_des") |> pkTrans("alpha") # also works without depot: readModelDb("PK_3cmt_des") |> removeDepot() |> pkTrans("k")
# Three compartment model translations readModelDb("PK_3cmt_des") |> pkTrans("k") readModelDb("PK_3cmt_des") |> pkTrans("k21") readModelDb("PK_3cmt_des") |> pkTrans("alpha") # The most types of transformations are # available for 2 compartment models readModelDb("PK_2cmt_des") |> pkTrans("k") readModelDb("PK_2cmt_des") |> pkTrans("vss") readModelDb("PK_2cmt_des") |> pkTrans("aob") readModelDb("PK_2cmt_des") |> pkTrans("k21") readModelDb("PK_2cmt_des") |> pkTrans("alpha") # One compartment transformations are also available: readModelDb("PK_1cmt_des") |> pkTrans("k") readModelDb("PK_1cmt_des") |> pkTrans("alpha") # also works without depot: readModelDb("PK_3cmt_des") |> removeDepot() |> pkTrans("k")
Read a model from the nlmixr2 model database
readModelDb(name)
readModelDb(name)
name |
The name of the model (must be one of |
The model as a function
readModelDb("PK_1cmt")
readModelDb("PK_1cmt")
To convert from first order oral absorption to IV/Intravenous
removeDepot(ui, central = "central", depot = "depot", ka = "ka")
removeDepot(ui, central = "central", depot = "depot", ka = "ka")
ui |
The model as a function (or something convertible to an rxUi object) |
central |
central compartment name |
depot |
depot compartment name |
ka |
absorption rate parameter name |
Returns a model with the depot from a first order absorption model removed
readModelDb("PK_1cmt_des") |> removeDepot()
readModelDb("PK_1cmt_des") |> removeDepot()
Removes lines and inis from a model
removeLinesAndInis(ui, vars)
removeLinesAndInis(ui, vars)
ui |
A rxode2 model |
vars |
A character vector of variables to remove |
model with rxode2 lines and any estimates associate with lines removed
Matthew L. Fidler
readModelDb("PK_3cmt_des") |> removeLinesAndInis(c("kel", "k12", "k21"))
readModelDb("PK_3cmt_des") |> removeLinesAndInis(c("kel", "k12", "k21"))
To remove transit compartments from the model
removeTransit( ui, ntransit, central = "central", depot = "depot", transit = "transit", ktr = "ktr", ka = "ka" )
removeTransit( ui, ntransit, central = "central", depot = "depot", transit = "transit", ktr = "ktr", ka = "ka" )
ui |
The model as a function |
ntransit |
the number of transit compartments to be added |
central |
central compartment name |
depot |
depot compartment name |
transit |
The number of transit compartments to remove |
ktr |
the parameter name for the transit compartment rate |
ka |
absorption rate parameter name |
rxode2 model with transit compartment removed
Other absorption:
addTransit()
,
addWeibullAbs()
# In this example the transit is added and then a few are removed readModelDb("PK_1cmt_des") |> addTransit(4) |> removeTransit(3) readModelDb("PK_1cmt_des") |> addTransit(4) |> removeTransit()
# In this example the transit is added and then a few are removed readModelDb("PK_1cmt_des") |> addTransit(4) |> removeTransit(3) readModelDb("PK_1cmt_des") |> addTransit(4) |> removeTransit()
Search within a model to replace part of the model
searchReplace(object, find, replace) searchReplaceHelper(object, find, replace)
searchReplace(object, find, replace) searchReplaceHelper(object, find, replace)
object |
function specifying the nlmixr2 model |
find , replace
|
Character scalars of parts of the model to replace |
object
with find
replaced with replace
searchReplaceHelper()
: A helper function for searchReplace (not intended
for users to use directly)
Change the default combine type for the package
setCombineType(combineType = c("snake", "camel", "dot", "blank"))
setCombineType(combineType = c("snake", "camel", "dot", "blank"))
combineType |
this is the default combine type:
- |
Matthew L. Fidler
# Change to the popular snake_case setCombineType("snake") defaultCombine("a", "b") # Change back to nlmixr2/rxode2 default camelCase setCombineType("camel") defaultCombine("a", "b") # This is used to change the naming convention for parameters # produced by this package
# Change to the popular snake_case setCombineType("snake") defaultCombine("a", "b") # Change back to nlmixr2/rxode2 default camelCase setCombineType("camel") defaultCombine("a", "b") # This is used to change the naming convention for parameters # produced by this package
Update an oncology xenograft model based on Simeoni 2004
updateOncologyXenograftSimeoni2004( object, ncmt, damagedCmtName = "damagedCells", drugEffectName = "drugEffectCyclingCells", undamagedCmtName = "cyclingCells", tumorVolName = "tumorVol", transitRateName = "damageTransit" )
updateOncologyXenograftSimeoni2004( object, ncmt, damagedCmtName = "damagedCells", drugEffectName = "drugEffectCyclingCells", undamagedCmtName = "cyclingCells", tumorVolName = "tumorVol", transitRateName = "damageTransit" )
object |
Fitted object or function specifying the model. |
ncmt |
The desired number of damaged cell compartments |
damagedCmtName , undamagedCmtName , tumorVolName
|
character string names for the compartments for damaged cells, undamaged cells, and the calculated tumor volume (the sum of undamaged and damaged cells) |
drugEffectName , transitRateName
|
character string names of the drug effect and transit rate (as used in the model block) |
An updated model with the new number of compartments
library(rxode2) readModelDb("oncology_xenograft_simeoni_2004") %>% updateOncologyXenograftSimeoni2004(ncmt = 5)
library(rxode2) readModelDb("oncology_xenograft_simeoni_2004") %>% updateOncologyXenograftSimeoni2004(ncmt = 5)