-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
79 lines (65 loc) · 2.56 KB
/
README.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# nlmixr2plot: The core estimation routines for nlmixr2
<!-- badges: start -->
[](https://github.com/nlmixr2/nlmixr2plot/actions/workflows/R-CMD-check.yaml)
[](https://www.codefactor.io/repository/github/nlmixr2/nlmixr2plot)
[](https://CRAN.R-project.org/package=nlmixr2plot)
[](https://cran.r-project.org/package=nlmixr2plot)
[](https://cran.r-project.org/package=nlmixr2plot)
[](https://app.codecov.io/gh/nlmixr2/nlmixr2plot)
<!-- badges: end -->
The goal of nlmixr2plot is to provide the nlmixr2 core estimation routines.
## Installation
You can install the development version of nlmixr2plot from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("nlmixr2/nlmixr2data")
remotes::install_github("nlmixr2/lotri")
remotes::install_github("nlmixr2/rxode2")
remotes::install_github("nlmixr2/nlmixr2est")
remotes::install_github("nlmixr2/nlmixr2extra")
remotes::install_github("nlmixr2/nlmixr2plot")
```
For most people, using nlmixr2 directly would be likely easier.
```{r example}
library(nlmixr2est)
library(nlmixr2plot)
## The basic model consists of an ini block that has initial estimates
one.compartment <- function() {
ini({
tka <- 0.45 ; label("Log Ka")
tcl <- 1 ; label("Log Cl")
tv <- 3.45 ; label("Log V")
eta.ka ~ 0.6
eta.cl ~ 0.3
eta.v ~ 0.1
add.sd <- 0.7
})
# and a model block with the error specification and model specification
model({
ka <- exp(tka + eta.ka)
cl <- exp(tcl + eta.cl)
v <- exp(tv + eta.v)
d/dt(depot) = -ka * depot
d/dt(center) = ka * depot - cl / v * center
cp = center / v
cp ~ add(add.sd)
})
}
## The fit is performed by the function nlmixr/nlmix2 specifying the model, data and estimate
fit <- nlmixr2(one.compartment, theo_sd, est="saem", saemControl(print=0))
print(fit)
# this now gives the goodness of fit plots
plot(fit)
```