Skip to contents

Builds a nomogram for a survey-weighted Cox model.

Usage

svycox.nomogram(.design, .model, .data, pred.at, fun.lab)

Arguments

.design

represents a survey design object obtained with the package "survey"

.model

indicates a Cox model specification

.data

contains the data on which the model is to be fit (can not contain NAs)

pred.at

specifies the time point at which the nomogram prediction axis will be drawn

fun.lab

designate the label of the prediction axis

Details

In addition to the inputs, this function expects the following: 1) the input dataset (.data) cannot contain NAs. You can accomplish this using the na.omit function. See example. 2) datadist must be set. See examples and the documentation for the rms package. 3) survey design must have been saved in .design All of these requirements are explained in Capanu & Gonen (2015) in detail

Value

A list including elements

nomog

A nomogram object

preds

predicted values from the model

In addition to what is listed below, the design and the fitted survey weighted Cox model (svy.cox), as well as the timepoint at which the nomogram prediction axis will be drawn (pred.at) are stored

References

Marinela Capanu, Mithat Gonen (2015). Building a Nomogram for Survey-Weighted Cox Models Using R. Journal of Statistical Software, Code Snippets, 64(1), 1-17. URL https://www.jstatsoft.org/v64/c01/.

Author

Mithat Gonen, Marinela Capanu

Examples

library(survey)
library(rms)
data(noNA)
dd=datadist(noNA)
options(datadist="dd")
dstr2=svydesign(id=~1, strata=~group, prob=~inv_weight, fpc=~ssize, data=noNA)
mynom=svycox.nomogram(.design=dstr2, .model=Surv(survival,surv_cens)~ECOG+liver_only+Alb+Hb+Age+
Differentiation+Gt_1_m1site+lymph_only, .data=noNA, pred.at=24, fun.lab="Prob of 2 Yr OS")
#> Error in Design(X, formula = formula): dataset dd not found for options(datadist=)
plot(mynom$nomog)
#> Error in plot(mynom$nomog): object 'mynom' not found