Description Usage Arguments Value Author(s) Examples
Process the data needed for survival models
1 2 3 4 | survModelData(times, X, observed,
continuous = rep.int(TRUE, ncol(X)), nKnots = 4L,
splineType = "linear",
gPrior = HypergnPrior(a = 4, n = sum(observed)))
|
times |
the numeric vector of survival times |
X |
the numeric matrix of covariates (not including time) |
observed |
the logical vector of observation
indicators, |
continuous |
see |
nKnots |
see |
splineType |
see |
gPrior |
see |
a list with the internally needed results.
Daniel Sabanes Bove daniel.sabanesbove@ifspm.uzh.ch
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ## get some data
library(survival)
pbc <- na.omit(pbc)
pbc$sex <- as.numeric(pbc$sex == "f")
## try the function
md <- survModelData(times=pbc$time,
X=
as.matrix(subset(pbc,
select=
c(trt,
age,
sex,
ascites,
hepato,
spiders,
edema,
bili,
chol,
albumin,
copper,
alk.phos,
ast,
trig,
platelet,
protime,
stage))),
observed=
pbc$status == 2,
continuous=
c(FALSE,
TRUE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
FALSE),
nKnots=6L,
splineType="cubic",
gPrior="hyper-g/n")
## look at the results
str(md)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.