[R] logit postestimation -- Postestimation tools for logit
Description
The following postestimation commands are of special interest after logit:
Command Description
---------------------------------------------------------------------------------------
estat classification report various summary statistics, including the classification
table
estat gof Pearson or Hosmer-Lemeshow goodness-of-fit test
[R] estat gof -- Pearson or Hosmer-Lemeshow goodness-of-fit test
Syntax
estat gof [if] [in] [weight] [, options]
gof_options Description
---------------------------------------------------------------------------------------
Main
group(#) perform Hosmer-Lemeshow goodness-of-fit test using # quantiles
all execute test for all observations in the data
outsample adjust degrees of freedom for samples outside estimation sample
table display table of groups used for test
---------------------------------------------------------------------------------------
fweights are allowed; see weight.
estat gof is not appropriate after the svy prefix.
Menu for estat
Statistics > Postestimation > Reports and statistics
Description
estat gof reports the Pearson goodness-of-fit test or the Hosmer-Lemeshow
goodness-of-fit test.
estat gof requires that the current estimation results be from logistic, logit, or
probit. For estat gof after poisson, see [R] poisson postestimation. For estat gof
after sem, see [SEM] estat gof.
Options
+------+
----+ Main +---------------------------------------------------------------------------
group(#) specifies the number of quantiles to be used to group the data for the
Hosmer-Lemeshow goodness-of-fit test. group(10) is typically specified. If this
option is not given, the Pearson goodness-of-fit test is computed using the
covariate patterns in the data as groups.
all requests that the statistic be computed for all observations in the data, ignoring
any if or in restrictions specified by the estimation command.
outsample adjusts the degrees of freedom for the Pearson and Hosmer-Lemeshow
goodness-of-fit tests for samples outside the estimation sample. See Samples other
than the estimation sample in [R] estat gof.
table displays a table of the groups used for the Hosmer-Lemeshow or Pearson
goodness-of-fit test with predicted probabilities, observed and expected counts for
both outcomes, and totals for each group.
Examples
Setup
. webuse lbw
Fit logistic regression to predict low birth weight
. logistic low age lwt i.race smoke ptl ht ui
Perform goodness-of-fit test
. estat gof
Same as above, but use 10 quantiles
. estat gof, group(10)
Same as above, but display table of groups used for test
. estat gof, group(10) table
Stored results
estat gof stores the following in r():
Scalars
r(N) number of observations
r(m) number of covariate patterns or groups
r(df) degrees of freedom
r(chi2) chi-squared