Skip to contents

Checks the calibration of a nomogram for a survey-weighted Cox model.

Usage

svycox.calibrate(.nom, .timept = .nom$pred.at, .ngroup = 5)

Arguments

.nom

a nomogram object from svycox.nomogram

.timept

the time point at which calibration will take place; defaults to the time value of the prediction axis in the nomogram

.ngroup

number of groups to be formed for validation purposes

Value

returns a matrix of calibration values and plots them

Author

Mithat Gonen, Marinela Capanu

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/.

Examples

library(survey)
#> Loading required package: grid
#> Loading required package: Matrix
#> Loading required package: survival
#> 
#> Attaching package: ‘survey’
#> The following object is masked from ‘package:graphics’:
#> 
#>     dotchart
library(rms)
#> Loading required package: Hmisc
#> Loading required package: lattice
#> Loading required package: Formula
#> Loading required package: ggplot2
#> 
#> Attaching package: ‘Hmisc’
#> The following object is masked from ‘package:survey’:
#> 
#>     deff
#> The following objects are masked from ‘package:base’:
#> 
#>     format.pval, units
#> Loading required package: SparseM
#> 
#> Attaching package: ‘SparseM’
#> The following object is masked from ‘package:base’:
#> 
#>     backsolve
#> 
#> Attaching package: ‘rms’
#> The following object is masked from ‘package:survey’:
#> 
#>     calibrate
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=)

svycox.calibrate(mynom)
#> Error in which(.nom$preds[[1]]$time <= .timept): object 'mynom' not found