Usage

Workflow, options, margins after suest2, and the rules for weights, survey data, and MI

suest2 model1name model2name [, options]

model#name are stored estimates. Store each model with estimates store before running suest2.

The workflow

Fit each model, store it, combine, then do the post-estimation you want on the combined system. We recommend fitting the models with vce(robust) or vce(cluster varname) so that the suest2 results match the individual model results exactly.

sysuse nlsw88, clear
(NLSW, 1988 extract)
drop if missing(union, wage, ttl_exp, collgrad, age, south)
(368 observations deleted)

. 
quietly logit union c.age##i.collgrad i.south, vce(robust)
estimates store m1
quietly logit union c.age##i.collgrad i.south c.wage c.ttl_exp, vce(robust)
estimates store m2
. 
suest2 m1 m2
Simultaneous results for m1, m2                          Number of obs = 1,878

--------------------------------------------------------------------------------
               |               Robust
               | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
---------------+----------------------------------------------------------------
m1_union       |
           age |     -0.002      0.021   -0.092   0.927       -0.043       0.039
               |
      collgrad |
 College grad  |     -1.007      1.564   -0.644   0.520       -4.072       2.058
               |
collgrad#c.age |
 College grad  |      0.039      0.040    0.973   0.331       -0.039       0.116
               |
         south |
        South  |     -0.745      0.116   -6.408   0.000       -0.972      -0.517
         _cons |     -0.901      0.828   -1.088   0.277       -2.525       0.722
---------------+----------------------------------------------------------------
m2_union       |
           age |     -0.004      0.021   -0.187   0.852       -0.046       0.038
               |
      collgrad |
 College grad  |     -1.284      1.601   -0.802   0.423       -4.422       1.855
               |
collgrad#c.age |
 College grad  |      0.041      0.040    1.004   0.315       -0.039       0.120
               |
         south |
        South  |     -0.675      0.119   -5.690   0.000       -0.907      -0.442
          wage |      0.054      0.014    3.843   0.000        0.026       0.081
       ttl_exp |      0.006      0.013    0.484   0.629       -0.019       0.032
         _cons |     -1.302      0.838   -1.554   0.120       -2.945       0.340
--------------------------------------------------------------------------------

What the combined results contain

e(b) holds every model’s coefficients, one equation per model (named model_depvar), and e(V) their joint covariance matrix. Any command that works on e(b) and e(V) works here.

test [m1_union]1.collgrad = [m2_union]1.collgrad
 ( 1)  [m1_union]1.collgrad - [m2_union]1.collgrad = 0

           chi2(  1) =    2.06
         Prob > chi2 =    0.1516
nlcom ([m1_union]1.collgrad - [m2_union]1.collgrad) / [m1_union]1.collgrad
       _nl_1: ([m1_union]1.collgrad - [m2_union]1.collgrad) / [m1_union]1.collgrad

------------------------------------------------------------------------------
             | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
       _nl_1 |     -0.274      0.443   -0.620   0.536       -1.142       0.594
------------------------------------------------------------------------------

The other stored results are listed in the help file.

margins after suest2

A bare margins gives predictions from every model. To use one model, name it in predict() with model():

margins, dydx(age) predict(model(m1) pr)
------------------------------------------------------------------------------
             |            Delta-method
             | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
m1           |
         age |      0.002      0.003    0.520   0.603       -0.005       0.008
------------------------------------------------------------------------------
margins, dydx(age) predict(model(m2) pr)
------------------------------------------------------------------------------
             |            Delta-method
             | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
m2           |
         age |      0.001      0.003    0.428   0.669       -0.005       0.008
------------------------------------------------------------------------------

The other margins options, e.g. at(), over(), and post, work as usual. For multi-category models add the outcome, e.g. predict(model(o1) pr outcome(3)); for multilevel models, e.g. predict(model(me1) mu fixedonly). The Predictions and graphs page shows marginsplot and coefplot after suest2.

margins, post followed by lincom or metest tests a marginal effect across the two models, which is what mecompare automates:

