Stata 15 help for logit_postestimation

[R] logit postestimation -- Postestimation tools for logit

Postestimation commands

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 lroc compute area under ROC curve and graph the curve lsens graph sensitivity and specificity versus probability cutoff ------------------------------------------------------------------------- These commands are not appropriate after the svy prefix.

The following standard postestimation commands are also available:

Command Description ------------------------------------------------------------------------- contrast contrasts and ANOVA-style joint tests of estimates estat ic Akaike's and Schwarz's Bayesian information criteria (AIC and BIC) estat summarize summary statistics for the estimation sample estat vce variance-covariance matrix of the estimators (VCE) estat (svy) postestimation statistics for survey data estimates cataloging estimation results * forecast dynamic forecasts and simulations * hausman Hausman's specification test lincom point estimates, standard errors, testing, and inference for linear combinations of coefficients linktest link test for model specification * lrtest likelihood-ratio test margins marginal means, predictive margins, marginal effects, and average marginal effects marginsplot graph the results from margins (profile plots, interaction plots, etc.) nlcom point estimates, standard errors, testing, and inference for nonlinear combinations of coefficients predict predictions, residuals, influence statistics, and other diagnostic measures predictnl point estimates, standard errors, testing, and inference for generalized predictions pwcompare pairwise comparisons of estimates suest seemingly unrelated estimation test Wald tests of simple and composite linear hypotheses testnl Wald tests of nonlinear hypotheses ------------------------------------------------------------------------- * forecast, hausman, and lrtest are not appropriate with svy estimation results. forecast is also not appropriate with mi estimation results.

Syntax for predict

predict [type] newvar [if] [in] [, statistic nooffset rules asif]

statistic Description ------------------------------------------------------------------------- Main pr probability of a positive outcome; the default xb linear prediction stdp standard error of the prediction * dbeta Pregibon (1981) Delta-Beta influence statistic * deviance deviance residual * dx2 Hosmer, Lemeshow, and Sturdivant (2013) Delta chi-squared influence statistic * ddeviance Hosmer, Lemeshow, and Sturdivant (2013) Delta-D influence statistic * hat Pregibon (1981) leverage * number sequential number of the covariate pattern * residuals Pearson residuals; adjusted for number sharing covariate pattern * rstandard standardized Pearson residuals; adjusted for number sharing covariate pattern score first derivative of the log likelihood with respect to xb ------------------------------------------------------------------------- Unstarred statistics are available both in and out of sample; type predict ... if e(sample) ... if wanted only for the estimation sample. Starred statistics are calculated only for the estimation sample, even when if e(sample) is not specified. pr, xb, stdp, and score are the only options allowed with svy estimation results.

Menu for predict

Statistics > Postestimation

Description for predict

predict creates a new variable containing predictions such as probabilities, linear predictions, standard errors, influence statistics, deviance residuals, leverages, sequential numbers, Pearson residuals, and equation-level scores.

Options for predict

+------+ ----+ Main +-------------------------------------------------------------

pr, the default, calculates the probability of a positive outcome.

xb calculates the linear prediction.

stdp calculates the standard error of the linear prediction.

dbeta calculates the Pregibon (1981) Delta-Beta influence statistic, a standardized measure of the difference in the coefficient vector that is due to deletion of the observation along with all others that share the same covariate pattern. In Hosmer, Lemeshow, and Sturdivant (2013, 154-155) jargon, this statistic is M-asymptotic; that is, it is adjusted for the number of observations that share the same covariate pattern.

deviance calculates the deviance residual.

dx2 calculates the Hosmer, Lemeshow, and Sturdivant (2013, 191) Delta chi-squared influence statistic, reflecting the decrease in the Pearson chi-squared that is due to deletion of the observation and all others that share the same covariate pattern.

ddeviance calculates the Hosmer, Lemeshow, and Sturdivant (2013, 191) Delta-D influence statistic, which is the change in the deviance residual that is due to deletion of the observation and all others that share the same covariate pattern.

hat calculates the Pregibon (1981) leverage or the diagonal elements of the hat matrix adjusted for the number of observations that share the same covariate pattern.

number numbers the covariate patterns -- observations with the same covariate pattern have the same number. Observations not used in estimation have number set to missing. The first covariate pattern is numbered 1, the second 2, and so on.

residuals calculates the Pearson residual as given by Hosmer, Lemeshow, and Sturdivant (2013, 155) and adjusted for the number of observations that share the same covariate pattern.

rstandard calculates the standardized Pearson residual as given by Hosmer, Lemeshow, and Sturdivant (2013, 191) and adjusted for the number of observations that share the same covariate pattern.

score calculates the equation-level score, the first derivative of the log likelihood with respect to the linear prediction.

+---------+ ----+ Options +----------------------------------------------------------

nooffset is relevant only if you specified offset(varname) for logit. It modifies the calculations made by predict so that they ignore the offset variable; the linear prediction is treated as xb rather than as xb + offset.

rules requests that Stata use any rules that were used to identify the model when making the prediction. By default, Stata calculates missing for excluded observations.

asif requests that Stata ignore the rules and the exclusion criteria and calculate predictions for all observations possible by using the estimated parameter from the model.

Syntax for margins

margins [marginlist] [, options]

margins [marginlist] , predict(statistic ...) [predict(statistic ...) ...] [options]

statistic Description ------------------------------------------------------------------------- pr probability of a positive outcome; the default xb linear prediction stdp not allowed with margins dbeta not allowed with margins deviance not allowed with margins dx2 not allowed with margins ddeviance not allowed with margins hat not allowed with margins number not allowed with margins residuals not allowed with margins rstandard not allowed with margins score not allowed with margins -------------------------------------------------------------------------

Statistics not allowed with margins are functions of stochastic quantities other than e(b).

For the full syntax, see [R] margins.

Menu for margins

Statistics > Postestimation

Description for margins

margins estimates margins of response for probabilities and linear predictions.

Examples

--------------------------------------------------------------------------- Setup . webuse lbw

Fit logistic regression to predict low birth weight . logit low age lwt i.race smoke ptl ht ui

Calculate fitted probabilities . predict p

Report classification table and summary statistics . estat classification

Perform goodness-of-fit test . estat gof

--------------------------------------------------------------------------- Setup . webuse hospital, clear . logistic satisfied hospital##illness

ANOVA-style table of tests for main effects and interaction effects . contrast hospital##illness

Test differences between illnesses at each hospital . margins illness, over(hospital) contrast

---------------------------------------------------------------------------

References

Hosmer, D. W., Jr., S. A. Lemeshow, and R. X. Sturdivant. 2013. Applied Logistic Regression. 3rd ed. Hoboken, NJ: Wiley.

Pregibon, D. 1981. Logistic regression diagnostics. Annals of Statistics 9: 705-724.


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index