survModelData: Process the data needed for survival models

Description Usage Arguments Value Author(s) Examples

Description

Process the data needed for survival models

Usage

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)))

Arguments

times

the numeric vector of survival times

X

the numeric matrix of covariates (not including time)

observed

the logical vector of observation indicators, TRUE entries represent truly observed survival times, FALSE entries represent censored survival times.

continuous

see glmModelData for details

nKnots

see glmModelData for details

splineType

see glmModelData for details

gPrior

see glmModelData for details. Defaults to the hyper-g/n prior where n is chosen as the number of events, instead of the number of observations.

Value

a list with the internally needed results.

Author(s)

Daniel Sabanes Bove daniel.sabanesbove@ifspm.uzh.ch

Examples

 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)

hypergsplines documentation built on May 2, 2019, 6:14 p.m.