help xtmixed postestimation dialogs: predict estat
also see: xtmixed
-------------------------------------------------------------------------------
Title
[XT] xtmixed postestimation -- Postestimation tools for xtmixed
Description
The following postestimation commands are of special interest after
xtmixed:
command description
-------------------------------------------------------------------------
estat group summarize the composition of the nested groups
estat recov estat recovariance display 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
hausman Hausman's specification test
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 best linear unbiased predictions (BLUPs) of random
effects, or the BLUPs' standard errors
predict [type] {stub*|newvarlist} [if] [in] , {reffects | reses}
[level(levelvar)]
Syntax for obtaining other predictions
predict [type] newvar [if] [in] [, statistic level(levelvar)]
statistic description
-------------------------------------------------------------------------
Main
xb xb, linear predictor for the fixed portion of the model
stdp standard error of the fixed-portion linear prediction xb
fitted fitted values, linear predictor of the fixed portion plus
contributions based on predicted random effects
residuals residuals, response minus fitted values
* rstandard standardized residuals
-------------------------------------------------------------------------
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.
Menu
Statistics > Postestimation > Predictions, residuals, etc.
Options for predict
+------+
----+ Main +-------------------------------------------------------------
xb calculates the linear prediction for the fixed portion of the model.
stdp calculates the standard error of the fixed-portion linear
prediction.
level(levelvar) specifies the level in the model at which predictions
involving random effects are to be obtained; see below for the
specifics. 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.
reffects calculates best linear unbiased predictions (BLUPs) of the
random effects. By default, BLUPs for all random effects in the
model are calculated. However, if the level(levelvar) option is
specified, then BLUPs for only level levelvar in the model are
calculated. For example, if classes are nested within schools, then
. predict b*, reffects level(school)
would be used to obtain BLUPs 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...stubq for you.
reses calculates the standard errors of the best linear unbiased
predictions (BLUPs) of the random effects. By default, standard
errors for all BLUPs 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; see above. 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...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 xtmepoisson.
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.
fitted calculates fitted values, which are equal to the fixed-portion
linear predictor plus contributions based on predicted random
effects, or in mixed-model notation, xb + Zu. By default, the fitted
values take into account random effects from all levels in the model,
however, if the level(levelvar) option is specified, then the fitted
values are fit beginning at the top-most level down to and including
level levelvar. For example, if classes are nested within schools,
then
. predict yhat1, fitted level(school)
would produce school-level predictions. That is, the predictions
would incorporate school-specific random effects, but not those for
each class nested within each school.
residuals calculates residuals, equal to the responses minus fitted
values. By default, the fitted values take into account random
effects from all levels in the model, however, if the level(levelvar)
option is specified, then the fitted values are fit beginning at the
top-most level down to and including level levelvar.
rstandard calculates standardized residuals, equal to the residuals
multiplied by the inverse square root of the estimated error
covariance matrix.
Syntax for estat group
estat group
Menu
Statistics > Postestimation > Reports and statistics
Syntax for estat recovariance
estat recovariance [, recov_options]
recov_options description
-------------------------------------------------------------------------
Main
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
+------+
----+ Main +-------------------------------------------------------------
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 pig
. xtmixed weight week || id: week, covariance(unstructured) variance
Random-effects covariance matrix for level id
. estat recovariance
Random-effects correlation matrix for level id
. estat recovariance, correlation
BLUPS of random effects
. predict u1 u0, reffects
Standard errors of BLUPs
. predict s1 s0, reses
---------------------------------------------------------------------------
Setup
. webuse productivity, clear
. xtmixed gsp private emp hwy water other unemp || region: || state:
Summarize composition of nested groups
. estat group
Fitted values at region level
. predict gsp_region, fitted level(region)
---------------------------------------------------------------------------
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.
Also see
Manual: [XT] xtmixed postestimation
Help: [XT] xtmixed