simulx | R Documentation |
Compute predictions and sample data from Mlxtran
and R
models
simulx(
model = NULL,
parameter = NULL,
covariate = NULL,
output = NULL,
treatment = NULL,
regressor = NULL,
occasion = NULL,
varlevel = NULL,
group = NULL,
project = NULL,
nrep = 1,
npop = NULL,
fim = NULL,
saveSmlxProject = NULL,
result.file = NULL,
addlines = NULL,
settings = NULL
)
model |
a |
parameter |
One of
|
covariate |
One of
|
output |
output or list of outputs. An output can be defined by
|
treatment |
treatment or list of treatments. A treatment can be defined by
|
regressor |
treatment or list of treatments. A treatment can be defined by
|
occasion |
An occasion can be defined by
|
varlevel |
deprecated, use occasion instead. |
group |
a list, or a list of lists, with fields:
"level" field is not supported anymore in RsSimulx. |
project |
the name of a Monolix project |
nrep |
Samples with or without uncertainty depending which element is given as "parameter". |
npop |
deprecated, Set parameter = "mlx_popUncertainSA" or "mlx_popUncertainLin" instead. |
fim |
deprecated, Set parameter = "mlx_popUncertainSA" or "mlx_popUncertainLin" instead. |
saveSmlxProject |
If specified, smlx project will be save in the path location (by default smlx project is not saved) |
result.file |
deprecated |
addlines |
a list with fields:
"section", "block" field are not supported anymore in RsSimulx. You only need to specify a formula. The additional lines will be added in a new section EQUATION. |
settings |
a list of optional settings
|
simulx takes advantage of the modularity of hierarchical models for simulating different components of a model: models for population parameters, individual covariates, individual parameters and longitudinal data.
Furthermore, simulx
allows to draw different types of longitudinal data,
including continuous, count, categorical, and time-to-event data.
The models are encoded using either the model coding language ‘Mlxtran’. ‘Mlxtran’ models are automatically converted into C++ codes, compiled on the fly and linked to R using the ‘RJSONIO’ package. That allows one to implement very easily complex models and to take advantage of the numerical sovers used by the C++ ‘mlxLibrary’.
See http://simulx.lixoft.com for more details.
A list of data frames. Each data frame is an output of simulx
## Not run:
myModel <- inlineModel("
[LONGITUDINAL]
input = {A, k, c, a}
EQUATION:
t0 = 0
f_0 = A
ddt_f = -k*f/(c+f)
DEFINITION:
y = {distribution=normal, prediction=f, sd=a}
[INDIVIDUAL]
input = {k_pop, omega}
DEFINITION:
k = {distribution=lognormal, prediction=k_pop, sd=omega}
")
f <- list(name='f', time=seq(0, 30, by=0.1))
y <- list(name='y', time=seq(0, 30, by=2))
parameter <- c(A=100, k_pop=6, omega=0.3, c=10, a=2)
res <- simulx(model = myModel,
parameter = parameter,
occasion = data.frame(time=c(0, 0), occ=c(1, 2)),
output = list(f,y),
group = list(size=4),
saveSmlxProject = "./project.smlx")
res <- simulx(model = myModel,
parameter = parameter,
occasion = data.frame(time = c(0, 0, 0, 0),
occ1 = c(1, 1, 2, 2),
occ2 = c(1, 2, 3, 4)),
output = list(f,y),
group = list(size=4))
res <- simulx(model = myModel,
parameter = parameter,
output = list(f,y),
group = list(size=4))
plot(ggplotmlx() + geom_line(data=res$f, aes(x=time, y=f, colour=id)) +
geom_point(data=res$y, aes(x=time, y=y, colour=id)))
print(res$parameter)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.