HL_test: Hosmer-Lemeshow Goodness of Fit Test

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/HL_test.R

Description

The HL decile-of-risk test. Validity of the test assumes that the number of covariate patterns is close to the number of observations which is violated when many observations have the same covariate pattern and several ties will impact the required ordering and grouping (by deciles) of observations. This is less likely when there is at least one continuous covariate. Not valid for grouped data.

Usage

1
 HL_test(object, g = 10) 

Arguments

object

object of class 'lbreg'.

g

number of groups

Value

A list with elements

X2

HL statistic

pvalue

p-value for the test from Chi Squared with df = g-2

Author(s)

Bernardo B. Andrade

References

Hosmer D W, Lemeshow S 2000. Applied Logistic Regression. New York, USA: John Wiley and Sons.

See Also

lbreg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
require(lbreg)

# data preparation
data(PCS)
w <- PCS
w <- w[,-1]
w$race <- factor(w$race)
w$dpros <- factor(w$dpros)
w$dcaps <- factor(w$dcaps)

fm <- lbreg(tumor ~ ., data=w)

HL_test(fm)

Example output

   The Hosmer-Lemeshow Goodness-of-Fit Test 
$X2
[1] 28.89441

$pvalue
[1] 0.0003309147

$g
[1] 10

lbreg documentation built on Dec. 26, 2019, 5:06 p.m.