看suest的manual里面的例子解释比较详细
下面是suest的help,看最后的例子,模仿其做法
Title
[R] suest -- Seemingly unrelated estimation
Syntax
suest namelist [, options]
where namelist is a list of one or more names under which estimation results were stored via
estimates store. Wildcards may be used. * and _all refer to all stored results. A
single period (.) may be used to refer to the last estimation results, even if they have
not (yet) been stored.
options Description
---------------------------------------------------------------------------------------------
SE/Robust
svy survey data estimation
vce(vcetype) vcetype may be robust or cluster clustvar
Reporting
level(#) set confidence level; default is level(95)
dir display a table describing the models
eform(string) report exponentiated coefficients and label as string
display_options control column formats, row spacing, line width, display of omitted
variables and base and empty cells, and factor-variable labeling
coeflegend display legend instead of statistics
---------------------------------------------------------------------------------------------
coeflegend does not appear in the dialog box.
Menu
Statistics > Postestimation > Tests > Seemingly unrelated estimation
Description
suest is a postestimation command; see estcom and postest.
suest combines the estimation results -- parameter estimates and associated (co)variance
matrices -- stored under namelist into one parameter vector and simultaneous (co)variance
matrix of the sandwich/robust type. This (co)variance matrix is appropriate even if the
estimates were obtained on the same or on overlapping data.
Typical applications of suest are tests for intramodel and cross-model hypotheses using test
or testnl, for example, a generalized Hausman specification test. lincom and nlcom may be
used after suest to estimate linear combinations and nonlinear functions of coefficients.
suest may also be used to adjust a standard VCE for clustering or survey design effects.
Different estimators are allowed, for example, a regress model and a probit model; the only
requirement is that predict produce equation-level scores with the score option after an
estimation command. The models may be estimated on different samples, due either to explicit
if or in selection or to missing values. If weights are applied, the same weights (type and
values) should be applied to all models in namelist. The estimators should be estimated
without vce(robust) or vce(cluster clustvar) options. suest returns the robust VCE, allows
the vce(cluster clustvar) option, and automatically works with results from the svy prefix
command (only for vce(linearized)). See example 7 in [SVY] svy postestimation for an example
using suest with svy: ologit.
Because suest posts its results like a proper estimation command, its results can be stored
via estimates store. Moreover, like other estimation commands, suest typed without arguments
replays the results.
Options
+-----------+
----+ SE/Robust +----------------------------------------------------------------------------
svy specifies that estimation results should be modified to reflect the survey design effects
according to the svyset specifications; see [SVY] svyset.
The svy option is implied when suest encounters survey estimation results from the svy
prefix. Poststratification is allowed only with survey estimation results from the svy
prefix.
vce(vcetype) specifies the type of standard error reported, which includes types that are
robust to some kinds of misspecification (robust) and that allow for intragroup
correlation (cluster clustvar); see [R] vce_option.
The vce() option may not be combined with the svy option or estimation results from the
svy prefix.
+-----------+
----+ Reporting +----------------------------------------------------------------------------
level(#) specifies the confidence level, as a percentage, for confidence intervals of the
coefficients; see [R] level.
dir displays a table describing the models in namelist just like estimates dir namelist.
eform(string) displays the coefficient table in exponentiated form: for each coefficient,
exp(b) rather than b is displayed, and standard errors and confidence intervals are
transformed. string is the table header that will be displayed above the transformed
coefficients and must be 11 characters or fewer, for example, eform("Odds ratio").
display_options: noomitted, vsquish, noemptycells, baselevels, allbaselevels, nofvlabel,
fvwrap(#), fvwrapon(style), cformat(%fmt), pformat(%fmt), sformat(%fmt), and nolstretch;
see [R] estimation options.
The following option is available with suest but is not shown in the dialog box:
coeflegend; see [R] estimation options.
Remarks
Remarks are presented under the following headings:
Using suest
Using suest with survey data
Remarks on specific commands
Using suest
If you plan to use suest, you must take precautions when fitting the original models. These
restrictions are relaxed when using survey data; see Using suest with survey data below.
1. suest works with estimation commands that allow predict to generate equation-level
score variables when supplied with the score (or scores) option. For example,
equation-level score variables are generated after running mlogit by typing
. predict sc*, scores
2. Estimation should take place without the vce(robust) or vce(cluster clustvar)
options. suest always computes the robust estimator of the (co)variance, and suest
has a vce(cluster clustvar) option.
The within-model covariance matrices computed by suest are identical to those
obtained by specifying a vce(robust) or vce(cluster clustvar) option during
estimation. suest, however, also estimates the between-model covariances of
parameter estimates.
3. Finally, the estimation results to be combined should be stored by estimates store;
see [R] estimates store.
After estimating and storing a series of estimation results, you are ready to combine the
estimation results with suest,
. suest name1 [name2 ...] [, vce(cluster clustvar)]
and you can subsequently use postestimation commands, such as test, to test hypotheses. Here
an important issue is how suest assigns names to the equations. If you specify one model
name, the original equation names are left unchanged; otherwise, suest constructs new
equation names. The coefficients of a single-equation model (such as logit and poisson) that
was estimate stored under name X are collected under equation X. With a multiequation model
stored under name X, suest prefixes X_ to an original equation name eq, forming equation name
X_eq.
Technical note: in rare circumstances, suest may have to truncate equation names to 32
characters. When equation names are not unique because of truncation, suest numbers the
equations within models, using equations named X_#.
Using suest with survey data
suest can be used to obtain the variance estimates for a series of estimators that used the
svy prefix. To use suest for this purpose, perform the following steps:
1. Be sure to set the survey design characteristics correctly using svyset. Do not use
the vce() option to change the default variance estimator from the linearized
variance estimator. vce(brr) and vce(jackknife) are not supported by suest.
2. Fit the model or models by using the svy prefix command, optionally including the
subpopulation with the subpop() option.
3. Store the estimation results with estimates store name.
4. Use suest with name.
Remarks on specific commands
Some estimation commands store or name their results in a slightly nonstandard way, mostly
for historical reasons. suest provides "fixes" in these cases.
regress does not include its ancillary parameter, the residual variance, in its coefficient
vector and (co)variance matrix. Moreover, while the score option is allowed with predict
after regress, a score variable is generated for the mean but not for the variance
parameter. suest contains special code that assigns the equation name mean to the
coefficients for the mean, adds the equation lnvar for the log variance, and computes the
appropriate score variables.
Example 1: A Hausman test
. webuse sysdsn4
. mlogit insure age male
. estimates store m1, title(all three insurance forms)
. quietly mlogit insure age male if insure != "Uninsure":insure
. estimates store m2, title(insure != "Uninsure":insure)
. quietly mlogit insure age male if insure != "Prepaid":insure
. estimates store m3, title(insure != "Prepaid":insure)
. hausman m2 m1, alleqs constant
. hausman m3 m1, alleqs constant
Example 2: Do coefficients vary between groups? ("Chow test")
. webuse income
. regress inc edu exp if male
. estimates store Male
. regress inc edu exp if !male
. estimates store Female
. suest Male Female
. test [Male_mean = Female_mean]
Example 3: A nonlinear Hausman-like test
. webuse income
. probit promo edu exp
. estimates store Promo
. regress inc edu exp
. estimates store Inc
. suest Promo Inc
. testnl [Promo_promo]edu/[Promo_promo]exp = [Inc_mean]edu/[Inc_mean]exp
Example 4: Using suest with survey data, the svy prefix
. webuse nhanes2f
. svyset psuid [pw=finalwgt], strata(stratid)
. svy: ologit health female black age age2
. estimates store H5
. gen health3 = clip(health,2,4)
. svy: ologit health3 female black age age2
. estimates store H3
. suest H5 H3
. test [H5_health=H3_health3]
. test ([H5_cut2]_cons=[H3_cut1]_cons) ([H5_cut3]_cons=[H3_cut2]_cons)
Example 5: Using suest with survey data, the svy option
. webuse nhanes2f, clear
. svyset psuid [pw=finalwgt], strata(stratid)
. ologit health female black age age2 [iw=finalwgt]
. estimates store H5
. gen health3 = clip(health,2,4)
. ologit health3 female black age age2 [iw=finalwgt]
. estimates store H3
. suest H5 H3, svy
. test [H5_health=H3_health3]
. test ([H5_cut2]_cons=[H3_cut1]_cons) ([H5_cut3]_cons=[H3_cut2]_cons)