## Overview

With the release of Pirana 21.12.1 in December of 2021, users can launch Certara.ModelResults directly from Pirana by selecting one or more executed NLME or NONMEM models from the Pirana GUI.

For Pirana 3.0 and previous versions, users can initialize Model Results directly from RStudio by first creating the xpdb object from the Pirana model output folder. This xpdb object can be supplied to the xpdb argument to launch Model Results (e.g., resultsUI(xpdb = xpdb)).

## RsNLME

### Pirana Setup

After executing one or more RsNLME models (.mmdl) from Pirana, identify the Project Folder and Model Names to be used with Model Results. This information is required to create the xpdb objects in R and initialize Model Results.

Here, we will be using the following model file names: run1, run2, and run3, in the Project Folder located at ~/Documents/Pirana_Testing/NLME/

### Create xpdb object in R

The xpdb argument in resultsUI() can be supplied as a single xpdb object or a list of xpdb objects.

Since we are using RsNLME with Pirana (.mmdl), we will need to use the xposeNlme() function from the Certara.Xpose.NLME package to generate our xpdb object in R. We will supply the name of our model to the argument modelName and the NLME model output directory to the dir argument.

#### Single model

library(Certara.Xpose.NLME)

xpdb <- xposeNlme(modelName = "run1", dir = "~/Documents/Pirana_Testing/NLME/nlme_fitmodel_001")
library(Certara.ModelResults)

resultsUI(xpdb = xpdb)

#### Multiple models

To create a list of xpdb objects, we’ll use the same command as above, except create the xpdb objects as elements in a list. Each xpdb object in the list represents a different model name, so we’ll need to specify the corresponding modelName and dir arguments for each model in our list.

library(Certara.Xpose.NLME)

xpdb_multiple <- list(run1 =  xposeNlme(modelName = "run1", dir = "~/Documents/Pirana_Testing/NLME/nlme_fitmodel_001"),
run2 =  xposeNlme(modelName = "run2", dir = "~/Documents/Pirana_Testing/NLME/nlme_fitmodel_002"),
run3 =  xposeNlme(modelName = "run3", dir = "~/Documents/Pirana_Testing/NLME/nlme_fitmodel_003"),
)

We can now use our list of xpdb objects, which we assigned to the value xpdb_multiple, as our input for the xpdb argument used to launch Model Results.

library(Certara.ModelResults)

resultsUI(xpdb = xpdb_multiple)

## NONMEM

### Pirana Setup

After executing one or more NONMEM models in Pirana, identify the Project Folder and Model Names to be used with Model Results. This information is required to create the xpdb objects in R and initialize Model Results.

Here, we will be using the following model file names: run1, run2, run3, and run5 in the Project Folder located at ~/Documents/Pirana_Testing/NONMEM/Hands_onB

Note: NONMEM files used in this example are available here.

### Create xpdb object in R

Note: RsNLME users should use the xposeNlme() function from the Certara.Xpose.NLME package to generate the xpdb object.

To initialize the Certara.ModelResults Shiny GUI, we must first create our xpdb object in R. Since we are working with NONMEM model output files in this example, we’ll use the xpose_data() function from the xpose package to generate our xpdb object.

We will use the runno argument to specify the run number of one of our model file names identified above. We will use the default values prefix = "run" and ext = ".lst". Finally, we must supply the path of our Pirana Project Folder to the dir argument below. For further details, see ?xpose::xpose_data.

#### Single model

library(xpose)

xpdb <- xpose_data(runno = "1", prefix = "run", ext = ".lst", dir = "~/Documents/Pirana_Testing/NONMEM/Hands_onB/")
library(Certara.ModelResults)

resultsUI(xpdb = xpdb)

#### Multiple models

The xpdb argument in resultsUI() can be supplied as a single xpdb object or a list of xpdb objects.

To create a list of xpdb objects, we’ll use the same command as above, except create the xpdb objects as elements in a list. Each xpdb object in the list represents a different model run number, so the only argument we’ll be changing in the xpose_data() functions shown below is the runno.

library(xpose)

xpdb_multiple <- list(run1 = xpose_data(runno = "1", prefix = "run", ext = ".lst", dir ="~/Documents/Pirana_Testing/NONMEM/Hands_onB/"),
run2 = xpose_data(runno = "2", prefix = "run", ext = ".lst", dir ="~/Documents/Pirana_Testing/NONMEM/Hands_onB/"),
run3 = xpose_data(runno = "3", prefix = "run", ext = ".lst", dir ="~/Documents/Pirana_Testing/NONMEM/Hands_onB/"),
run5 = xpose_data(runno = "5", prefix = "run", ext = ".lst", dir ="~/Documents/Pirana_Testing/NONMEM/Hands_onB/")
)

We can now use our list of xpdb objects, which we assigned to the value xpdb_multiple, as our input for the xpdb argument used to launch Model Results.

library(Certara.ModelResults)

resultsUI(xpdb = xpdb_multiple)

All model runs from Pirana are available in Model Results.