-
Notifications
You must be signed in to change notification settings - Fork 1
/
model_builder.Rmd
36 lines (24 loc) · 2.42 KB
/
model_builder.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
title: 'Model Building'
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Model Building}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
***NOTE: This module is currently under active development and this documentation is a work in progress***
# Introduction
The model building module is constructed around the `{rxode2}` package. It allows you to load a base model from either the model catalog or a user-create file. Once loaded the user can modify a model (change the structure, parameter values, etc), make a copy, etc. You can upload a model in rxode2 format and also NONMEM format. The NONMEM file (control stream or listing output) will be converted after upload into rxode2 using the `{nonmem2rx}` package.
# Model catalog
The model catalog is built from the sources field of the configuration file. It can include the models from the `{nlmixr2lib}` model library. You can also include user defined files. If they are specified but not found, they will be skipped. Edit the MB yaml file to to alter this.
## User-defined models
User-defined models can be included in the catalog or uploaded into the app. These models can be specified in either NONMEM or rxode2 formats. For NONMEM models it can be a control stream (good), the listing output from an estimation (better), or the XML output from an estimation (best). To use an nlmixr2 model you simply need a function definition assigned to the object `my_fcn`. For examples see:
- `system.file(package="ruminate", "templates", "MB_model_rxode2.R")`
- `system.file(package="ruminate", "templates", "MB_model_NONMEM.ctl")`
Modules are specified in the `sources` section of the configuration file. The default configuration file will look in the working directory of the App for `user_model.R` and `user_model.ctl`. So if you have a rxode2 model you can name it `user_model.R` and place it in the app directory to be included in the catalog. Similarly if you have a NONMEM control stream you can name it `user_model.ctl`, and it will be included automatically. If these do not exist they will be skipped. You can create as many entries as you want.
# Configuration File
```{r echo=FALSE, message=FALSE, warning=FALSE, eval=TRUE, style="max-height: 100px;", comment=""}
library(ruminate)
#yaml= file.path(system.file(package="ruminate"), "templates", "MB.yaml")
cat(readLines(file.path(system.file(package="ruminate"), "templates", "MB.yaml")), sep="\n")
```