Title: | Pharmacometric Modeling |
---|---|
Description: | Facilitate Pharmacokinetic (PK) and Pharmacodynamic (PD) modeling and simulation with powerful tools for Nonlinear Mixed-Effects (NLME) modeling. The package provides access to the same advanced Maximum Likelihood algorithms used by the NLME-Engine in the Phoenix platform. These tools support a range of analyses, from parametric methods to individual and pooled data analysis <https://www.certara.com/app/uploads/2020/06/BR_PhoenixNLME-v4.pdf>. Execution is supported both locally or on remote machines. |
Authors: | James Craig [aut, cre], Michael Tomashevskiy [aut], Vitalii Nazarov [aut], Shuhua Hu [ctb], Soltanshahi Fred [aut], Certara USA, Inc. [cph, fnd] |
Maintainer: | James Craig <[email protected]> |
License: | LGPL-3 |
Version: | 3.0.1 |
Built: | 2024-11-21 07:04:20 UTC |
Source: | CRAN |
Specify ADDL column definition in model object instead of specifying ADDL through addDoseCycle
addADDL(.Object, ADDL, II)
addADDL(.Object, ADDL, II)
.Object |
Model object |
ADDL |
Column mapping argument specifying corresponding "ADDL" column in input data set |
II |
Column mapping argument specifying corresponding "II" column in input data set |
Modified NlmePmlModel
object
model <- addADDL(model, ADDL = "addl", II = "ii")
model <- addADDL(model, ADDL = "addl", II = "ii")
Add a continuous, categorical, or occasion covariate to model object and set covariate effect on structural parameters.
addCovariate( .Object, covariate, effect = NULL, type = c("Continuous", "Categorical", "Occasion"), direction = c("Forward", "Interpolate", "Backward"), option = c("Yes", "PlusOne", "No"), center = NULL, centerValue = NULL, levels = NULL, labels = NULL, isDiagonal = TRUE, values = NULL, isPositive = TRUE )
addCovariate( .Object, covariate, effect = NULL, type = c("Continuous", "Categorical", "Occasion"), direction = c("Forward", "Interpolate", "Backward"), option = c("Yes", "PlusOne", "No"), center = NULL, centerValue = NULL, levels = NULL, labels = NULL, isDiagonal = TRUE, values = NULL, isPositive = TRUE )
.Object |
Model object |
covariate |
Name of covariate. If the involved model has columns
mapped (i.e. model with |
effect |
Name of structural parameter(s) on which the covariate
has an effect. Specify |
type |
Type of covariate. Options are |
direction |
Direction of missing values propagation (if no covariate
value is given). Options are |
option |
Options are |
center |
Centering method. Options are |
centerValue |
Value used to center covariate. Only applicable if
argument |
levels |
Unique values of categorical or occasion covariate. Only
applicable to covariate |
labels |
Label names (in the same order as levels) for unique levels of
categorical or occasion covariate in data. Only applicable to covariate
|
isDiagonal |
Set to |
values |
Initial values for the diagonal elements of the inter-occasion
covariance matrix (if |
isPositive |
Set to |
The following relationships are applicable for covariates:
direction = "Forward"
is equivalent to PML code 'fcovariate(CovName)';
direction = "Backward"
is equivalent to PML code 'covariate(CovName)';
direction = "Interpolate"
is equivalent to PML code 'interpolate(CovName)'.
If the structural parameter has style = "LogNormal"
, the options are
reflected in PML code as follows:
option = "Yes"
is equivalent to
stparm(V = tvV * wt^dVdwt * exp(dVdsex1*(sex==1)) * exp(nV))
;
option = "PlusOne
is equivalent to
stparm(V = tvV * (1+wt*dVdwt) * (1+dVdsex1*(sex==1)) * exp(nV))
.
Modified NlmePmlModel
object
model <- pkmodel( numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc" ) # Add Gender covariate of type categorical model <- addCovariate(model, covariate = "Gender", type = "Categorical", effect = c("V2", "Cl2"), levels = c(0, 1), labels = c("Female", "Male") ) # Add BodyWeight covariate of type continuous model <- addCovariate(model, covariate = "BodyWeight", type = "Continuous", direction = "Backward", center = "Mean", effect = c("V", "Cl") )
model <- pkmodel( numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc" ) # Add Gender covariate of type categorical model <- addCovariate(model, covariate = "Gender", type = "Categorical", effect = c("V2", "Cl2"), levels = c(0, 1), labels = c("Female", "Male") ) # Add BodyWeight covariate of type continuous model <- addCovariate(model, covariate = "BodyWeight", type = "Continuous", direction = "Backward", center = "Mean", effect = c("V", "Cl") )
Add Steady State or ADDL dosing cycle to model object.
addDoseCycle( .Object, type = "SteadyState", name, administration = "Bolus", amount = NULL, II = NULL, rate = NULL, duration = NULL, isSecondDose = FALSE, colName = NULL )
addDoseCycle( .Object, type = "SteadyState", name, administration = "Bolus", amount = NULL, II = NULL, rate = NULL, duration = NULL, isSecondDose = FALSE, colName = NULL )
.Object |
Model object |
type |
Specification of dose type. Options are |
name |
Dose point name. See |
administration |
Mechanism for administering dose. Options are |
amount |
Optional. Column mapping argument specifying corresponding "ADDL" column in input data, or numeric value specifiying dose amount. |
II |
Optional. Column mapping argument specifying corresponding "II" column in input data, or numeric value specifying delta time. |
rate |
Optional. Column mapping argument specifying corresponding "Rate" column in input data, or numeric specifying dose rate. |
duration |
Optional. Column mapping argument specifying corresponding "Duration" column in data, or numeric specifying duration value. |
isSecondDose |
Use second dose point on compartment |
colName |
Column name in input data corresponding to column mapping for "SteadyState" or "ADDL" as supplied in |
Modified NlmePmlModel
object
model <- pkmodel(columnMap = FALSE) %>% addDoseCycle(type = "SteadyState", name = "A1", amount = "Amount", II = "II")
model <- pkmodel(columnMap = FALSE) %>% addDoseCycle(type = "SteadyState", name = "A1", amount = "Amount", II = "II")
Adds user defined extra column/table definitions to column definition file
addExtraDef(.Object, value)
addExtraDef(.Object, value)
.Object |
PK/PD model |
value |
Character vector of extra column/table definitions |
Modified NlmePmlModel
object
model <- addExtraDef(model, c("addlcol(ADDL)", "table(file=\"res.csv\",time(0),Ka,V,Cl,Tlg)"))
model <- addExtraDef(model, c("addlcol(ADDL)", "table(file=\"res.csv\",time(0),Ka,V,Cl,Tlg)"))
Allows user to switch any dosing compartment to infusion
addInfusion( .Object, doseCptName, isDuration = FALSE, isSecondDose = FALSE, colName = NULL )
addInfusion( .Object, doseCptName, isDuration = FALSE, isSecondDose = FALSE, colName = NULL )
.Object |
Model object |
doseCptName |
Name of the compartment to which the dose is administered |
isDuration |
Set |
isSecondDose |
Set |
colName |
Name of the input data column that represents the corresponding infusion rate. If not provided, |
Modified NlmePmlModel
object
newModel <- addInfusion(model, "A1", FALSE, FALSE, "A1_1")
newModel <- addInfusion(model, "A1", FALSE, FALSE, "A1_1")
Allows users to specify the name and the associated value for each category/occasion of a categorical/occasion covariate in a textual model object. Only applicable to the case where the corresponding input data column of a categorical/occasion covariate is of class character.
addLabel(.Object, covariate, levels, labels)
addLabel(.Object, covariate, levels, labels)
.Object |
Model object |
covariate |
Existing covariate name |
levels |
Unique values of categorical or occasion covariate column specified as numeric vector |
labels |
Unique values specifying corresponding label names for levels of categorical or occasion covariate column in data specified as character vector. |
Modified NlmePmlModel
object
model <- addLabel(model, covariate, c(1, 2, 3), c("a", "b", "c"))
model <- addLabel(model, covariate, c(1, 2, 3), c("a", "b", "c"))
Use to add MDV statement to model@userDefinedExtraDefs
addMDV(.Object, MDV)
addMDV(.Object, MDV)
.Object |
Model object |
MDV |
Column mapping argument specifying corresponding "MDV" column in input data set |
Modified NlmePmlModel
object
model <- addMDV(model, MDV = "MDV")
model <- addMDV(model, MDV = "MDV")
Adds reset instructions to the model
addReset(.Object, low, hi, Reset = NULL) ## S4 method for signature 'NlmePmlModel' addReset(.Object, low, hi, Reset = NULL)
addReset(.Object, low, hi, Reset = NULL) ## S4 method for signature 'NlmePmlModel' addReset(.Object, low, hi, Reset = NULL)
.Object |
An 'NlmePmlModel' object to which you want to add reset instructions. |
low |
Lower value of reset range. |
hi |
Upper value of reset range. |
Reset |
Name of reset column in input data set for column mapping. The default is NULL. |
Depends on the specific methods
Returns the 'NlmePmlModel' object with updated reset information and definitions.
addReset(NlmePmlModel)
: Method for the 'NlmePmlModel' class
This method adds reset instructions to the NlmePmlModel object. It updates the reset information, checks column mappings if input data is not null, and adds a reset definition to user-defined extra definitions.
Adds a secondary parameter to model definition
addSecondary(.Object, name, definition, unit = "") ## S4 method for signature 'NlmePmlModel' addSecondary(.Object, name, definition, unit = "")
addSecondary(.Object, name, definition, unit = "") ## S4 method for signature 'NlmePmlModel' addSecondary(.Object, name, definition, unit = "")
.Object |
An 'NlmePmlModel' object to which you want to add a secondary parameter. |
name |
Name of the secondary parameter. |
definition |
Definition of secondary parameter. |
unit |
Optional units of the secondary parameter. The default is "". |
Depends on the specific methods
Returns the 'NlmePmlModel' object with the added secondary parameter.
addSecondary(NlmePmlModel)
: Method for the 'NlmePmlModel' class
This method adds a secondary parameter to the NlmePmlModel object. It checks for duplicate parameter names, and if there is no duplicate, it adds the new secondary parameter to the object and updates the PML model.
model <- addSecondary(model, "Spc_Param", "log(2)/tvKe") model <- addSecondary( model, "Tmax", "CalcTMax(tvA,tvAlpha,tvB,tvBeta,C,Gamma)" )
model <- addSecondary(model, "Spc_Param", "log(2)/tvKe") model <- addSecondary( model, "Tmax", "CalcTMax(tvA,tvAlpha,tvB,tvBeta,C,Gamma)" )
Use to add Steady State column definition statement to model@userDefinedExtraDefs
addSteadyState(.Object, SS, II, SSOffset = NULL)
addSteadyState(.Object, SS, II, SSOffset = NULL)
.Object |
Model object |
SS |
Column mapping argument specifying corresponding "SS" column in input data set |
II |
Column mapping argument specifying corresponding "II" column in input data set |
SSOffset |
Optional. Column mapping argument specifying corresponding "SSOffset" column in input data set |
Modified NlmePmlModel
object
model <- addSteadyState(model, SS = "ss", II = "ii")
model <- addSteadyState(model, SS = "ss", II = "ii")
Method to execute an NLME Bootstrap
bootstrap( model, hostPlatform = NULL, params, bootParams, runInBackground = FALSE, ... )
bootstrap( model, hostPlatform = NULL, params, bootParams, runInBackground = FALSE, ... )
model |
PK/PD model class object. |
hostPlatform |
Host definition for model execution. See |
params |
Engine parameters. See |
bootParams |
Bootstrap parameters. See |
runInBackground |
Set to |
... |
Additional class initializer arguments for |
if runInBackground = FALSE
, a list is returned with bootstrap results, i.e.
"BootOverall", "BootTheta", "BootOmega", "BootOmegaStderr", "BootVarCoVar" comma separated files.
Otherwise the BootNlmeJob
class object is returned.
hostParams, engineParams, BootstrapParams
input_data <- pkData model <- pkmodel( numCompartments = 2, data = input_data, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc" ) # multicore multicoreHost <- hostParams( parallelMethod = "Multicore", hostName = "local_multicore", numCores = 4 ) bootstrapdf <- bootstrap(model, hostPlatform = multicoreHost, params = engineParams(model), numReplicates = 5, randomNumSeed = 1234, runInBackground = FALSE )
input_data <- pkData model <- pkmodel( numCompartments = 2, data = input_data, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc" ) # multicore multicoreHost <- hostParams( parallelMethod = "Multicore", hostName = "local_multicore", numCores = 4 ) bootstrapdf <- bootstrap(model, hostPlatform = multicoreHost, params = engineParams(model), numReplicates = 5, randomNumSeed = 1234, runInBackground = FALSE )
Generic function for cancelling a job
cancelJob(.Object) ## S4 method for signature 'SimpleNlmeJob' cancelJob(.Object)
cancelJob(.Object) ## S4 method for signature 'SimpleNlmeJob' cancelJob(.Object)
.Object |
A 'SimpleNlmeJob' object that you want to cancel |
Depends on the specific methods
Prints the 'SimpleNlmeJob' object after attempting to cancel the job. No return value.
cancelJob(SimpleNlmeJob)
: Method for cancelling a job of the 'SimpleNlmeJob' class
This method attempts to cancel a job of the 'SimpleNlmeJob' class. If the job is running on a local host or is not running in the background, it throws an error and does nothing. Otherwise, it uploads a 'STOP' command to the host's remote executor.
Piping compatible function for modelColumnMapping
used to add column mappings from input data to model object
colMapping(.Object, mappings = NULL, ...)
colMapping(.Object, mappings = NULL, ...)
.Object |
Model ( |
mappings |
Named character vector specifying valid column names in the input data.
Character vector names must be valid model variable names contained
in |
... |
optional pairs ModelTerm = ColumnName or ModelTerm = "ColumnName".
Has higher precedence than |
modified NlmePmlModel
object
dataMapping
modelVariableNames
pkData$id2 <- pkData$Subject model <- pkmodel(columnMap = FALSE, data = pkData) modelvar <- unlist(modelVariableNames(model)) colnames <- c("Subject", "Act_Time", "Amount", "Conc") names(colnames) <- modelvar # will map subject directly colnames <- colnames[-c(1)] model <- colMapping(model, colnames, id = c(Subject, id2)) # also possible: model <- colMapping(model, colnames, id = c("Subject", "id2")) # not recommended since only not quoted names are identified # if both types are provided: model <- colMapping(model, colnames, id = c("Subject", id2))
pkData$id2 <- pkData$Subject model <- pkmodel(columnMap = FALSE, data = pkData) modelvar <- unlist(modelVariableNames(model)) colnames <- c("Subject", "Act_Time", "Amount", "Conc") names(colnames) <- modelvar # will map subject directly colnames <- colnames[-c(1)] model <- colMapping(model, colnames, id = c(Subject, id2)) # also possible: model <- colMapping(model, colnames, id = c("Subject", "id2")) # not recommended since only not quoted names are identified # if both types are provided: model <- colMapping(model, colnames, id = c("Subject", id2))
Copies previously executed model into a new object and optionally accept all estimates returned from model execution. A new working directory is created and all files from base model are copied into it.
copyModel(model, acceptAllEffects = FALSE, modelName = "", workingDir = "")
copyModel(model, acceptAllEffects = FALSE, modelName = "", workingDir = "")
model |
Model object to be copied |
acceptAllEffects |
Set to |
modelName |
New model name for subdirectory created for model output. Subdirectory is created in current working directory. |
workingDir |
Working directory to run the model. Current working directory will be used if workingDir not specified. |
Modified NlmePmlModel
object
# Create initial model model <- pkmodel( parameterization = "Clearance", absorption = "Intravenous", numCompartments = 2, data = pkData, ID = "Subject", A1 = "Amount", CObs = "Conc", Time = "Act_Time", modelName = "pk_model" ) # Fit Model job <- fitmodel(model) # Copy model and accept all effects from the original model run vpcModel <- copyModel(model, acceptAllEffects = TRUE, modelName = "vpc_model")
# Create initial model model <- pkmodel( parameterization = "Clearance", absorption = "Intravenous", numCompartments = 2, data = pkData, ID = "Subject", A1 = "Amount", CObs = "Conc", Time = "Act_Time", modelName = "pk_model" ) # Fit Model job <- fitmodel(model) # Copy model and accept all effects from the original model run vpcModel <- copyModel(model, acceptAllEffects = TRUE, modelName = "vpc_model")
Use to return character vector of covariate names available in model object.
covariateNames(model)
covariateNames(model)
model |
Model object |
Character vector of covariate names defined in model
model <- pkmodel(columnMap = FALSE) model <- addCovariate(model, covariate = "BW", effect = "V") model <- addCovariate(model, covariate = "Age", effect = "Cl") covariateNames(model)
model <- pkmodel(columnMap = FALSE) model <- addCovariate(model, covariate = "BW", effect = "V") model <- addCovariate(model, covariate = "Age", effect = "Cl") covariateNames(model)
Calls TDL5 to parse the model and get the list of terms
createModelInfo(model, ForceRun = FALSE)
createModelInfo(model, ForceRun = FALSE)
model |
Model object |
ForceRun |
Set to |
List of model information
createModelInfo(model)
createModelInfo(model)
Used to initialize input data for PK/PD model
dataMapping(.Object, data)
dataMapping(.Object, data)
.Object |
Model object |
data |
Input data of class |
Modified NlmePmlModel
object
model <- pkmodel(columnMap = FALSE) model <- dataMapping(model, pkData)
model <- pkmodel(columnMap = FALSE) model <- dataMapping(model, pkData)
Use to return character vector of dose point names in model object.
doseNames(model)
doseNames(model)
model |
Model object |
Character vector of dose names defined in model
model <- pkmodel(columnMap = FALSE) doses <- doseNames(model)
model <- pkmodel(columnMap = FALSE) doses <- doseNames(model)
Allows user to edit PML text in model object using internal text editor and return a new textual model containing the edited PML statements.
editModel(.Object)
editModel(.Object)
.Object |
Model object |
Modified NlmePmlModel
object
model <- pkmodel(columnMap = FALSE) newModel <- editModel(model)
model <- pkmodel(columnMap = FALSE) newModel <- editModel(model)
Use to create an Emax or Imax model
emaxmodel( isPopulation = TRUE, checkBaseline = FALSE, checkFractional = FALSE, checkInhibitory = FALSE, checkSigmoid = FALSE, data = NULL, columnMap = TRUE, modelName = "", workingDir = "", ... )
emaxmodel( isPopulation = TRUE, checkBaseline = FALSE, checkFractional = FALSE, checkInhibitory = FALSE, checkSigmoid = FALSE, data = NULL, columnMap = TRUE, modelName = "", workingDir = "", ... )
isPopulation |
Is this a population model |
checkBaseline |
Set to |
checkFractional |
Set to |
checkInhibitory |
Set to |
checkSigmoid |
Set to |
data |
Input dataset |
columnMap |
If |
modelName |
Model name for subdirectory created for model output in current working directory. |
workingDir |
Working directory to run the model. Current working directory will be used
if |
... |
Arguments passed on to
|
NlmePmlModel
object
Note that quoted and unquoted column names are supported. Please see colMapping
.
model <- emaxmodel(data = pkpdData, ID = "ID", C = "CObs", EObs = "EObs") model <- emaxmodel( checkBaseline = TRUE, checkFractional = TRUE, checkInhibitory = TRUE, data = pkpdData, ID = "ID", C = "CObs", EObs = "EObs" ) # View PML Code print(model)
model <- emaxmodel(data = pkpdData, ID = "ID", C = "CObs", EObs = "EObs") model <- emaxmodel( checkBaseline = TRUE, checkFractional = TRUE, checkInhibitory = TRUE, data = pkpdData, ID = "ID", C = "CObs", EObs = "EObs" ) # View PML Code print(model)
Use to define extra engine parameters for model execution.
engineParams( model, sort = NULL, ODE = "MatrixExponent", rtolODE = 1e-06, atolODE = 1e-06, maxStepsODE = 50000, numIterations = 1000, method = NULL, stdErr = NULL, isCentralDiffStdErr = TRUE, stepSizeStdErr = NULL, numIntegratePtsAGQ = 1, numIterNonParametric = 0, allowSyntheticGradient = FALSE, numIterMAPNP = 0, numRepPCWRES = 0, stepSizeLinearize = 0.002, numDigitLaplacian = 7, numDigitBlup = 13, mapAssist = 0, iSample = 300, iAcceptRatio = 0.1, impDist = "Normal", tDOF = 4, numSampleSIR = 10, numBurnIn = 0, freezeOmega = FALSE, MCPEM = FALSE, runAllIterations = FALSE, scramble = "Owen", stepSizePartialDeriv = 1e-05, numTimeStepPartialDeriv = 20 )
engineParams( model, sort = NULL, ODE = "MatrixExponent", rtolODE = 1e-06, atolODE = 1e-06, maxStepsODE = 50000, numIterations = 1000, method = NULL, stdErr = NULL, isCentralDiffStdErr = TRUE, stepSizeStdErr = NULL, numIntegratePtsAGQ = 1, numIterNonParametric = 0, allowSyntheticGradient = FALSE, numIterMAPNP = 0, numRepPCWRES = 0, stepSizeLinearize = 0.002, numDigitLaplacian = 7, numDigitBlup = 13, mapAssist = 0, iSample = 300, iAcceptRatio = 0.1, impDist = "Normal", tDOF = 4, numSampleSIR = 10, numBurnIn = 0, freezeOmega = FALSE, MCPEM = FALSE, runAllIterations = FALSE, scramble = "Owen", stepSizePartialDeriv = 1e-05, numTimeStepPartialDeriv = 20 )
model |
Model object |
sort |
Logical; Specifying whether or not to sort the input data by subject and time values.
|
ODE |
Character; Specifying the solver used to numerically solve Ordinary Differential Equations (ODEs). Options are '"MatrixExponent"', '"Higham"', '"DVERK"', '"DOPRI5"', '"AutoDetect"', '"Stiff"'. See Details section. |
rtolODE |
Numeric; Specifying relative tolerance for the numerical ODE solver. |
atolODE |
Numeric; Specifying absolute tolerance for the numerical ODE solver. |
maxStepsODE |
Numeric; Specifying maximum number of allowable steps or function evaluations for the ODE solver. |
numIterations |
Numeric; Specifying maximum number of iterations for estimation. |
method |
Character; Specifying engine method for estimation. For population models,
options are Note: For population models, if |
stdErr |
Character; Specifying method for standard error computations.
Here |
isCentralDiffStdErr |
Logical; Default |
stepSizeStdErr |
Numeric; Specifying the step size used for |
numIntegratePtsAGQ |
Numeric; Specifying the number of integration points
for adaptive Gaussian quadrature (AGQ) algorithm. Only applicable to population models with
|
numIterNonParametric |
Numeric; Specifying the number of iterations to perform non-parametric estimation.
Only applicable to population models when |
allowSyntheticGradient |
Logical, Set to |
numIterMAPNP |
Numeric; Specifying the number of iterations
to perform Maximum A Posterior (MAP) initial Naive Pooling (NP) run before estimation.
Only applicable to population models when |
numRepPCWRES |
Numeric; Specifying the number of replicates to generate the PCWRES
after the simple estimation. Only applicable to population models when |
stepSizeLinearize |
Numeric; Specifying the step size used for numerical differentiation when linearizing the model function during the estimation process. |
numDigitLaplacian |
Numeric; Specifying the number of significant decimal digits for the Laplacian algorithm to use to reach convergence. Only applicable to population models. |
numDigitBlup |
Numeric; Specifying the number of significant decimal digits for the individual estimation to use to reach convergence. Only applicable to population models. |
mapAssist |
Numeric; Specifying the period used to perform MAP assistance ( |
iSample |
Numeric; Specifying the number of samples. Only applicable to population models with |
iAcceptRatio |
Numeric; Specifying the acceptance ratio. Only applicable to population models with |
impDist |
Character; Specifying the distribution used for important sampling, and options are
|
tDOF |
Numeric; Specifing the degree of freedom (allowed value is between 3 and 30) for T distribution.
Only applicable to population models with |
numSampleSIR |
Numeric; Specifying the number of samples per subject used
in the Sampling Importance Re-Sampling (SIR) algorithm to determine the number of SIR samples
taken from the empirical discrete distribution that approximates the target conditional distribution.
Only applicable to population models with |
numBurnIn |
Numeric; Specifying the number of burn-in iterations to perform at startup
to adjust certain internal parameters. Only applicable to population models with |
freezeOmega |
Logical; Set to |
MCPEM |
Logical; Set to |
runAllIterations |
Logical; Set to |
scramble |
Character; Specifying the quasi-random scrambling method to use,
and options are |
stepSizePartialDeriv |
Numeric; Specifying the step size used to numerically calculate the partial derivatives of observed variables with respect to parameters. Only applicable to individual models. |
numTimeStepPartialDeriv |
Numeric; Specifying the number of time steps used to output the partial derivatives of observed variables with respect to parameters. Only applicable to individual models. |
Both '"DVERK"' and '"DOPRI5"' are non-stiff solvers. '"Higham"' is a matrix exponent based ODE solver which could be useful when overscaling issue should be avoided, i.e. the ratio between observed values and doses is too high or too low. '"AutoDetect"' represents LSODA solver implemenation, which solves the initial value problem for stiff or nonstiff systems of first order ordinary differential equations. '"Stiff"' is a LSODE (Livermore solver). It is best suited for stiff problems.
List of engine parameters to be used during fitting or simulation
Use to return extra dose lines for model object
extraDoseLines(model)
extraDoseLines(model)
model |
Model object |
List of extra dose information
data <- pkData data$II <- 24 data$ADDL <- 1 model <- pkmodel( parameterization = "Clearance", numCompartments = 2, data = data, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc") |> addDoseCycle( name = "A1", amount = 30000, II = 24, type = "ADDL", colName = "ADDL") extraDoseLines(model)
data <- pkData data$II <- 24 data$ADDL <- 1 model <- pkmodel( parameterization = "Clearance", numCompartments = 2, data = data, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc") |> addDoseCycle( name = "A1", amount = 30000, II = 24, type = "ADDL", colName = "ADDL") extraDoseLines(model)
Use to return extra dose names for model object
extraDoseNames(model)
extraDoseNames(model)
model |
Model object |
Character vector of extra dose names
data <- pkData data$II <- 24 data$ADDL <- 1 model <- pkmodel( parameterization = "Clearance", numCompartments = 2, data = data, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc") |> addDoseCycle( name = "A1", amount = 30000, II = 24, type = "ADDL", colName = "ADDL") extraDoseNames(model)
data <- pkData data$II <- 24 data$ADDL <- 1 model <- pkmodel( parameterization = "Clearance", numCompartments = 2, data = data, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc") |> addDoseCycle( name = "A1", amount = 30000, II = 24, type = "ADDL", colName = "ADDL") extraDoseNames(model)
Executes an NLME simple estimation
fitmodel( model, hostPlatform = NULL, params, simpleTables, runInBackground = FALSE, filesToReturn = "*", ... )
fitmodel( model, hostPlatform = NULL, params, simpleTables, runInBackground = FALSE, filesToReturn = "*", ... )
model |
PK/PD model class object. |
hostPlatform |
Host definition for model execution. See |
params |
Engine parameters. See |
simpleTables |
Optional list of simple tables. See
|
runInBackground |
Set to |
filesToReturn |
Used to specify which files to be outputted to the model directory
and loaded as returned value. By default, all the applicable files listed
in the |
... |
Additional arguments for |
if runInBackground
is FALSE
, a list with main
resulted dataframes is returned:
Overall
ConvergenceData
residuals
Secondary
StrCovariate - if continuous covariates presented
StrCovariateCat - if categorical covariates presented
theta
posthoc table
posthocStacked table
Requested tables
nlme7engine.log
textual output is returned and loaded with the main information related to
fitting. dmp.txt
structure with the results of fitting (including LL by subject information)
is returned and loaded. These 2 files are returned and loaded irrespective of
filesToReturn
argument value.
For individual models, additional dataframe with partial derivatives is returned:
ParDer
For population models and the method specified is NOT Naive-Pooled
,
additional dataframes are returned:
omega
Eta
EtaStacked
EtaEta
EtaCov
EtaCovariate - if continuous covariates presented
EtaCovariateCat - if categorical covariates presented
bluptable.dat
If standard error computation was requested and it was successful, additional dataframes are returned:
thetaCorrelation
thetaCovariance
Covariance
omega_stderr
If nonparametric method was requested (numIterNonParametric
> 0) and
the method
specified in engineParams
is NOT Naive-Pooled
,
additional dataframes are returned:
nonParSupportResult
nonParStackedResult
nonParEtaResult
nonParOverallResult
if runInBackground
is TRUE
, only current status of job is returned.
filesToReturn
with Certara.Xpose.NLME
If filesToReturn
is used and "ConvergenceData.csv" and "residuals.csv"
are not in the patterns, these files won't be returned and loaded. These files
are essential for Certara.Xpose.NLME::xposeNlmeModel
and
Certara.Xpose.NLME::xposeNlme
functions. This makes impossible to
use the resulted object in Certara.Xpose.NLME
functions.
The non-loaded but returned files in the model working directory are:
err1.txt - concatenated for all runs detailed logs for all steps of optimization,
out.txt - general pivoted information about results,
doses.csv - information about doses given for all subjects,
iniest.csv - information about initial estimates
tableParams, hostParams,
engineParams
# Define the host host <- hostParams(parallelMethod = "None", hostName = "local", numCores = 1) # Define the model model <- pkmodel(numComp = 2, absorption = "FirstOrder", ID = "Subject", Time = "Act_Time", CObs = "Conc", Aa = "Amount", data = pkData, modelName = "PkModel") Table01 <- tableParams(name = "SimTableObs.csv", timesList = "0,1,2,4,4.9,55.1,56,57,59,60", variablesList = "C, CObs", timeAfterDose = FALSE, forSimulation = FALSE) # Update fixed effects model <- fixedEffect(model, effect = c("tvV", "tvCl", "tvV2", "tvCl2"), value = c(16, 41, 7, 14)) # Define the engine parameters params <- engineParams(model) # Fit model res <- fitmodel(model = model, hostPlatform = host, params = params, simpleTables = Table01)
# Define the host host <- hostParams(parallelMethod = "None", hostName = "local", numCores = 1) # Define the model model <- pkmodel(numComp = 2, absorption = "FirstOrder", ID = "Subject", Time = "Act_Time", CObs = "Conc", Aa = "Amount", data = pkData, modelName = "PkModel") Table01 <- tableParams(name = "SimTableObs.csv", timesList = "0,1,2,4,4.9,55.1,56,57,59,60", variablesList = "C, CObs", timeAfterDose = FALSE, forSimulation = FALSE) # Update fixed effects model <- fixedEffect(model, effect = c("tvV", "tvCl", "tvV2", "tvCl2"), value = c(16, 41, 7, 14)) # Define the engine parameters params <- engineParams(model) # Fit model res <- fitmodel(model = model, hostPlatform = host, params = params, simpleTables = Table01)
Specifies the initial values, lower bounds, upper bounds, and units for fixed effects in a model
fixedEffect( .Object, effect, value = NULL, lowerBound = NULL, upperBound = NULL, isFrozen = NULL, unit = NULL )
fixedEffect( .Object, effect, value = NULL, lowerBound = NULL, upperBound = NULL, isFrozen = NULL, unit = NULL )
.Object |
Model object in which to define fixed effects values |
effect |
Character or character vector specifying names of fixed effects |
value |
Numeric or numeric vector specifying the initial values of fixed effects. If supplying vector, must be in the same order/length as corresponding |
lowerBound |
Numeric or numeric vector specifying the lower limit values of fixed effects. If supplying vector, must be in the same order as |
upperBound |
Numeric or numeric vector specifying the upper limit values of fixed effects. If supplying vector, must be in the same order as |
isFrozen |
Logical or logical vector. Set to |
unit |
Character or character vector specifying units of measurement for the fixed effects. If supplying a vector, must be in the same order as |
Modified NlmePmlModel
object
model <- pkmodel( numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc", modelName = "TwCpt_IVBolus_FOCE_ELS" ) # View initial/current fixed effect values initFixedEffects(model) model <- model |> fixedEffect( effect = c("tvV", "tvCl", "tvV2", "tvCl2"), value = c(15, 5, 40, 15) )
model <- pkmodel( numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc", modelName = "TwCpt_IVBolus_FOCE_ELS" ) # View initial/current fixed effect values initFixedEffects(model) model <- model |> fixedEffect( effect = c("tvV", "tvCl", "tvV2", "tvCl2"), value = c(15, 5, 40, 15) )
Use to return character vector of random effect names (if available) in model object
getRandomEffectNames(model)
getRandomEffectNames(model)
model |
Model object |
Characters vector of random effect names
model <- pkmodel(columnMap = FALSE) getRandomEffectNames(model)
model <- pkmodel(columnMap = FALSE) getRandomEffectNames(model)
Returns named character vector of theta values by parsing PML fixed effect statements
getThetas(model)
getThetas(model)
model |
PK/PD model |
Character vector of theta names defined in model
getThetas(pkpdmodel)
getThetas(pkpdmodel)
Initialize for NlmeParallelHost
hostParams( sharedDirectory, installationDirectory = Sys.getenv("INSTALLDIR"), hostName = Sys.info()[["nodename"]], machineName = "127.0.0.1", hostType = Sys.info()[["sysname"]], numCores = 4, parallelMethod = "LOCAL_MPI", userName = "", privateKeyFile = NULL, userPassword = "", scriptPath = "", rLocation = "", isLocal = TRUE )
hostParams( sharedDirectory, installationDirectory = Sys.getenv("INSTALLDIR"), hostName = Sys.info()[["nodename"]], machineName = "127.0.0.1", hostType = Sys.info()[["sysname"]], numCores = 4, parallelMethod = "LOCAL_MPI", userName = "", privateKeyFile = NULL, userPassword = "", scriptPath = "", rLocation = "", isLocal = TRUE )
sharedDirectory |
Directory where temporary NLME run folder is created during execution. If missing, the current working directory will be used. |
installationDirectory |
Directory containing NLME libraries/scripts |
hostName |
Visual name of the host (default A name by which the machine is known on the network) |
machineName |
IP address or name of the host(default 127.0.0.1) |
hostType |
|
numCores |
Integer; Number of compute cores. 4 by default |
parallelMethod |
String; Options are:
|
userName |
String; How the user is identified to the remote system |
privateKeyFile |
Path to private key file, see
|
userPassword |
Either a string or a callback function for
password prompt, see |
scriptPath |
a path to the script to be executed before starting Rscript within Certara.NLME8 package on the remote host. Ignored when running locally. |
rLocation |
Path to Rscript executable on remote host; ignored on local host |
isLocal |
Is this a local |
NlmeParallelHost class instance
host <- hostParams(sharedDirectory = tempdir(), parallelMethod = "LOCAL_MPI", hostName = "Local", numCores = 4)
host <- hostParams(sharedDirectory = tempdir(), parallelMethod = "LOCAL_MPI", hostName = "Local", numCores = 4)
Display/Set initial estimates for fixed effects
initFixedEffects(.Object) ## S4 method for signature 'NlmePmlModel' initFixedEffects(.Object) initFixedEffects(.Object) <- value ## S4 replacement method for signature 'NlmePmlModel' initFixedEffects(.Object) <- value
initFixedEffects(.Object) ## S4 method for signature 'NlmePmlModel' initFixedEffects(.Object) initFixedEffects(.Object) <- value ## S4 replacement method for signature 'NlmePmlModel' initFixedEffects(.Object) <- value
.Object |
PK/PD model |
value |
Named numeric vector |
Named numeric vector of fixed effects estimates
model <- pkmodel( numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc", modelName = "TwCpt_IVBolus_FOCE_ELS" ) # View initial/current fixed effect values initFixedEffects(model) # May also use as a 'replacement function' to set the values initFixedEffects(model) <- c(tvV = 15, tvCl = 5, tvV2 = 40, tvCl2 = 15)
model <- pkmodel( numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc", modelName = "TwCpt_IVBolus_FOCE_ELS" ) # View initial/current fixed effect values initFixedEffects(model) # May also use as a 'replacement function' to set the values initFixedEffects(model) <- c(tvV = 15, tvCl = 5, tvV2 = 40, tvCl2 = 15)
Use to create a constant, linear, or quadratic PD model
linearmodel( isPopulation = TRUE, type = "Constant", data = NULL, columnMap = TRUE, modelName = "", workingDir = "", ... )
linearmodel( isPopulation = TRUE, type = "Constant", data = NULL, columnMap = TRUE, modelName = "", workingDir = "", ... )
isPopulation |
Is this a population model |
type |
Model type. Options are |
data |
Input dataset |
columnMap |
If |
modelName |
Model name for subdirectory created for model output in current working directory. |
workingDir |
Working directory to run the model. Current working directory will be used
if |
... |
Arguments passed on to
|
NlmePmlModel
object
Note that quoted and unquoted column names are supported. Please see colMapping
.
model <- linearmodel(type = "Linear", data = pkpdData, ID = "ID", C = "CObs", EObs = "EObs") # View PML Code print(model)
model <- linearmodel(type = "Linear", data = pkpdData, ID = "ID", C = "CObs", EObs = "EObs") # View PML Code print(model)
This function lists the names of covariate effects in a provided pharmacokinetic/pharmacodynamic (PK/PD) model.
listCovariateEffectNames(.Object) ## S4 method for signature 'NlmePmlModel' listCovariateEffectNames(.Object)
listCovariateEffectNames(.Object) ## S4 method for signature 'NlmePmlModel' listCovariateEffectNames(.Object)
.Object |
PK/PD model |
A vector of character strings containing the names of the covariate effects in the model.
listCovariateEffectNames(model)
listCovariateEffectNames(model)
Return a vector of model variable names from model object
modelVariableNames(model)
modelVariableNames(model)
model |
Model object |
Character vector of required model variable names
modelVariableNames(model)
modelVariableNames(model)
This function attempts to authenticate and obtain an NLME license using the specified installation directory and licensing tool.
obtain_NLMELicense( InstallDir = Sys.getenv("INSTALLDIR"), ForceAuth = FALSE, ForceLicenseGet = FALSE, verbose = getOption("verbose") )
obtain_NLMELicense( InstallDir = Sys.getenv("INSTALLDIR"), ForceAuth = FALSE, ForceLicenseGet = FALSE, verbose = getOption("verbose") )
InstallDir |
A character string specifying the directory
where the NLME Engine is installed e.g., |
ForceAuth |
A logical value indicating whether to force
re-authentication even if already authenticated. Default is |
ForceLicenseGet |
A logical value indicating whether to force obtaining
the license even if already licensed. Default is |
verbose |
A logical value indicating whether to print verbose output.
Default is |
This function checks for the presence of the necessary
appsettings.json
file as indicated by the CAD_CONFIG_FILE
environment variable,
runs the licensing tool to authenticate the user, and attempts to obtain
an NLME license. It prints detailed messages if the verbose
parameter is set to TRUE
.
A logical value indicating whether the license was successfully obtained.
result <- obtain_NLMELicense("C:/Program Files/Certara/NLME_Engine", verbose = TRUE) if (result) { message("License obtained successfully!") } else { message("Failed to obtain license.") }
result <- obtain_NLMELicense("C:/Program Files/Certara/NLME_Engine", verbose = TRUE) if (result) { message("License obtained successfully!") } else { message("Failed to obtain license.") }
Pharmacokinetic dataset containing 16 subjects with single dose given by infusion.
OneCpt_IVInfusionData
OneCpt_IVInfusionData
A data frame with 800 rows and 6 variables:
Subject ID
Time point
Amount of dose
Observations of drug concentration in blood
Rate of infusion
Duration of infusion
The data is simulated using a PK model described by a one-compartment model with IV infusion
Add/update column definition information for the model object
parsePMLColMap(.Object, ForceRun = TRUE)
parsePMLColMap(.Object, ForceRun = TRUE)
.Object |
Model ( |
ForceRun |
Set to |
Intended to be used by other packages
modified NLMEPmlModel
object with column mapping
definitions
Pharmacokinetic pediatric dataset containing 80 subjects with single bolus dose. Dataset includes covariates and observations Below Quantification Limit (BQL).
pkcovbqlData
pkcovbqlData
A data frame with 880 rows and 8 variables:
Subject ID
Nominal Time
Amount of dose
Observations of drug concentration in blood
Lower Limit of Quantification
Variable that indicates whether the observed drug concentration is below the limit of quantification
Body weight
Postmenstrual age
The data is simulated using a one-compartment model with IV bolus, where the central volume is allometric weight scaled, and the clearance is scaled by a combination of allometric weight scaling and a sigmoidal maturation function driven by PMA. Germovsek E., et al, Pharmacokinetic–Pharmacodynamic Modeling in Pediatric Drug Development, and the Importance of Standardized Scaling of Clearance, Clin Pharmacokinet (2019) 58:39–52.
Pharmacokinetic dataset containing 16 subjects with single bolus dose.
pkData
pkData
A data frame with 112 rows and 8 variables:
Subject ID
Nominal Time
Actual Time
Amount of dose
Observations of drug concentration in blood
Age
Body weight
Gender ("male", "female")
Use to create a PK/Emax or PK/Imax model
pkemaxmodel( isPopulation = TRUE, parameterization = "Clearance", absorption = "Intravenous", numCompartments = 1, isClosedForm = TRUE, isTlag = FALSE, hasEliminationComp = FALSE, isFractionExcreted = FALSE, isSaturating = FALSE, infusionAllowed = FALSE, isDuration = FALSE, isSequential = FALSE, isPkFrozen = FALSE, hasEffectsCompartment = FALSE, checkBaseline = FALSE, checkFractional = FALSE, checkInhibitory = FALSE, checkSigmoid = FALSE, isEmaxFrozen = FALSE, data = NULL, columnMap = TRUE, modelName = "", workingDir = "", ... )
pkemaxmodel( isPopulation = TRUE, parameterization = "Clearance", absorption = "Intravenous", numCompartments = 1, isClosedForm = TRUE, isTlag = FALSE, hasEliminationComp = FALSE, isFractionExcreted = FALSE, isSaturating = FALSE, infusionAllowed = FALSE, isDuration = FALSE, isSequential = FALSE, isPkFrozen = FALSE, hasEffectsCompartment = FALSE, checkBaseline = FALSE, checkFractional = FALSE, checkInhibitory = FALSE, checkSigmoid = FALSE, isEmaxFrozen = FALSE, data = NULL, columnMap = TRUE, modelName = "", workingDir = "", ... )
isPopulation |
Is this a population model |
parameterization |
Type of parameterization. Options are |
absorption |
Type of absorption. Options are |
numCompartments |
Value of either |
isClosedForm |
Set to |
isTlag |
Set to |
hasEliminationComp |
Set to |
isFractionExcreted |
Set to |
isSaturating |
Set to |
infusionAllowed |
Set to |
isDuration |
Set to |
isSequential |
Set to |
isPkFrozen |
Set to |
hasEffectsCompartment |
Set to |
checkBaseline |
Does Emax/Imax model have a baseline response? |
checkFractional |
Set to |
checkInhibitory |
Set to |
checkSigmoid |
Set to |
isEmaxFrozen |
Set to |
data |
Input dataset |
columnMap |
If |
modelName |
Model name for subdirectory created for model output in current working directory. |
workingDir |
Working directory to run the model. Current working directory will be used
if |
... |
Arguments passed on to
|
NlmePmlModel
object
Note that quoted and unquoted column names are supported. Please see colMapping
.
model <- pkemaxmodel( parameterization = "Macro", data = pkpdData, Time = "Time", ID = "ID", A1 = "Dose", C1Obs = "CObs", EObs = "EObs" ) # View the model as well as its associated column mappings print(model)
model <- pkemaxmodel( parameterization = "Macro", data = pkpdData, Time = "Time", ID = "ID", A1 = "Dose", C1Obs = "CObs", EObs = "EObs" ) # View the model as well as its associated column mappings print(model)
Use to create a PK/Indirect response model.
pkindirectmodel( isPopulation = TRUE, parameterization = "Clearance", absorption = "Intravenous", numCompartments = 1, isClosedForm = TRUE, isTlag = FALSE, hasEliminationComp = FALSE, isFractionExcreted = FALSE, isSaturating = FALSE, infusionAllowed = FALSE, isDuration = FALSE, isSequential = FALSE, isPkFrozen = FALSE, hasEffectsCompartment = FALSE, indirectType = "LimitedStimulation", isBuildup = TRUE, isExponent = FALSE, indirectFrozen = FALSE, data = NULL, columnMap = TRUE, modelName = "", workingDir = "", ... )
pkindirectmodel( isPopulation = TRUE, parameterization = "Clearance", absorption = "Intravenous", numCompartments = 1, isClosedForm = TRUE, isTlag = FALSE, hasEliminationComp = FALSE, isFractionExcreted = FALSE, isSaturating = FALSE, infusionAllowed = FALSE, isDuration = FALSE, isSequential = FALSE, isPkFrozen = FALSE, hasEffectsCompartment = FALSE, indirectType = "LimitedStimulation", isBuildup = TRUE, isExponent = FALSE, indirectFrozen = FALSE, data = NULL, columnMap = TRUE, modelName = "", workingDir = "", ... )
isPopulation |
Is this a population model |
parameterization |
Type of parameterization. Options are |
absorption |
Type of absorption. Options are |
numCompartments |
Value of either |
isClosedForm |
Set to |
isTlag |
Set to |
hasEliminationComp |
Set to |
isFractionExcreted |
Set to |
isSaturating |
Set to |
infusionAllowed |
Set to |
isDuration |
Set to |
isSequential |
Set to |
isPkFrozen |
Set to |
hasEffectsCompartment |
Set to |
indirectType |
Type of drug actions for the indirect response model.
Options are |
isBuildup |
Set to |
isExponent |
Set to |
indirectFrozen |
Set to |
data |
Input dataset |
columnMap |
If |
modelName |
Model name for subdirectory created for model output in current working directory. |
workingDir |
Working directory to run the model. Current working directory will be used
if |
... |
Arguments passed on to
|
NlmePmlModel
object
Note that quoted and unquoted column names are supported. Please see colMapping
.
model <- pkindirectmodel( parameterization = "Micro", data = pkpdData, ID = "ID", Time = "Time", A1 = "Dose", CObs = "CObs", EObs = "EObs" ) # View PML Code print(model)
model <- pkindirectmodel( parameterization = "Micro", data = pkpdData, ID = "ID", Time = "Time", A1 = "Dose", CObs = "CObs", EObs = "EObs" ) # View PML Code print(model)
Use to create a PK/PD model with PD described by either constant, linear, or quadratic model
pklinearmodel( isPopulation = TRUE, parameterization = "Clearance", absorption = "Intravenous", numCompartments = 1, isClosedForm = TRUE, isTlag = FALSE, hasEliminationComp = FALSE, isFractionExcreted = FALSE, isSaturating = FALSE, infusionAllowed = FALSE, isDuration = FALSE, isSequential = FALSE, isPkFrozen = FALSE, hasEffectsCompartment = FALSE, linearType = "Constant", isLinearFrozen = FALSE, data = NULL, columnMap = TRUE, modelName = "", workingDir = "", ... )
pklinearmodel( isPopulation = TRUE, parameterization = "Clearance", absorption = "Intravenous", numCompartments = 1, isClosedForm = TRUE, isTlag = FALSE, hasEliminationComp = FALSE, isFractionExcreted = FALSE, isSaturating = FALSE, infusionAllowed = FALSE, isDuration = FALSE, isSequential = FALSE, isPkFrozen = FALSE, hasEffectsCompartment = FALSE, linearType = "Constant", isLinearFrozen = FALSE, data = NULL, columnMap = TRUE, modelName = "", workingDir = "", ... )
isPopulation |
Is this a population model |
parameterization |
Type of parameterization. Options are |
absorption |
Type of absorption. Options are |
numCompartments |
Value of either |
isClosedForm |
Set to |
isTlag |
Set to |
hasEliminationComp |
Set to |
isFractionExcreted |
Set to |
isSaturating |
Set to |
infusionAllowed |
Set to |
isDuration |
Set to |
isSequential |
Set to |
isPkFrozen |
Set to |
hasEffectsCompartment |
Set to |
linearType |
Type of PD model; Options are |
isLinearFrozen |
Set to |
data |
Input dataset |
columnMap |
If |
modelName |
Model name for subdirectory created for model output in current working directory. |
workingDir |
Working directory to run the model. Current working directory will be used
if |
... |
Arguments passed on to
|
NlmePmlModel
object
Note that quoted and unquoted column names are supported. Please see colMapping
.
model <- pklinearmodel( parameterization = "Clearance", linearType = "Constant", data = pkpdData, ID = "ID", Time = "Time", A1 = "Dose", CObs = "CObs", EObs = "EObs" ) # View the model as well as its associated column mappings print(model)
model <- pklinearmodel( parameterization = "Clearance", linearType = "Constant", data = pkpdData, ID = "ID", Time = "Time", A1 = "Dose", CObs = "CObs", EObs = "EObs" ) # View the model as well as its associated column mappings print(model)
Use to create a PK model
pkmodel( isPopulation = TRUE, parameterization = "Clearance", absorption = "Intravenous", numCompartments = 1, isClosedForm = TRUE, isTlag = FALSE, hasEliminationComp = FALSE, isFractionExcreted = FALSE, isSaturating = FALSE, infusionAllowed = FALSE, isDuration = FALSE, isStdevFrozen = FALSE, data = NULL, columnMap = TRUE, modelName = "", workingDir = "", ... )
pkmodel( isPopulation = TRUE, parameterization = "Clearance", absorption = "Intravenous", numCompartments = 1, isClosedForm = TRUE, isTlag = FALSE, hasEliminationComp = FALSE, isFractionExcreted = FALSE, isSaturating = FALSE, infusionAllowed = FALSE, isDuration = FALSE, isStdevFrozen = FALSE, data = NULL, columnMap = TRUE, modelName = "", workingDir = "", ... )
isPopulation |
Is this a population model |
parameterization |
Type of parameterization. Options are |
absorption |
Type of absorption. Options are |
numCompartments |
Value of either |
isClosedForm |
Set to |
isTlag |
Set to |
hasEliminationComp |
Set to |
isFractionExcreted |
Set to |
isSaturating |
Set to |
infusionAllowed |
Set to |
isDuration |
Set to |
isStdevFrozen |
Set to |
data |
Input dataset |
columnMap |
If |
modelName |
Model name for subdirectory created for model output in current working directory. |
workingDir |
Working directory to run the model. Current working directory will be used
if |
... |
Arguments passed on to
|
NlmePmlModel
object
Note that quoted and unquoted column names are supported. Please see colMapping
.
model <- pkmodel( parameterization = "Clearance", numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc" ) # View the model as well as its associated column mappings print(model)
model <- pkmodel( parameterization = "Clearance", numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc" ) # View the model as well as its associated column mappings print(model)
Pharmacokinetic/Pharmacodynamic dataset containing 200 subjects with single bolus dose.
pkpdData
pkpdData
A data frame with 2600 rows and 5 variables:
Subject ID
Nominal Time
Amount of dose
Observations of drug concentration in blood
Observations of drug effect
The data is simulated using a PKPD model with PK described by a one-compartment model with IV bolus and PD described by an indirect response model with the loss inhibited.
Prints model information, including PML and column mappings.
## S3 method for class 'NlmePmlModel' print(x, ...)
## S3 method for class 'NlmePmlModel' print(x, ...)
x |
NlmePmlModel class instance |
... |
Arguments passed to methods. |
NULL
model <- pkmodel(columnMap = FALSE, data = pkData) print(model)
model <- pkmodel(columnMap = FALSE, data = pkData) print(model)
Use to set or update the covariance matrix of random effects in a model object.
randomEffect( .Object, effect, value = NULL, isDiagonal = TRUE, isFrozen = FALSE, ... )
randomEffect( .Object, effect, value = NULL, isDiagonal = TRUE, isFrozen = FALSE, ... )
.Object |
Model object |
effect |
One or more names of available random effects. |
value |
Initial values for the diagonal elements of the covariance matrix of
random effects (if |
isDiagonal |
Set to |
isFrozen |
Set to |
... |
Additional arguments |
Modified NlmePmlModel
object
model <- pkmodel( numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc", modelName = "TwCpt_IVBolus_FOCE_ELS" ) model <- model |> randomEffect(effect = c("nV", "nCl", "nCl2"), value = rep(0.1, 3))
model <- pkmodel( numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc", modelName = "TwCpt_IVBolus_FOCE_ELS" ) model <- model |> randomEffect(effect = c("nV", "nCl", "nCl2"), value = rep(0.1, 3))
This function attempts to remove an NLME license using the specified installation directory and licensing tool.
remove_NLMELicense(InstallDir = Sys.getenv("INSTALLDIR"))
remove_NLMELicense(InstallDir = Sys.getenv("INSTALLDIR"))
InstallDir |
A character string specifying the directory
where the NLME Engine is installed e.g., |
The function checks for the presence of the necessary 'appsettings.json' file in the specified directory or the CAD config file specified by the 'CAD_CONFIG_FILE' environment variable, runs the licensing tool to log out the user, and attempts to remove the NLME license.
A logical value indicating whether the license information was successfully removed.
result <- remove_NLMELicense("/path/to/install/dir") if (result) { message("License removed successfully!") } else { message("Failed to remove license.") }
result <- remove_NLMELicense("/path/to/install/dir") if (result) { message("License removed successfully!") } else { message("Failed to remove license.") }
Remove one or more covariates from structural parameters in a model object.
removeCovariate(.Object, covariate = NULL, paramName = NULL)
removeCovariate(.Object, covariate = NULL, paramName = NULL)
.Object |
Model object |
covariate |
Covariates to remove from model. If |
paramName |
Structural parameters for which to remove covariate effect(s) from. If |
Modified NlmePmlModel
object
model <- pkmodel( numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc" ) # Add Gender covariate of type categorical model <- addCovariate(model, covariate = "Gender", type = "Categorical", effect = c("V2", "Cl2"), levels = c(0, 1), labels = c("Female", "Male") ) # Add BodyWeight covariate of type continuous model <- addCovariate(model, covariate = "BodyWeight", type = "Continuous", direction = "Backward", center = "Mean", effect = c("V", "Cl") ) # Remove all covariates from model model <- removeCovariate(model)
model <- pkmodel( numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc" ) # Add Gender covariate of type categorical model <- addCovariate(model, covariate = "Gender", type = "Categorical", effect = c("V2", "Cl2"), levels = c(0, 1), labels = c("Female", "Male") ) # Add BodyWeight covariate of type continuous model <- addCovariate(model, covariate = "BodyWeight", type = "Continuous", direction = "Backward", center = "Mean", effect = c("V", "Cl") ) # Remove all covariates from model model <- removeCovariate(model)
Use to return character vector of residual effect names in model object
residualEffectNames(model)
residualEffectNames(model)
model |
Object of class |
Character vector of residual effect names
model <- pkemaxmodel(columnMap = FALSE) residualEffectNames(model)
model <- pkemaxmodel(columnMap = FALSE) residualEffectNames(model)
Use to change or update residual error model for model object
residualError( .Object, predName = "C", errorType = NULL, SD = NULL, isFrozen = FALSE, isBQL = FALSE, staticLLOQ = NULL, EObsBQL = NULL, CObsBQL = NULL, C1ObsBQL = NULL, A0ObsBQL = NULL, exponent = NULL )
residualError( .Object, predName = "C", errorType = NULL, SD = NULL, isFrozen = FALSE, isBQL = FALSE, staticLLOQ = NULL, EObsBQL = NULL, CObsBQL = NULL, C1ObsBQL = NULL, A0ObsBQL = NULL, exponent = NULL )
.Object |
Model object |
predName |
Name of the predicted variable as returned in |
errorType |
Options are |
SD |
Value for the standard deviation of the residual error variable. |
isFrozen |
Set to |
isBQL |
Set to |
staticLLOQ |
Optional LLOQ value if |
EObsBQL |
Column mapping argument that represents the input dataset column that contains the BQL flag for observation values corresponding to |
CObsBQL |
Column mapping argument that represents the input dataset column that contains the BQL flag for observation values corresponding to |
C1ObsBQL |
Column mapping argument that represents the input dataset column that contains the BQL flag for observation values corresponding to |
A0ObsBQL |
Column mapping argument that represents the input dataset column that contains the BQL flag for observation values corresponding to |
exponent |
Value of exponent. Only applicable to |
Modified NlmePmlModel
object
model <- pkindirectmodel(indirectType = "LimitedInhibition", isBuildup = FALSE, data = pkpdData, ID = "ID", Time = "Time", A1 = "Dose", CObs = "CObs", EObs = "EObs") residualEffectNames(model) # Change error type to "Multiplicative" and value of SD to 0.1 for "E" model <- residualError(model, predName = "E", errorType = "Multiplicative", SD = 0.1) # Change error type to "Power", value of SD to 0.15, and set exponent = 2 for "C" model <- residualError(model, predName = "C", errorType = "Power", SD = 0.15, exponent = 2)
model <- pkindirectmodel(indirectType = "LimitedInhibition", isBuildup = FALSE, data = pkpdData, ID = "ID", Time = "Time", A1 = "Dose", CObs = "CObs", EObs = "EObs") residualEffectNames(model) # Change error type to "Multiplicative" and value of SD to 0.1 for "E" model <- residualError(model, predName = "E", errorType = "Multiplicative", SD = 0.1) # Change error type to "Power", value of SD to 0.15, and set exponent = 2 for "C" model <- residualError(model, predName = "C", errorType = "Power", SD = 0.15, exponent = 2)
Returns character vector of secondary parameter names for model object.
secondaryParameterNames(model)
secondaryParameterNames(model)
model |
Object of class |
Character vector of secondary parameter names defined in model
model <- pkemaxmodel(columnMap = FALSE) secondaryparms <- secondaryParameterNames(model)
model <- pkemaxmodel(columnMap = FALSE) secondaryparms <- secondaryParameterNames(model)
Executes an NLME shotgun covariate search
shotgunSearch( model, hostPlatform = NULL, params, covariateModel, runInBackground = FALSE, ... )
shotgunSearch( model, hostPlatform = NULL, params, covariateModel, runInBackground = FALSE, ... )
model |
PK/PD model class object. |
hostPlatform |
Host definition for model execution. See |
params |
Engine parameters. See |
covariateModel |
Covariate Effects Model providing the relationship
between covariates and structural parameters to test ( |
runInBackground |
Set to |
... |
Additional arguments for |
if runInBackground = FALSE
, a data frame is returned with
shotgun (all combinations given the covariate model) search results,
i.e. "Overall" comma separated file.
Otherwise the ShotgunNlmeJob
class object is returned.
# Define the model model <- pkmodel(numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc") # Add Gender covariate of type categorical model <- addCovariate(model, covariate = "Gender", type = "Categorical", effect = c("V2", "Cl2"), levels = c(0, 1), labels = c("Female", "Male")) # Add Bodyweight covariate of type continuous model <- addCovariate(model, covariate = "BodyWeight", type = "Continuous", direction = "Backward", center = "Mean", effect = c("V", "Cl")) # Define the host host <- hostParams(parallelMethod = "None", hostName = "local", numCores = 1) # Define the engine parameters params <- engineParams(model) # Define covariate model cp <- covariateModel(model) # Perform shotgun search OverallDF <- shotgunSearch(model = model, hostPlatform = host, params = params, covariateModel = cp, runInBackground = FALSE)
# Define the model model <- pkmodel(numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc") # Add Gender covariate of type categorical model <- addCovariate(model, covariate = "Gender", type = "Categorical", effect = c("V2", "Cl2"), levels = c(0, 1), labels = c("Female", "Male")) # Add Bodyweight covariate of type continuous model <- addCovariate(model, covariate = "BodyWeight", type = "Continuous", direction = "Backward", center = "Mean", effect = c("V", "Cl")) # Define the host host <- hostParams(parallelMethod = "None", hostName = "local", numCores = 1) # Define the engine parameters params <- engineParams(model) # Define covariate model cp <- covariateModel(model) # Perform shotgun search OverallDF <- shotgunSearch(model = model, hostPlatform = host, params = params, covariateModel = cp, runInBackground = FALSE)
Executes an NLME simulation
simmodel( model, simParams, params, hostPlatform = NULL, runInBackground = FALSE, ... )
simmodel( model, simParams, params, hostPlatform = NULL, runInBackground = FALSE, ... )
model |
PK/PD model class object. |
simParams |
Simulation parameters. See |
params |
Engine parameters. See |
hostPlatform |
Host definition for model execution. See |
runInBackground |
Set to |
... |
Additional class initializer arguments for |
returns job properties if runInBackground is TRUE
;
if runInBackground is FALSE
and the function is called in interactive mode,
the resulted simulated tables wil be loaded and presented as a list;
if runInBackground is FALSE
and the function is called in non-interactive mode,
the list returned will have just the full paths of the tables generated.
SimTableObs <- tableParams( name = "SimTableObs.csv", timesList = "0,1,2,4,4.9,55.1,56,57,59,60", variablesList = "C, CObs", timeAfterDose = FALSE, forSimulation = TRUE ) simParams <- NlmeSimulationParams( numReplicates = 2, simulationTables = SimTableObs ) # Define the model model <- pkmodel( numComp = 2, absorption = "Extravascular", ID = "Subject", Time = "Act_Time", CObs = "Conc", Aa = "Amount", data = pkData, modelName = "PkModel" ) results <- simmodel(model, simParams) # with seed given additionally: results <- simmodel(model, simParams, seed = 3527)
SimTableObs <- tableParams( name = "SimTableObs.csv", timesList = "0,1,2,4,4.9,55.1,56,57,59,60", variablesList = "C, CObs", timeAfterDose = FALSE, forSimulation = TRUE ) simParams <- NlmeSimulationParams( numReplicates = 2, simulationTables = SimTableObs ) # Define the model model <- pkmodel( numComp = 2, absorption = "Extravascular", ID = "Subject", Time = "Act_Time", CObs = "Conc", Aa = "Amount", data = pkData, modelName = "PkModel" ) results <- simmodel(model, simParams) # with seed given additionally: results <- simmodel(model, simParams, seed = 3527)
Executes an NLME simple estimation with sort keys and given scenarios
sortfit( model, hostPlatform = NULL, params, sortColumns, scenarios = list(), simpleTables, runInBackground = FALSE, filesToReturn = "*", ... )
sortfit( model, hostPlatform = NULL, params, sortColumns, scenarios = list(), simpleTables, runInBackground = FALSE, filesToReturn = "*", ... )
model |
PK/PD model class object. |
hostPlatform |
Host definition for model execution. See |
params |
Engine parameters. See |
sortColumns |
List of sort columns. See |
scenarios |
List of scenarios with different sets of covariates.
See |
simpleTables |
Optional list of simple tables. See
|
runInBackground |
Set to |
filesToReturn |
Used to specify which files to be outputted to the model directory
and loaded as returned value. By default, all the applicable files listed
in the |
... |
Additional arguments for |
All the results in tabular format have scenario column and sorts columns appended. The resulted logs (nlme7engine.log, err1.txt, dmp.txt, out.txt) are appended with a row delimiter where the name of the Scenario and sort values are specified.
if runInBackground
is FALSE
, a list with main
resulted dataframes is returned:
Overall
ConvergenceData
residuals
Secondary
StrCovariate - if continuous covariates presented
StrCovariateCat - if categorical covariates presented
theta
posthoc table
posthocStacked table
Requested tables
nlme7engine.log
textual output is returned and loaded with the main information related to
fitting. dmp.txt
structure with the results of fitting (including LL by subject information)
is returned and loaded. These 2 files are returned and loaded irrespective of
filesToReturn
argument value.
For individual models, additional dataframe with partial derivatives is returned:
ParDer
For population models and the method specified is NOT Naive-Pooled
,
additional dataframes are returned:
omega
Eta
EtaStacked
EtaEta
EtaCov
EtaCovariate - if continuous covariates presented
EtaCovariateCat - if categorical covariates presented
bluptable.dat
If standard error computation was requested and it was successful, additional dataframes are returned:
thetaCorrelation
thetaCovariance
Covariance
omega_stderr
If nonparametric method was requested (numIterNonParametric
> 0) and
the method
specified in engineParams
is NOT Naive-Pooled
,
additional dataframes are returned:
nonParSupportResult
nonParStackedResult
nonParEtaResult
nonParOverallResult
if runInBackground
is TRUE
, only current status of job is returned.
The non-loaded but returned files in the model working directory are:
err1.txt - concatenated for all runs detailed logs for all steps of optimization,
out.txt - general pivoted information about results,
doses.csv - information about doses given for all subjects,
iniest.csv - information about initial estimates
hostParams, engineParams, SortColumns,
NlmeScenario, tableParams
input_data <- pkData model <- pkmodel(numCompartments = 2, data = input_data, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc") model <- addCovariate(model, covariate = "BodyWeight", direction = "Backward", center = "Mean", effect = c("V", "Cl")) # multicore multicoreHost <- hostParams(parallelMethod = "Multicore", hostName = "multicore", numCores = 4) # specify scenarios CovariateEffectNames <- listCovariateEffectNames(model) combinations <- combn(c("", CovariateEffectNames), length(CovariateEffectNames), simplify = FALSE) scenarioNames <- lapply(combinations, function(x) {paste(x, collapse = " ")}) scenarios <- lapply(scenarioNames, function(x, CovariateEffectNames) { CovariateCombinations <- unlist(strsplit(x, " ", fixed = TRUE)) scenarioIndex <- paste(which(CovariateEffectNames %in% CovariateCombinations, arr.ind = TRUE), collapse = ", ") NlmeScenario(trimws(x), scenarioIndex) }, CovariateEffectNames) res <- sortfit(model, hostPlatform = multicoreHost, params = engineParams(model), sortColumns = SortColumns("Gender"), scenarios = scenarios)
input_data <- pkData model <- pkmodel(numCompartments = 2, data = input_data, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc") model <- addCovariate(model, covariate = "BodyWeight", direction = "Backward", center = "Mean", effect = c("V", "Cl")) # multicore multicoreHost <- hostParams(parallelMethod = "Multicore", hostName = "multicore", numCores = 4) # specify scenarios CovariateEffectNames <- listCovariateEffectNames(model) combinations <- combn(c("", CovariateEffectNames), length(CovariateEffectNames), simplify = FALSE) scenarioNames <- lapply(combinations, function(x) {paste(x, collapse = " ")}) scenarios <- lapply(scenarioNames, function(x, CovariateEffectNames) { CovariateCombinations <- unlist(strsplit(x, " ", fixed = TRUE)) scenarioIndex <- paste(which(CovariateEffectNames %in% CovariateCombinations, arr.ind = TRUE), collapse = ", ") NlmeScenario(trimws(x), scenarioIndex) }, CovariateEffectNames) res <- sortfit(model, hostPlatform = multicoreHost, params = engineParams(model), sortColumns = SortColumns("Gender"), scenarios = scenarios)
Executes an NLME stepwise covariate search
stepwiseSearch( model, hostPlatform = NULL, params, covariateModel, stepwiseParams, runInBackground = FALSE, ... )
stepwiseSearch( model, hostPlatform = NULL, params, covariateModel, stepwiseParams, runInBackground = FALSE, ... )
model |
PK/PD model class object. |
hostPlatform |
Host definition for model execution. See |
params |
Engine parameters. See |
covariateModel |
Covariate Effects Model providing the relationship
between covariates and structural parameters to test ( |
stepwiseParams |
Stepwise parameters defining decision tree.
See |
runInBackground |
Set to |
... |
Additional arguments for |
if runInBackground = FALSE
, a data frame is returned with
stepwise search results, i.e. "Overall" comma separated file.
Otherwise the StepwiseNlmeJob
class object is returned.
# Define the model model <- pkmodel(numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc") # Add Gender covariate of type categorical model <- addCovariate(model, covariate = "Gender", type = "Categorical", effect = c("V2", "Cl2"), levels = c(0, 1), labels = c("Female", "Male")) # Add Bodyweight covariate of type continuous model <- addCovariate(model, covariate = "BodyWeight", type = "Continuous", direction = "Backward", center = "Mean", effect = c("V", "Cl")) # Define the host defaultHost <- hostParams(parallelMethod = "None", hostName = "local", numCores = 1) # Define the engine parameters params <- engineParams(model) # Define covariate model cp <- covariateModel(model) # Define the stepwise parameters sp <- StepwiseParams(0.01, 0.001, "-2LL") # Perform stepwise search OverallDF <- stepwiseSearch(model = model, hostPlatform = defaultHost, params = params, covariateModel = cp, stepwiseParams = sp, runInBackground = FALSE)
# Define the model model <- pkmodel(numCompartments = 2, data = pkData, ID = "Subject", Time = "Act_Time", A1 = "Amount", CObs = "Conc") # Add Gender covariate of type categorical model <- addCovariate(model, covariate = "Gender", type = "Categorical", effect = c("V2", "Cl2"), levels = c(0, 1), labels = c("Female", "Male")) # Add Bodyweight covariate of type continuous model <- addCovariate(model, covariate = "BodyWeight", type = "Continuous", direction = "Backward", center = "Mean", effect = c("V", "Cl")) # Define the host defaultHost <- hostParams(parallelMethod = "None", hostName = "local", numCores = 1) # Define the engine parameters params <- engineParams(model) # Define covariate model cp <- covariateModel(model) # Define the stepwise parameters sp <- StepwiseParams(0.01, 0.001, "-2LL") # Perform stepwise search OverallDF <- stepwiseSearch(model = model, hostPlatform = defaultHost, params = params, covariateModel = cp, stepwiseParams = sp, runInBackground = FALSE)
Use to specify the relationship of the structural parameter with corresponding fixed effect, random effect, and covariate.
structuralParameter( .Object, paramName, fixedEffName = NULL, randomEffName = NULL, style = "LogNormal", hasRandomEffect = NULL )
structuralParameter( .Object, paramName, fixedEffName = NULL, randomEffName = NULL, style = "LogNormal", hasRandomEffect = NULL )
.Object |
Model object |
paramName |
Name of the structural parameter |
fixedEffName |
Name of the corresponding fixed effect |
randomEffName |
Name of the corresponding random effect; only applicable to population models. |
style |
Use to specify the relationship of the structural parameter with its corresponding fixed effect, random effect, and covariate, if exists.
|
hasRandomEffect |
Set to |
Modified NlmePmlModel
object
model <- pkindirectmodel( indirectType = "LimitedInhibition", isBuildup = FALSE, data = pkpdData, ID = "ID", Time = "Time", A1 = "Dose", CObs = "CObs", EObs = "EObs" ) # Change style of structural parameter "Imax" to "LogitNormal" # and rename fixed effect to "tvlogitImax" model <- structuralParameter(model, paramName = "Imax", style = "LogitNormal", fixedEffName = "tvlogitImax" ) # Remove random effect for structural parameter "IC50" model <- structuralParameter(model, paramName = "IC50", hasRandomEffect = FALSE )
model <- pkindirectmodel( indirectType = "LimitedInhibition", isBuildup = FALSE, data = pkpdData, ID = "ID", Time = "Time", A1 = "Dose", CObs = "CObs", EObs = "EObs" ) # Change style of structural parameter "Imax" to "LogitNormal" # and rename fixed effect to "tvlogitImax" model <- structuralParameter(model, paramName = "Imax", style = "LogitNormal", fixedEffName = "tvlogitImax" ) # Remove random effect for structural parameter "IC50" model <- structuralParameter(model, paramName = "IC50", hasRandomEffect = FALSE )
Returns character vector of structural parameter names for model object.
structuralParameterNames(model, omitEmpties = TRUE)
structuralParameterNames(model, omitEmpties = TRUE)
model |
Object of class |
omitEmpties |
Set to |
Character vector of structural parameter names defined in model
model <- pkemaxmodel(columnMap = FALSE) stparms <- structuralParameterNames(model)
model <- pkemaxmodel(columnMap = FALSE) stparms <- structuralParameterNames(model)
Wrapper around NlmeTableDef/NlmeSimTableDef-classes initializers.
tableParams( name = "", timesList = numeric(0), covrSet = "", whenDose = "", whenObs = "", variablesList = "", keepSource = FALSE, timeAfterDose = FALSE, IRES = FALSE, Weight = FALSE, IWRES = FALSE, mode = "all", forSimulation = FALSE )
tableParams( name = "", timesList = numeric(0), covrSet = "", whenDose = "", whenObs = "", variablesList = "", keepSource = FALSE, timeAfterDose = FALSE, IRES = FALSE, Weight = FALSE, IWRES = FALSE, mode = "all", forSimulation = FALSE )
name |
Name of the generated simulation file. |
timesList |
Numeric; Time values for simulation.
Applicable for time-based models only. Ignored when |
covrSet |
Character; Vector of covariate names. Simulation point is added
when the covariate value is set. See |
whenDose |
Character; Vector of dosing compartment names. Simulation point is added when the dose value is set. |
whenObs |
Character; String of observed variables names. Simulation point is added when the observation value is set. |
variablesList |
Character; List of variables from the model for simulation. |
keepSource |
Logical; Set to |
timeAfterDose |
Set to |
IRES |
Logical; Set to |
Weight |
Logical; Set to |
IWRES |
Logical; Set to |
mode |
Character; The mode of output. Options are Option |
forSimulation |
logical. Defining whether the table is for simulation
purposes or for postprocessing after fit. Default is |
NlmeTableDef
object if forSimulation
is FALSE
,
NlmeSimTableDef
object otherwise.
Table1 <- tableParams( name = "Table1.csv", timesList = seq(0, 24, 2), whenObs = c("CObs"), variablesList = "C", IRES = TRUE, IWRES = TRUE, Weight = TRUE) SimTable1 <- tableParams( name = "SimTable1.csv", variablesList = "CL, V", keepSource = TRUE, forSimulation = TRUE)
Table1 <- tableParams( name = "Table1.csv", timesList = seq(0, 24, 2), whenObs = c("CObs"), variablesList = "C", IRES = TRUE, IWRES = TRUE, Weight = TRUE) SimTable1 <- tableParams( name = "SimTable1.csv", variablesList = "CL, V", keepSource = TRUE, forSimulation = TRUE)
Use to create an empty model object and optionally supply location of .mdl file to initialize model with PML statements.
textualmodel(modelName = "", workingDir = "", data, mdl = NULL)
textualmodel(modelName = "", workingDir = "", data, mdl = NULL)
modelName |
Model name to create subdirectory for model output in current working directory. |
workingDir |
Working directory to run the model. Current working directory will be used if |
data |
Input dataset |
mdl |
File path specifying location of test.mdl file |
NlmePmlModel
object
model <- textualmodel(data = pkData)
model <- textualmodel(data = pkData)
Perform visual predictive check for NLME models
vpcmodel( model, vpcParams, params, hostPlatform = NULL, runInBackground = FALSE, ... )
vpcmodel( model, vpcParams, params, hostPlatform = NULL, runInBackground = FALSE, ... )
model |
PK/PD model class object. |
vpcParams |
VPC argument setup. See |
params |
Engine argument setup. See |
hostPlatform |
Host definition for model execution. See |
runInBackground |
Set to |
... |
Additional class initializer arguments for |
if runInBackground is TRUE
, it returns job properties.
Otherwise,
If the function is called in an interactive mode, the resulting simulated tables and summary statistics tables will be loaded and presented as a list;
If the function is called in a non-interactive mode, it returns the full paths of the tables generated
job <- fitmodel(model) # View estimation results print(job) finalModelVPC <- copyModel(model, acceptAllEffects = TRUE, modelName = "model_VPC") # View the model print(finalModelVPC) # Set up VPC arguments to have PRED outputted to simulation output dataset "predout.csv" vpcSetup <- NlmeVpcParams(outputPRED = TRUE) # Run VPC using the default host, default values for the relevant NLME engine arguments finalVPCJob <- vpcmodel(model = finalModelVPC, vpcParams = vpcSetup) # the same as: finalVPCJob <- vpcmodel(model = finalModelVPC, outputPRED = TRUE) # Observed dataset predcheck0.csv dt_ObsData <- finalVPCJob$predcheck0 # Simulation output dataset predout.csv dt_SimData <- finalVPCJob$predout # Add PRED from REPLICATE = 0 of simulation output dataset to observed input dataset dt_ObsData$PRED <- dt_SimData[REPLICATE == 0]$PRED # tidyvpc package VPC example: # library(tidyvpc) library(magrittr) # Create a regular VPC plot with binning method set to be "jenks" binned_VPC <- observed(dt_ObsData, x = IVAR, yobs = DV) %>% simulated(dt_SimData, ysim = DV) %>% binning(bin = "jenks") %>% vpcstats() plot_binned_VPC <- plot(binned_VPC) # Create a pcVPC plot with binning method set to be "jenks" binned_pcVPC <- observed(dt_ObsData, x = IVAR, yobs = DV) %>% simulated(dt_SimData, ysim = DV) %>% binning(bin = "jenks") %>% predcorrect(pred = PRED) %>% vpcstats() plot_binned_pcVPC <- plot(binned_pcVPC)
job <- fitmodel(model) # View estimation results print(job) finalModelVPC <- copyModel(model, acceptAllEffects = TRUE, modelName = "model_VPC") # View the model print(finalModelVPC) # Set up VPC arguments to have PRED outputted to simulation output dataset "predout.csv" vpcSetup <- NlmeVpcParams(outputPRED = TRUE) # Run VPC using the default host, default values for the relevant NLME engine arguments finalVPCJob <- vpcmodel(model = finalModelVPC, vpcParams = vpcSetup) # the same as: finalVPCJob <- vpcmodel(model = finalModelVPC, outputPRED = TRUE) # Observed dataset predcheck0.csv dt_ObsData <- finalVPCJob$predcheck0 # Simulation output dataset predout.csv dt_SimData <- finalVPCJob$predout # Add PRED from REPLICATE = 0 of simulation output dataset to observed input dataset dt_ObsData$PRED <- dt_SimData[REPLICATE == 0]$PRED # tidyvpc package VPC example: # library(tidyvpc) library(magrittr) # Create a regular VPC plot with binning method set to be "jenks" binned_VPC <- observed(dt_ObsData, x = IVAR, yobs = DV) %>% simulated(dt_SimData, ysim = DV) %>% binning(bin = "jenks") %>% vpcstats() plot_binned_VPC <- plot(binned_VPC) # Create a pcVPC plot with binning method set to be "jenks" binned_pcVPC <- observed(dt_ObsData, x = IVAR, yobs = DV) %>% simulated(dt_SimData, ysim = DV) %>% binning(bin = "jenks") %>% predcorrect(pred = PRED) %>% vpcstats() plot_binned_pcVPC <- plot(binned_pcVPC)