mecompare age
Predicting: Pr(union)

Marginal effects and cross-model differences (N_m1=1878) (N_m2=1878)

                                 |  ME #   Estimate  Robust SE      P>|z|
---------------------------------+---------------------------------------
age + 1 (centered)               |                                       
                              m1 |     1      0.002      0.003      0.603
                              m2 |     2      0.001      0.003      0.669
                      Difference |     3      0.000      0.001      0.579

Options

Option Purpose
cluster(varname) Cluster the joint covariance on varname.
vce(robust), robust Request the route’s robust covariance.
vce(cluster varname) Same as cluster(varname).
level(#) Confidence level; the default is 95.
dir Pass through the official suest display option.
eform(string) Exponentiated coefficients where applicable, with string as the column label, e.g. eform("Odds ratio"). The argument is required.
minus(string) The official suest minus convention when supported; passed verbatim.
regressml The official suest ML-regression convention when supported.
svy Pass through the official suest survey option when supported. Does not replace fitting each survey model with the svy: prefix.
nowarn Suppress the note printed when a model was not fit with vce(robust).

Specify only one of cluster(), vce(), and robust. Panel models cluster at the panel identifier by default and multilevel models at the common highest-level grouping variable; a larger cluster may be requested only when the panels or groups are nested within it.

suest2 m1 m2, eform("Odds ratio") nowarn
Simultaneous results for m1, m2                          Number of obs = 1,878

--------------------------------------------------------------------------------
               |               Robust
               | Odds ratio   std. err.      z    P>|z|     [95% conf. interval]
---------------+----------------------------------------------------------------
m1_union       |
           age |      0.998      0.021   -0.092   0.927        0.958       1.040
               |
      collgrad |
 College grad  |      0.365      0.571   -0.644   0.520        0.017       7.828
               |
collgrad#c.age |
 College grad  |      1.039      0.041    0.973   0.331        0.962       1.123
               |
         south |
        South  |      0.475      0.055   -6.408   0.000        0.378       0.596
         _cons |      0.406      0.336   -1.088   0.277        0.080       2.059
---------------+----------------------------------------------------------------
m2_union       |
           age |      0.996      0.021   -0.187   0.852        0.955       1.039
               |
      collgrad |
 College grad  |      0.277      0.444   -0.802   0.423        0.012       6.390
               |
collgrad#c.age |
 College grad  |      1.041      0.042    1.004   0.315        0.962       1.127
               |
         south |
        South  |      0.509      0.060   -5.690   0.000        0.404       0.643
          wage |      1.055      0.015    3.843   0.000        1.027       1.085
       ttl_exp |      1.006      0.013    0.484   0.629        0.981       1.033
         _cons |      0.272      0.228   -1.554   0.120        0.053       1.406
--------------------------------------------------------------------------------

Weights, survey data, and multiple imputation

Survey data. For weighted analyses and complex samples, svyset the data and fit each model with the svy: prefix, then pass the stored names to suest2 without a prefix. The design comes from svyset; do not specify cluster(), vce(), or robust on suest2. All models must use the same subpopulation specification, and replicate-weight VCEs are not supported.

Pweights. Pweighted systems support regress, logit/logistic, probit, poisson, nbreg, ologit, oprobit, and mlogit, which may be combined. The weights must agree on observations shared by the estimation samples. Request system clustering with cluster() on suest2.

Multiple imputation. Fit and store each model with mi estimate, post:, then pass the stored names to suest2. It combines the models within each imputation and pools the results with Rubin’s rules; the MI data must not change in between. Use mimrgns or mecompare for post-estimation; ordinary predict and margins are not available after MI pooling. The supported families are listed in the help file.

Supported estimators

The lists follow the help file; the notes at the end of each group give its rules.

Ordinary single-level models

regress; logit and logistic; probit; ologit; oprobit; mlogit; poisson; nbreg; zip; and zinb with either inflation link.

glm; cloglog; tobit; intreg; maximum-likelihood heckman; and parametric streg. glm predictions support the identity, log, logit, probit, cloglog, and loglog links.

gologit2, including proportional-odds, partial proportional-odds, unrestricted, alternative-link, and autofit() results.

ivregress 2sls. fracreg with estimators logit and probit. Every model in an instrumental-variables system must use the same estimation mode: either unweighted conventional estimates, or linearized svy: ivregress 2sls estimates under one active survey design.

betareg with links logit, probit, cloglog, and loglog. truncreg. hetprobit. biprobit. ivprobit. ivtobit.

Panel models

xtreg with estimators re, fe, be, mle, and pa.

xtlogit with estimators re, fe, and pa. xtprobit with estimators re and pa.

xtologit and xtoprobit.

xtmlogit with estimators re and fe.

xtpoisson with estimators re, fe, and pa. xtnbreg with estimators re and pa.

xtcloglog with estimators re and pa.

Panel models must be unweighted and share a panel identifier. Fit them with conventional standard errors and request robust or clustered ones on suest2. Correlated random effects models are described below.

Multilevel models

mixed, mle; melogit; meprobit; mecloglog; mepoisson; menbreg; meologit; meoprobit; and mestreg.

meglm with the family-link pairs Gaussian-identity, Bernoulli-logit, Bernoulli-probit, Bernoulli-cloglog, Poisson-log, negative-binomial-log, Gamma-log, ordinal-logit, and ordinal-probit.

mestreg with the exponential, Weibull, lognormal, loglogistic, and gamma distributions, including the applicable proportional-hazards and accelerated-failure-time forms.

Multilevel models may be combined, and every model must use the same highest-level grouping variable. Multilevel and panel models may also be combined with ordinary single-level models – regress, logit, probit, cloglog, poisson, nbreg, ologit, and oprobit – e.g., a logit with a melogit or xtlogit. Fit the ordinary model unweighted, without a prefix, and with conventional standard errors; its standard errors are clustered on the highest-level group of the multilevel or panel model.

Fixed effects and correlated random effects

Fixed-effects (fe) models have known problems for marginal effects, especially with categorical outcomes. xtreg, cre is not supported, but the identical correlated-random-effects (Mundlak) specification is: include each time-varying predictor’s panel mean alongside the predictor and fit with the re estimator.

bysort id: egen mean_x = mean(x)
xtreg y x mean_x i.d, re

The coefficient on x is the within-person (“fixed effect”) estimate and the coefficient on mean_x the difference between the between-person and within-person estimates. The same recipe applies to any supported panel or multilevel family; the within-person effects example uses it with xtlogit.

More than two models

suest2 combines any number of stored models. Here are the four nested logits of Example 6.2 of Mize, Doan, and Long (2019), in one system:

use https://tdmize.github.io/data/data/gss_cme, clear
(gss_cme.dta | GSS 1972 - 2016 Weighted | 2018-07-10)
drop if year < 2000
(38,116 observations deleted)
drop if employed != 1
(9,556 observations deleted)
drop if missing(vhappy, college, wages, occprest, age, married, parent, woman, conserv, reltrad)
(5,578 observations deleted)

. 
quietly logit vhappy i.college, vce(robust)
estimates store m1
quietly logit vhappy i.college i.married i.parent i.woman i.conserv i.reltrad i.year c.age##c.age,
 vce(robust)
estimates store m2
quietly logit vhappy i.college c.wages i.married i.parent i.woman i.conserv i.reltrad i.year c.age
##c.age, vce(robust)
estimates store m3
quietly logit vhappy i.college c.wages c.occprest i.married i.parent i.woman i.conserv i.reltrad i
.year c.age##c.age, vce(robust)
estimates store m4
. 
quietly suest2 m1 m2 m3 m4
test [m1_vhappy]1.college = [m2_vhappy]1.college
 ( 1)  [m1_vhappy]1.college - [m2_vhappy]1.college = 0

           chi2(  1) =    3.84
         Prob > chi2 =    0.0499

The marginal-effects version is mecompare college, models(m1 m2 m3 m4) followed by metest.

Back to top