Discussion:
Hosmer-Lemeshow Code
(too old to reply)
Idahoe
2008-04-11 14:03:54 UTC
Permalink
I am testing a risk model that outputs an estimate of 1-year survival
(SHFM1). The observed 1-year outcomes are binary (out_365). I would
appreciate some help with the sas code, as I cannot find an example
online or in this group (only discussions of the model(s) ).
Currently, I have:

proc logistic data=newhl;
class shfm1 out_365;
model shfm1=out_365/lackfit;
run;

Is this correct? I am specifically looking for the HL GoF test, which
I beleive is "c" on the output.

Thanks,

Todd
Virtual SAS(r) Users Group
2008-04-11 14:49:39 UTC
Permalink
The Hosmer-Lemeshow Goodness of Fit Test is generated by the LACKFIT
option in the MODEL Statement.

The "C" statistic is automatically generated by PROC LOGISTIC and is
in the part of the output called "Association of Predicted
Probabilities and Observed Outcomes".

These two measures are NOT identical.

I am not sure what the CLASS statement is supposed to do for you in
the code sample you provided.

Also, if you are trying to implement a "survivial analysis," I am not
sure that logistic regression is the best tool to use.

SAS Press authors have written extensively about logitstic regression
and survival analysis using SAS Software.

See, for example:

Allison, Logistic Regression Using the SAS System
Allison, Survival Analysis Using the SAS System
Stokes, et. al., Categorical Data Analysis Using the SAS System

And, of course, there's the PROC LOGISTIC documentation chapter in the
SAS/STAT manual.

Hope this helps...

Andrew Karp
Sierra Information Services
www.SierraInformation.com
Post by Idahoe
I am testing a risk model that outputs an estimate of 1-year survival
(SHFM1). �The observed 1-year outcomes are binary (out_365). �I would
appreciate some help with the sas code, as I cannot find an example
online or in this group (only discussions of the model(s) ).
proc logistic data=newhl;
class shfm1 out_365;
model shfm1=out_365/lackfit;
run;
Is this correct? �I am specifically looking for the HL GoF test, which
I beleive is "c" on the output.
Thanks,
Todd
Wensui Liu
2008-04-11 14:14:18 UTC
Permalink
your syntax is correct to request HL goodness-of-fit test. However,
the result is not the "c" on the output. Instead, "c-statistics"
should refer to AUC (area under curve) in logistic reg.
Post by Idahoe
I am testing a risk model that outputs an estimate of 1-year survival
(SHFM1). The observed 1-year outcomes are binary (out_365). I would
appreciate some help with the sas code, as I cannot find an example
online or in this group (only discussions of the model(s) ).
proc logistic data=newhl;
class shfm1 out_365;
model shfm1=out_365/lackfit;
run;
Is this correct? I am specifically looking for the HL GoF test, which
I beleive is "c" on the output.
Thanks,
Todd
--
===============================
WenSui Liu
ChoicePoint Precision Marketing
Phone: 678-893-9457
Email : ***@choicepoint.com
Blog : statcompute.spaces.live.com
===============================
Idahoe
2008-04-11 15:43:09 UTC
Permalink
Thanks Wensui and Andrew,

I am not specifically assessing survival, rather a predictor of
survival.

New code:

proc logistic data=newhl;
model shfm1=out_365/ lackfit;
run;

At the bottom of the output, I see:

Association of Predicted Probabilities and Observed
Responses

Percent Concordant 24.5 Somers' D
0.170
Percent Discordant 7.5 Gamma
0.531
Percent Tied 68.0 Tau-
a 0.70
Pairs 95266
c 0.585

I do not see the 'c-statistic' in this list of associations, which
makes me think that I am not performing the analysis correctly.
However, other model-fit tests appear here indicating a lackfit-type
of procedure is being performed.
Peter Flom
2008-04-11 15:05:01 UTC
Permalink
This post might be inappropriate. Click to display it.
e***@gmail.com
2019-04-23 14:50:47 UTC
Permalink
Hy,

i had the same problem using HL test and SAS.
We should have 10 groups for the partition to realize the HL Test.

does someone knows how to change the number of groups for the HL test ?

thanks
Post by Peter Flom
Post by Idahoe
Is this correct? I am specifically looking for the HL GoF test, which
I beleive is "c" on the output.
This is quite confusing.
1. If the outcome is out_365, then the model statement is backwards, and should be
model out_365 = shfml;
2. In LOGISTIC, you do not need to identify the dependent variable on a CLASS statement.
3. The HL test in the output is not C but rather a table that will look something like this
Partition for the Hosmer and Lemeshow Test
SEX = 1 SEX = 2
Group Total Observed Expected Observed Expected
1 99 50 53.52 49 45.48
2 80 48 43.32 32 36.68
3 69 35 37.42 34 31.58
4 62 35 33.68 27 28.32
5 63 34 34.27 29 28.73
6 81 47 44.14 34 36.86
7 69 35 37.66 34 31.34
HTH
Peter
Statistical Consultant
www DOT peterflom DOT com
Tom White
2008-04-11 15:57:17 UTC
Permalink
Your 'c' statistic is on your output !

c=0.585

which is an indication that your model isn't all that good.

You want c as close to 1 as possible.

c=0.50 means just chance is going on in your model.

For real life applications I have seen c values around 0.65 to 0.70 or so.

T

----- Original Message -----
From: Idahoe
To: SAS-***@LISTSERV.UGA.EDU
Subject: Re: Hosmer-Lemeshow Code
Date: Fri, 11 Apr 2008 08:43:09 -0700


Thanks Wensui and Andrew,

I am not specifically assessing survival, rather a predictor of
survival.

New code:

proc logistic data=newhl;
model shfm1=out_365/ lackfit;
run;

At the bottom of the output, I see:

Association of Predicted Probabilities and Observed
Responses

Percent Concordant 24.5 Somers' D
0.170
Percent Discordant 7.5 Gamma
0.531
Percent Tied 68.0 Tau-
a 0.70
Pairs 95266
c 0.585

I do not see the 'c-statistic' in this list of associations, which
makes me think that I am not performing the analysis correctly.
However, other model-fit tests appear here indicating a lackfit-type
of procedure is being performed.


--
Want an e-mail address like mine?
Get a free e-mail account today at www.mail.com!
Loading...