if (FALSE) {
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)
}
Run the code above in your browser using DataLab