help xtmelogit postestimation dialogs: predict estat
also see: xtmelogit
-------------------------------------------------------------------------------
Title
[XT] xtmelogit postestimation -- Postestimation tools for xtmelogit
Description
The following postestimation commands are of special interest after
xtmelogit:
command description
-------------------------------------------------------------------------
estat group summarizes the composition of the nested groups
estat recovariance displays the estimated random-effects covariance
matrix
-------------------------------------------------------------------------
The following standard postestimation commands are also available:
command description
-------------------------------------------------------------------------
estat AIC, BIC, VCE, and estimation sample summary
estimates cataloging estimation results
lincom point estimates, standard errors, testing, and inference
for linear combinations of coefficients
lrtest likelihood-ratio test
margins marginal means, predictive margins, marginal effects, and
average marginal effects
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
test Wald tests of simple and composite linear hypotheses
testnl Wald tests of nonlinear hypotheses
-------------------------------------------------------------------------
Special-interest postestimation commands
estat group reports number of groups and minimum, average, and maximum
group sizes for each level of the model. Model levels are identified by
the corresponding group variable in the data. Because groups are treated
as nested, the information in this summary may differ from what you would
get had you tabulated each group variable yourself.
estat recovariance displays the estimated variance-covariance matrix of
the random effects for each level. Random effects can be either random
intercepts, in which case the corresponding rows and columns of the
matrix are labeled as _cons, or random coefficients, in which case the
label is the name of the associated variable in the data.
Syntax for predict
Syntax for obtaining estimated random effects or their standard errors
predict [type] {stub*|newvarlist} [if] [in] , { reffects | reses }
[level(levelvar)]
Syntax for obtaining other predictions
predict [type] newvar [if] [in] [, statistic fixedonly nooffset]
statistic description
-------------------------------------------------------------------------
Main
mu the predicted mean; the default
xb xb, linear predictor for the fixed portion of the model
stdp standard error of the fixed-portion linear prediction xb
pearson Pearson residuals
deviance deviance residuals
anscombe Anscombe residuals
-------------------------------------------------------------------------
These statistics are available both in and out of sample; type predict
... if e(sample) ... if wanted only for the estimation sample.
Menu
Statistics > Postestimation > Predictions, residuals, etc.
Options for predict
+------+
----+ Main +-------------------------------------------------------------
reffects calculates posterior modal estimates of the random effects. By
default, estimates for all random effects in the model are
calculated. However, if the level(levelvar) option is specified, then
estimates for only level levelvar in the model are calculated. For
example, if classes are nested within schools, then
. predict b*, reffects level(school)
would yield random-effects estimates at the school level. You must
specify q new variables, where q is the number of random-effects
terms in the model (or level). However, it is much easier to just
specify stub* and let Stata name the variables stub1, stub2, ...,
stubq for you.
reses calculates standard errors for the random-effects estimates
obtained by using the reffects option. By default, standard errors
for all random effects in the model are calculated. However, if the
level(levelvar) option is specified, then standard errors for only
level levelvar in the model are calculated. For example, if classes
are nested within schools, then
. predict se*, reses level(school)
would yield standard errors at the school level. You must specify q
new variables, where q is the number of random-effects terms in the
model (or level). However, it is much easier to just specify stub*
and let Stata name the variables stub1, stub2, ..., stubq for you.
The reffects and reses options often generate multiple new variables
at once. When this occurs, the random effects (or standard errors)
contained in the generated variables correspond to the order in which
the variance components are listed in the output of xtmelogit.
Still, examining the variable labels of the generated variables
(using the describe command, for instance) can be useful in
deciphering which variables correspond to which terms in the model.
level(levelvar) specifies the level in the model at which predictions for
random effects and their standard errors are to be obtained.
levelvar is the name of the model level and is either the name of the
variable describing the grouping at that level or _all, a special
designation for a group comprising all the estimation data.
mu, the default, calculates the predicted mean. By default, this is
based on a linear predictor that includes both the fixed effects and
the random effects, and the predicted mean is conditional on the
values of the estimated random effects. Use the fixedonly option if
you want predictions that include only the fixed portion of the
model, i.e., if you want random effects set to zero.
xb calculates the linear prediction for the fixed portion of the model.
stdp calculates the standard error of the fixed-portion linear
prediction.
pearson calculates Pearson residuals. Pearson residuals large in
absolute value may indicate a lack of fit. By default, residuals
include both the fixed portion and the random portion of the model.
The fixedonly option modifies the calculation to include the fixed
portion only.
deviance calculates deviance residuals. Deviance residuals are
recommended by McCullagh and Nelder (1989) as having the best
properties for examining the goodness of fit of a GLM. They are
approximately normally distributed if the model is correctly
specified. They may be plotted against the fitted values or against
a covariate to inspect the model's fit. By default, residuals
include both the fixed portion and the random portion of the model.
The fixedonly option modifies the calculation to include the fixed
portion only.
anscombe calculates Anscombe residuals, residuals that are designed to
closely follow a normal distribution. By default, residuals include
both the fixed portion and the random portion of the model. The
fixedonly option modifies the calculation to include the fixed
portion only.
fixedonly modifies predictions to include only the fixed portion of the
model, equivalent to setting all random effects equal to zero; see
above.
nooffset is relevant only if you specified offset(varname) for xtmelogit.
It modifies the calculations made by predict so that they ignore the
offset variable; the linear prediction is treated as xb (+ Zu) rather
than xb (+ Zu) + offset.
Syntax for estat group
estat group
INCLUDE menu_estat
Syntax for estat recovariance
estat recovariance [, recov_options]
recov_options description
-------------------------------------------------------------------------
level(levelvar) display the random-effects covariance/correlation
matrix for level levelvar
correlation display matrix as a correlation matrix
matlist_options style options for displaying the matrix; see [P]
matlist
-------------------------------------------------------------------------
Menu
Statistics > Postestimation > Reports and statistics
Options for estat recovariance
level(levelvar) specifies the level in the model for which the
random-effects covariance matrix is to be displayed. By default, the
covariance matrices for all levels in the model are displayed.
levelvar is the name of the model level and is either the name of
variable describing the grouping at that level or _all, a special
designation for a group comprising all the estimation data.
correlation displays the covariance matrix as a correlation matrix.
matlist_options control how the matrix (or matrices) are displayed. See
[P] matlist for details.
Examples
---------------------------------------------------------------------------
Setup
. webuse bangladesh
. xtmelogit c_use urban age child* || district: urban,
covariance(unstructured)
Random-effects covariance matrix for level district
. estat recovariance
Random-effects correlation matrix for level district
. estat recovariance, correlation
Predictions of random effects
. predict re_urban re_cons, reffects
---------------------------------------------------------------------------
Setup
. webuse towerlondon, clear
. xtmelogit dtlm difficulty i.group || family: || subject:
Summarize composition of nested groups
. estat group
Predicted probabilities, incorporating random effects
. predict p
Predicted probabilities, ignoring subject and family effects
. predict p_fixed, fixedonly
---------------------------------------------------------------------------
Saved results
estat recovariance saves the last-displayed random-effects covariance
matrix in r(cov) or in r(corr) if it is displayed as a correlation
matrix.
Reference
McCullagh, P., and J. A. Nelder. 1989. Generalized Linear Models. 2nd
ed. London: Chapman & Hall/CRC.
Also see
Manual: [XT] xtmelogit postestimation
Help: [XT] xtmelogit