Description Usage Arguments Details Value Examples
Plot the empirical distribution of categorical longitudinal data.
1 2 3 4 5 6 7 8 9 10 |
r |
a data frame with a column id, a column time, a column with values and possibly Hk[ja column group. |
col |
a vector of 3 column numbers: (id, time/x, y. Default = c(1, 2,3). |
breaks |
one of:
|
plot |
if |
color |
a color to be used for the plots (default="#194280") |
group |
variable to be used for defining groups (by default, group is used when it exists) |
facet |
makes subplots for different groups if |
labels |
vector of strings |
See http://simulx.webpopix.org/mlxr/catplotmlx/ for more details.
a ggplot object if plot=TRUE
; otherwise, a list with fields:
color a vector of colors used for the plot
y a data frame with the values of the empirical distribution computed at each time point
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 | ## 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)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.