Linear combinations of estimators saved as estimation results
lincomest [exp] [ , level(#) eform(string) holdname(holdname) ]
where holdname is a name under which any pre-existing estimation results will be held, and exp is any linear combination of coefficients that is valid syntax for test. Note, however, that exp must not contain any additive constants or equal signs.
Description
lincomest is an extension to lincom, which calculates confidence intervals and P-values for linear combinations of model coefficients. lincomest saves the estimate and variance of the linear combination as estimation results, with the option of saving the existing estimation results to be recalled by _estimates unhold or by estimates restore. The advantage of doing this is that the linear combination can be output by estimates table, or input to parmest to create an output dataset (or resultsset) with one observation containing a confidence interval and P-value for the linear combination. This dataset can be concatenated with other parmest output datasets using dsconcat, and the confidence intervals and/or P-values can then be plotted and/or tabulated.
Options
level(#) specifies the confidence level, in percent, for confidence intervals; see help for level.
eform(string) specifies that the linear combination and its confidence limits must be reported in exponentiated form, as exp(b) rather than b, and labelled by the string. If eform() is not specified, then the linear combination is reported in unexponentiated form, unless the last estimation command was logistic, in which case the linear combination is reported in exponentiated form, with the eform() option set to "Odds ratio". Whether or not eform() is specified, lincomest always stores the unexponentiated estimates in the estimation results.
holdname(holdname) specifies that the existing estimation results are to be stored under the name of holdname. They can then be restored by _estimates unhold. The holdname() option was inherited from the Stata 7 version of lincomest, and is retained mainly so that old do-files will still work. Under Stata version 8 or above, the preferred way of storing the old estimation results is estimates store, and the preferred way of restoring them is estimates restore.
Remarks
lincomest is intended to be used with parmest, which saves the current estimation results as an output dataset (or resultsset) with one observation per parameter of the most recently fitted model. This new dataset is used to create tables and/or plots of confidence intervals and/or P-values. Other programs that are very useful with parmest are dsconcat, descsave, factext and sencode. The latest versions of all these programs can be installed from SSC, using the ssc command. For more information about the use of parmest resultssets, see Newson (2003), Newson (2004) and Newson (2006).
Examples
The following example will work with the auto data if parmest and dsconcat are installed. It will create a dataset of confidence intervals of the parameters corresponding to values of the factor rep78.
. tempfile tf1 tf2 . xi:regress mpg i.rep78 . parmest,label saving(`tf1',replace) . lincomest (_Irep78_2+_Irep78_3+_Irep78_4+_Irep78_5)/4 . parmest,label saving(`tf2',replace) . dsconcat `tf1' `tf2' . list parm label estimate min95 max95 p
The following example demonstrates the use of lincomest with parmest and the estimates utility. It will save estimates, confidence limits and P-values for a ratio of odds ratios, and then restore the original estimation results to be printed again.
. logit foreign length weight . estimates store oldest . lincomest 30*length-1000*weight,eform(OR) . parmest,label saving(lincom1.dta,replace) eform . estimates restore oldest . logit,or
Saved results
lincomest saves the following in e():
Scalars e(N) number of observations e(N_clust) number of clusters e(df_r) residual degrees of freedom e(N_strata) number of strata e(N_psu) number of sampled PSUs e(deff) DEFF result e(deft) DEFT result e(meft) MEFT result
Macros e(cmd) lincomest e(cmdline) command as typed e(depvar) name of dependent variable e(predict) program called by predict (lincomest_p) e(formula) linear combination expression e(holdname) holdname() option e(properties) b V
Matrices e(b) coefficient vector e(V) variance-covariance matrix of the estimators
Functions e(sample) marks estimation sample
The scalar results e(N_strata), e(N_psu), e(deff), e(deft) and e(meft) are only returned if the previous estimation command was a survey command, and are equal to the scalar results of the same names returned in r() by lincom after survey commands. The program lincomest_p, called by predict after lincomest, tells the user that predict should not be used after lincomest.
All of these estimation results can be stored as variables in a parmest output dataset (or resultsset) if the user specifies the emac(), escal(), evec(), erows() and/or ecols() options of parmest. They can also be tabulated using estimates table.
Author
Roger Newson, Imperial College London, UK. Email: r.newson@imperial.ac.uk
References
Newson, R. 2003. Confidence intervals and p-values for delivery to the end user. The Stata Journal 3(3): 245-269. Also downloadable from Roger Newson's website at http://www.imperial.ac.uk/nhli/r.newson.
Newson, R. 2004. From datasets to resultssets in Stata. Presented at the 10th United Kingdom Stata Users' Group Meeting, London, 29 June, 2004. Also downloadable from Roger Newson's website at http://www.imperial.ac.uk/nhli/r.newson.
Newson, R. 2006. Resultssets, resultsspreadsheets and resultsplots in Stata. Presented at the 4th German Stata User Meeting, Mannheim, 31 March, 2006. Also downloadable from Roger Newson's website at http://www.imperial.ac.uk/nhli/r.newson.
Also see
Manual: [R] lincom, [R] xi, [P] estimates, [U] 20 Estimation and post-estimation commands On-line: help for lincom, estimates, _estimates, xi help for descsave, dsconcat, factext, metaparm, parmest, sencode if installed