Learn R Programming

DynNom (version 4.1.1)

DynNom.cph: Dynamic Nomograms for Cox Proportional Hazards Models from the rms package

Description

DynNom.cph displays the results of a cph model object from rms package as a dynamic nomogram in an 'RStudio' panel or web browser.

Usage

DynNom.cph(model, data, clevel = 0.95, m.summary = c("raw", "formatted"),
                   covariate = c("slider", "numeric"), ptype = c("st", "1-st"))

Arguments

model

a cph model object which accepts a variety of transformation functions such as asis, pol, lsp, rcs, catg, scored, strat and matrx as defined in the rms package.

data

dataframe containing the accompanying data

clevel

confidence level required

m.summary

The option to choose the format of the model output in the 'Summary Model' tab. If "raw" (the default) is chosen the result of summary(model) will be display while if "formatted" is chosen the model summary using the stargazer package will be displayed.

covariate

The option to choose the type of covariate(s) input control widget for numeric values. If "slider" (the default) is chosen a shiny application with slider control widgets are used while if "numeric" is chosen numeric values input controls will be displayed.

ptype

If "st" (the default) is chosen, a plot of the estimated survivor function, S(t), is displayed. If "1-st" is chosen a plot of 1- S(t) is displayed.

Value

A dynamic nomogram in a shiny application which recognises all the predictors in the model and uses them to build a sidebar panel. It sets up drop down menus for factors and sliders set at the mean and bounded by the range for covariates.

The individual predictions with a relative confidence interval are calculated using the predict function, displaying graphically as either the Kaplan-Meier in the Estimated S(t) tab or the Predicted Survival tab. Table of individual predictions and model output are available in the Numerical Summary and Model Summary tabs, respectively.

See Also

cph, predict.cph, rms

Examples

Run this code
# NOT RUN {
# example 1
data = veteran
model1 <- cph((Surv(log(time), status)) ~ rcs(age, 4) * strat(trt) +
              diagtime * strat(prior) + lsp(karno, 60), data = veteran)
model1 <- update(model1, x = T, y = T, surv = T)
DynNom.cph(model1, data)
DynNom(model1, data, ptype = "1-st")

# example 2
data(lung)
sfit = Surv(lung$time, lung$status)
model2 <- cph(sfit ~ age + strat(sex) + ph.ecog , data = lung)
DynNom.cph(model2, lung)
# }
# NOT RUN {
if (interactive()) {
data.ovary <- ovarian
data.ovary$resid.ds <- as.factor(data.ovary$resid.ds)
levels(data.ovary$resid.ds) <- c("no", "yes")
data.ovary$rx <- as.factor(data.ovary$rx)
data.ovary$ecog.ps <- as.factor(data.ovary$ecog.ps)

model3 <- cph(Surv(futime, fustat) ~ age + resid.ds * rx + ecog.ps, data = data.ovary)
DynNom(model3, data.ovary)
}
# }

Run the code above in your browser using DataLab