examples/survModelData.R

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

Try the hypergsplines package in your browser

Any scripts or data that you put into this service are public.

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