 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Hosmer Lemeshow table incorrectly reported probabilities?

 From Steven Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: Hosmer Lemeshow table incorrectly reported probabilities? Date Thu, 25 Aug 2011 20:11:43 -0400

```The probabilities that appear in the table are the upper boundaries of the probability groups, not the group averages. When you wonder how something is computed in Stata (note the correct spelling Statalist FAQ Section 8.2), check the "Methods and Formulas" section of the relevant manual entry, in this case the entry for "logistic postestimation".

Steve

On Aug 25, 2011, at 5:40 PM, Matthew Baldwin, MD wrote:

Dear Statlisters,

I created a logistic regression model that predicts mortality.  I am examining the model's calibration, and the predicted probabilities for quintiles of risk seem to be incorrectly calculated using STATA.

Using the code "gof, group(5), table" gives me the 5 groups used for the Hosmer-Lemeshow Chi squared test used to test model calibration and gives predicted probabilities (in this case, probability of death), observed and expected counts for both outcomes (deaths in this case), and totals for each group.

However, the expected probabilities that the "estat gof, group(5) table" code in STATA gives are different from the expected probabilities I calculate from the expected counts in the table itself. I am confused about this:

Logistic model for death2, goodness-of-fit test

(Table collapsed on quantiles of estimated probabilities)
+--------------------------------------------------------+
| Group |   Prob | Obs_1 | Exp_1 | Obs_0 | Exp_0 | Total |
|-------+--------+-------+-------+-------+-------+-------|
|     1 | 0.0958 |    15 |  20.1 |   296 | 290.9 |   311 |
|     2 | 0.1757 |    47 |  41.7 |   264 | 269.3 |   311 |
|     3 | 0.3006 |    66 |  73.3 |   245 | 237.7 |   311 |
|     4 | 0.4494 |   119 | 114.8 |   192 | 196.2 |   311 |
|     5 | 0.9328 |   183 | 180.2 |   127 | 129.8 |   310 |
+--------------------------------------------------------+

number of observations =      1554
number of groups =         5
Hosmer-Lemeshow chi2(3) =         3.46
Prob > chi2 =         0.3265

Here are my calculations for expected probabilities based on the table:

x (expected mortality)     y (observed mortality)
20.1/311 = 0.065           15/311 = 0.048
41.7/311 = 0.13            47/311 = 0.15
73.3/311 = 0.24            66/311 = 0.21
114.8/311 = 0.37           119/311 = 0.38
180.2/310 = 0.58           183/310 = 0.58

Can anyone explain how the expected probabilities in the table were derived?

Is the "gof, group(x) table" function in STATA reporting incorrect expected probabilities?

Thanks,

Matthew Baldwin, MD
Department of Pulmonary, Allergy, and Critical Care Medicine
New York Presbyterian Hospital
Columbia University College of Physicians and Surgeons

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```