# NOT RUN {
catModel <- inlineModel("
[LONGITUDINAL]
input = {a,b}
EQUATION:
lp1=a-b*t
lp2=a-b*t/2
DEFINITION:
y = {type=categorical, categories={1,2,3},
logit(P(y<=1))=lp1, logit(P(y<=2))=lp2}
")
y.out <- list(name='y', time=seq(0, 100, by=4))
Ng <- 1000
g1 <- list(size=Ng, parameter=c(a=6,b=0.2))
res <- simulx(model=catModel, output=y.out, group=g1)
catplotmlx(res$y)
catplotmlx(res$y, breaks=seq(-2,102,by=8), color="purple")
catplotmlx(res$y, breaks=5, color="#490917")
g2 <- list(size=Ng, parameter=c(a=10,b=0.2))
res <- simulx(model=catModel, output=y.out, group=list(g1,g2))
catplotmlx(res$y)
catplotmlx(res$y, group="none")
g3 <- list(size=Ng, parameter=c(a=6,b=0.4))
g4 <- list(size=Ng, parameter=c(a=10,b=0.4))
res <- simulx(model=catModel, output=y.out, group=list(g1,g2,g3,g4))
catplotmlx(res$y)
cov <- data.frame(id=levels(res$y$id), a=rep(c(6,10,6,10),each=Ng),
b=rep(c(0.2,0.2,0.4,0.4),each=Ng))
catplotmlx(res$y, group=cov)
# }
Run the code above in your browser using DataLab