mlincom (multiple lincom) computes point estimates, standard errors, t or z statistics, p-values, and confidence intervals for multiple linear combinations of coefficients as well as their covariances. nlcom is also able to do this, but mlincom is much faster (up to 300 times for complex models). mlincom internally calls lincom for each linear combination and extracts estimates and variances from its output. It has an optional post option to post estimation results for subsequent testing or exporting with pretty table commands.
I would like to thank Roger Newson, his command lincomest has been useful for me in developing this command, and a small part of the code is now also part of mlincom in adapted form.
Examples from help mlincom:
Code:
. // Setup . webuse regress . regress y x1 x2 x3 Source | SS df MS Number of obs = 148 -------------+---------------------------------- F(3, 144) = 96.12 Model | 3259.3561 3 1086.45203 Prob > F = 0.0000 Residual | 1627.56282 144 11.3025196 R-squared = 0.6670 -------------+---------------------------------- Adj R-squared = 0.6600 Total | 4886.91892 147 33.2443464 Root MSE = 3.3619 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- x1 | 1.457113 1.07461 1.36 0.177 -.666934 3.581161 x2 | 2.221682 .8610358 2.58 0.011 .5197797 3.923583 x3 | -.006139 .0005543 -11.08 0.000 -.0072345 -.0050435 _cons | 36.10135 4.382693 8.24 0.000 27.43863 44.76407 ------------------------------------------------------------------------------ . . // Estimate linear combinations of coefficients with lincom . lincom x2-x1 ( 1) - x1 + x2 = 0 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | .7645682 .9950282 0.77 0.444 -1.20218 2.731316 ------------------------------------------------------------------------------ . lincom 3*x1 + 500*x3 ( 1) 3*x1 + 500*x3 = 0 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 1.301825 3.396624 0.38 0.702 -5.411858 8.015507 ------------------------------------------------------------------------------ . lincom 3*x1 + 500*x3 - 12 ( 1) 3*x1 + 500*x3 = 12 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -10.69818 3.396624 -3.15 0.002 -17.41186 -3.984493 ------------------------------------------------------------------------------ . . // Estimate linear combinations of coefficients with mlincom . mlincom (x2-x1) (3*x1 + 500*x3) (3*x1 + 500*x3 - 12) lc_1: x2-x1 = 0 lc_2: 3*x1 + 500*x3 = 0 lc_3: 3*x1 + 500*x3 - 12 = 0 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- lc_1 | .7645682 .9950282 0.77 0.444 -1.20218 2.731316 lc_2 | 1.301825 3.396624 0.38 0.702 -5.411858 8.015507 lc_3 | -10.69818 3.396624 -3.15 0.002 -17.41186 -3.984493 ------------------------------------------------------------------------------ . . // Estimate linear combinations of coefficients with mlincom, label transformations . mlincom ((name1) x2-x1) ((name2) 3*x1 + 500*x3) ((name3) 3*x1 + 500*x3 - 12) name1: x2-x1 = 0 name2: 3*x1 + 500*x3 = 0 name3: 3*x1 + 500*x3 - 12 = 0 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- name1 | .7645682 .9950282 0.77 0.444 -1.20218 2.731316 name2 | 1.301825 3.396624 0.38 0.702 -5.411858 8.015507 name3 | -10.69818 3.396624 -3.15 0.002 -17.41186 -3.984493 ------------------------------------------------------------------------------ . . // Estimate linear combinations of coefficients with mlincom, label transformations and post results . mlincom ((name1) x2-x1) ((name2) 3*x1 + 500*x3) ((name3) 3*x1 + 500*x3 - 12), post name1: x2-x1 = 0 name2: 3*x1 + 500*x3 = 0 name3: 3*x1 + 500*x3 - 12 = 0 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- name1 | .7645682 .9950282 0.77 0.444 -1.20218 2.731316 name2 | 1.301825 3.396624 0.38 0.702 -5.411858 8.015507 name3 | -10.69818 3.396624 -3.15 0.002 -17.41186 -3.984493 ------------------------------------------------------------------------------ . end of do-file
0 Response to New on SSC: mlincom - multiple linear combinations of parameters
Post a Comment