Select Page

# Monolix API

## On the use of a R-usable API

We now propose to use Monolix via an API.  It is possible to have access to the project exactly in the same way as you would do with the interface. All the functions are described below.

### Installation and initialization

#### Installation

The R package is located in the installation directory as tar.gz ball. It must be installed with the following R command:

install.packages('<installDirectory>/mlxConnectors/R/MlxConnectors.tar.gz', repos = NULL, type="source")

with <installDirectory> the MonolixSuite2018R1 installation directory. By default, it is

• “C:/ProgramData/Lixoft/MonolixSuite2018R1” for Windows OS
• “/Applications/MonolixSuite2018R1.app/Contents/Resources/mlxsuite/” for MAC OS

#### Initializing

When starting a new R session, you need to load the library and initialize the connectors with the following commands

library(MlxConnectors)
initializeMlxConnectors(software = "monolix")



#### Making sure the installation is ok

To test if the installation is ok, you can load and run a project from the demos as on the following:

demoPath = '<userFolder>/lixoft/monolix/monolix2018R1/demos/1.creating_and_using_models/'
runScenario()
getEstimatedPopulationParameters()

where <userFolder> is the user’s home folder (on windows C:/Users/toto if toto is your username). These three commands should output the estimated population parameters (ka_pop, V_pop, Cl_pop, omega_ka, omega_V, omega_Cl, a, and b).

#### Notes

• Due to possible conflicts, the package mlxR, whose function simulx can be used to perform simulations with Monolix, should not be loaded at the same time as MlxConnectors.
• Running the plots task with the API saves the charts data in the result folder, if “Export charts data” is selected in Monolix’s preferences. The plots can only be generated with the Monolix GUI.

### Description of the functions concerning the observation model

• getContinuousObservationModel: Get a summary of the information concerning the continuous observation models in the project.
• getObservationInformation: Get the name, the type and the values of the observations present in the project.
• setAutocorrelation: Add or remove auto-correlation from the error model used on some of the observation models.
• setErrorModel: Set the error model type to be used with some of the observation models.
• setObservationDistribution: Set the distribution in the Gaussian space of some of the observation models.
• setObservationLimits: Set the minimum and the maximum values between which some of the observations can be found.

### Description of the functions concerning the population parameters

• getPopulationParameterInformation: Get the name, the initial value, the estimation method and, if relevant, MAP parameters value of the population parameters present in the project.
• setInitialEstimatesToLastEstimates: Set the initial value of all the population parameters present within the current project (fixed effects + individual variances + error model parameters) to the ones previously estimated.
• setPopulationParameterInformation: Set the initial value, the estimation method and, if relevant, the MAP parameters of one or several of the population parameters present within the current project (fixed effects + individual variances + error model parameters).

### Description of the functions concerning the project management

• getData: Get a description of the data used in the current project.
• getStructuralModel: Get the model file for the structural model used in the current project.
• loadProject: Load a project by parsing the mlxtran-formated file whose path has been given as an input.
• newProject: Create a new empty project providing model and data specification.
• saveProject: Save the current project as an Mlxtran-formated file.
• setData: Set project data giving a data file and specifying headers and observations types.
• setStructuralModel: Set the structural model.

### Description of the functions concerning the results

• getCorrelationOfEstimates: Get the inverse of the last estimated Fisher matrix computed either by all the Fisher methods used during the last scenario run or by the specific one passed in argument.
• getEstimatedIndividualParameters: Get the last estimated values for each subject of some of the individual parameters present within the current project.
• getEstimatedLogLikelihood: Get the values computed by using a log-likelihood algorithm during the last scenario run, with or without a method-based filter.
• getEstimatedPopulationParameters: Get the last estimated value of some of the population parameters present within the current project (fixed effects + individual variances + correlations + latent probabilities + error model parameters).
• getEstimatedRandomEffects: Get the random effects for each subject of some of the individual parameters present within the current project.
• getEstimatedStandardErrors: Get the last estimated standard errors of population parameters computed either by all the Fisher methods used during the last scenario run or by the specific one passed in argument.
• getLaunchedTasks: Get a list of the tasks which have results to provide.
• getSAEMiterations: Retrieve the successive values of some of the population parameters present within the current project (fixed effects + individual variances + correlations + latent probabilities + error model parameters) during the previous run of the SAEM algorithm.
• getSimulatedIndividualParameters: Get the simulated values for each replicate of each subject of some of the individual parameters present within the current project.
• getSimulatedRandomEffects: Get the simulated values for each replicate of each subject of some of the individual random effects present within the current project.