kmplotmlx | R Documentation |
Plot empirical survival functions using the Kaplan Meier estimate.
kmplotmlx(
r,
index = 1,
level = NULL,
time = NULL,
cens = TRUE,
plot = TRUE,
color = "#e05969",
group = NULL,
facet = TRUE,
labels = NULL
)
r |
a data frame with a column ‘id’, a column ‘time’, a column with values and possibly a column ‘group’. |
index |
an integer: |
level |
a number between 0 and 1: confidence interval level. |
time |
a vector of time points where the survival function is evaluated. |
cens |
if |
plot |
if |
color |
color to be used for the plots (default="#e05969") |
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/kmplotmlx/ for more details.
a ggplot object if plot=TRUE
; otherwise, a list with fields:
surv
a data frame with columns T
(time), S
(survival), possibly (S1, S2)
(confidence interval) and possibly group
cens
a data frame with columns T0
(time), S0
(survival) and possibly group
## Not run:
tteModel1 <- inlineModel("
[LONGITUDINAL]
input = {beta,lambda}
EQUATION:
h=(beta/lambda)*(t/lambda)^(beta-1)
DEFINITION:
e = {type=event, maxEventNumber=1, rightCensoringTime=70, hazard=h}
")
p1 <- c(beta=2.5,lambda=50)
e <- list(name='e', time=0)
res1 <- simulx(model=tteModel1, parameter=p1, output=e, group=list(size=100))
pl1 <- kmplotmlx(res1$e,level=0.95)
print(pl1)
p2 <- c(beta=2,lambda=45)
g1 <- list(size=50, parameter=p1)
g2 <- list(size=100, parameter=p2)
res2 <- simulx(model=tteModel1, output=e, group=list(g1,g2))
pl2 <- kmplotmlx(res2$e)
print(pl2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.