Description Usage Arguments Details Value References See Also Examples
The function produces a calibration plot and provides HosmerLemeshow goodness of fit test statistics.
1 2  plotCalibration(data, cOutcome, predRisk, groups, rangeaxis,
plottitle, xlabel, ylabel, filename, fileplot, plottype)

data 
Data frame or numeric matrix that includes the outcome and predictor variables. 
cOutcome 
Column number of the outcome variable. 
predRisk 
Vector of predicted risks of all individuals in the dataset. 
groups 
Number of groups considered in
HosmerLemeshow test. Specification of 
rangeaxis 
Range of xaxis and yaxis. Specification of 
plottitle 
Title of the plot. Specification of 
xlabel 
Label of xaxis Default. Specification of 
ylabel 
Label of yaxis. Specification of 
filename 
Name of the output file in which the calibration table is saved.
The file is saved as a txt file in the working directory. When no

fileplot 
Name of the file that contains the calibation plot.
The file is saved in the working directory in the format specified under 
plottype 
The format in which the plot is saved. Available formats are
wmf, emf, png, jpg, jpeg, bmp, tif, tiff, ps,
eps or pdf. Foe example, 
HosmerLemeshow test statistic is a measure of the fit of the model, comparing observed and predicted risks across subgroups of the population. The default number of groups is 10.
The function requires the outcome of interest and predicted risks of
all individuals. Predicted risks can be obtained from the
functions fitLogRegModel
and predRisk
or
be imported from other packages or methods.
The function creates a calibration plot and returns the following measures:
Chi_square 
Chi square value of HosmerLemeshow test 
df 
Degrees of freedom, which is 
p_value 
pvalue of HosmerLemeshow test for goodness of fit 
Hosmer DW, Hosmer T, Le Cessie S, Lemeshow S. A comparison of goodnessoffit tests for the logistic regression model. Stat Med 1997; 16:965980.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  # specify dataset with outcome and predictor variables
data(ExampleData)
# specify column number of the outcome variable
cOutcome < 2
# fit a logistic regression model
# all steps needed to construct a logistic regression model are written in a function
# called 'ExampleModels', which is described on page 45
riskmodel < ExampleModels()$riskModel2
# obtain predicted risks
predRisk < predRisk(riskmodel)
# specify range of xaxis and yaxis
rangeaxis < c(0,1)
# specify number of groups for HosmerLemeshow test
groups < 10
# compute calibration measures and produce calibration plot
plotCalibration(data=ExampleData, cOutcome=cOutcome, predRisk=predRisk,
groups=groups, rangeaxis=rangeaxis)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.