givitiCalibrationTestComp: Computation of the Calibration Test

Description Usage Arguments Details Value See Also Examples

Description

givitiCalibrationTestComp implements the computations necessary to perform the calibration test associated to the calibration belt.

Usage

1
givitiCalibrationTestComp(o, e, devel, thres, maxDeg)

Arguments

o

A numeric vector representing the binary outcomes. The elements must assume only the values 0 or 1. The predictions in e must represent the probability of the event coded as 1.

e

A numeric vector containing the probabilities of the model under evaluation. The elements must be numeric and between 0 and 1. The lenght of the vector must be equal to the length of the vector o.

devel

A character string specifying if the model has been fit on the same dataset under evaluation (internal) or if the model has been developed on an external sample (external). See also the 'Details' sections.

thres

A numeric scalar between 0 and 1 representing 1 - the significance level adopted in the forward selection.

maxDeg

The maximum degree considered in the forward selection.

Details

The calibration belt and the associated test can be used both to evaluate the calibration of the model in external samples or in the development dataset. However, the two cases have different requirements. When a model is evaluated on independent samples, the calibration belt and the related test can be applied whatever is the method used to fit the model. Conversely, they can be used on the development set only if the model is fitted with logistic regression.

Value

A list containing the following components:

data

A data.frame object with the numeric variables "o", "e" provided in the input and the variable "logite", the logit of the probabilities.

nrowOrigData

The size of the original sample, i.e. the length of the vectors e and o.

calibrationStat

The value of the test's statistic.

calibrationP

The p-value of the test.

m

The degree of the polynomial at the end of the forward selection.

fit

An object of class glm containig the output of the fit of the logistic regression model at the end of the iterative forward selection.

See Also

givitiCalibrationBelt and plot.givitiCalibrationBelt to compute and plot the calibaration belt, and givitiCalibrationTest to perform the associated calibration test.

Examples

1
2
3
e <- runif(100)
o <- rbinom(100, size = 1, prob = e)
givitiCalibrationTestComp(o, e, "external", .95, 4)

Example output

$data
              e o      logite
1   0.495019293 1 -0.01992349
2   0.169320821 1 -1.59044839
3   0.705934926 1  0.87572198
4   0.979975306 1  3.89056115
5   0.565766160 1  0.26459766
6   0.163194661 0 -1.63464775
7   0.153114408 0 -1.71038020
8   0.976261398 1  3.71662786
9   0.879703567 1  1.98962602
10  0.869412483 0  1.89577405
11  0.986041968 1  4.25764379
12  0.410256968 0 -0.36290319
13  0.369714908 1 -0.53344005
14  0.652865802 1  0.63166015
15  0.726628197 1  0.97758214
16  0.507214377 1  0.02885951
17  0.655931905 0  0.64521739
18  0.850994581 1  1.74242309
19  0.098393335 0 -2.21520528
20  0.412123868 1 -0.35519231
21  0.374381075 0 -0.51346724
22  0.383625545 0 -0.47418773
23  0.929234813 0  2.57499430
24  0.016760028 0 -4.07185642
25  0.882735308 1  2.01859169
26  0.959892736 1  3.17526407
27  0.765749070 0  1.18446164
28  0.518784210 0  0.07517222
29  0.454295172 0 -0.18333107
30  0.150267542 0 -1.73250422
31  0.560406429 1  0.24281169
32  0.558327363 0  0.23437649
33  0.936555065 1  2.69203595
34  0.873650697 1  1.93363032
35  0.574277726 0  0.29932593
36  0.077335989 0 -2.47910573
37  0.552221658 0  0.20965118
38  0.596427704 0  0.39060239
39  0.064843223 0 -2.66874179
40  0.915053684 1  2.37696325
41  0.138654007 0 -1.82651460
42  0.302930616 0 -0.83338116
43  0.365261880 1 -0.55259793
44  0.219769869 0 -1.26700797
45  0.924837242 0  2.50996190
46  0.262435526 0 -1.03334807
47  0.007287747 0 -4.91424647
48  0.720450895 1  0.94669930
49  0.230883295 0 -1.20333035
50  0.861323723 1  1.82632814
51  0.280145130 0 -0.94374183
52  0.904204116 1  2.24483541
53  0.814507270 1  1.47956766
54  0.817289742 1  1.49809206
55  0.308535830 0 -0.80697335
56  0.868619151 0  1.88880442
57  0.547823674 0  0.19188127
58  0.708975416 0  0.89041311
59  0.721067674 1  0.94976380
60  0.457691812 1 -0.16963839
61  0.705988898 1  0.87598199
62  0.976241869 1  3.71578555
63  0.999868306 1  8.93489679
64  0.704452494 0  0.86859131
65  0.917039665 1  2.40278813
66  0.363382811 1 -0.56071166
67  0.771429827 1  1.21640244
68  0.056575189 0 -2.81394613
69  0.602630336 0  0.41643697
70  0.169276374 0 -1.59076443
71  0.676489794 1  0.73768670
72  0.495846482 0 -0.01661445
73  0.509838765 1  0.03936014
74  0.046960325 0 -3.01035343
75  0.795929921 0  1.36104768
76  0.448818045 0 -0.20544742
77  0.907452172 1  2.28291529
78  0.022531349 0 -3.77005860
79  0.073544558 0 -2.53347449
80  0.471017294 0 -0.11606093
81  0.006415013 0 -5.04267851
82  0.337918202 0 -0.67258525
83  0.774887482 1  1.23611748
84  0.615308180 1  0.46968070
85  0.130199650 0 -1.89919466
86  0.014879010 0 -4.19281298
87  0.336177611 0 -0.68037500
88  0.655991149 1  0.64547991
89  0.724799212 0  0.96839370
90  0.559334246 0  0.23846057
91  0.566248456 1  0.26656106
92  0.420790713 1 -0.31952829
93  0.444589439 0 -0.22255634
94  0.402133611 1 -0.39658290
95  0.515722991 1  0.06291271
96  0.198841957 1 -1.39354791
97  0.945678829 1  2.85698897
98  0.737155917 1  1.03123841
99  0.457409251 1 -0.17077684
100 0.377452502 1 -0.50037519

$nrowOrigData
[1] 100

$calibrationStat
[1] 2.074375

$calibrationP
[1] 0.3544503

$m
[1] 1

$fit

Call:  glm(formula = fitFormula, family = binomial(link = "logit"), 
    data = data)

Coefficients:
(Intercept)  I(logite^1)  
    -0.2068       0.8008  

Degrees of Freedom: 99 Total (i.e. Null);  98 Residual
Null Deviance:	    138.6 
Residual Deviance: 107 	AIC: 111

givitiR documentation built on May 2, 2019, 10:58 a.m.