 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: How test linear combination of estimates from two sets of results from margins?

 From "Hanig, Ross" To "statalist@hsphsun2.harvard.edu" Subject st: How test linear combination of estimates from two sets of results from margins? Date Sun, 3 Mar 2013 23:57:40 +0000

```Hi Everyone,

I am running an ordered logit and using the command margins to get point estimates at different values of my dependent and independent variables (both on a 5 point likert scale). I need to test a linear combination of a point estimate from one margins command minus a point estimate using another margins command. Any ideas on how to do this? I'm guessing I need to save the estimates from each margins estimate and then test them but am not sure how. I've used lincom and nlcom before, but only for estimates within the same regression.

An example is below.

The following command gets me the results below:

margins if incomplete==0 & scenario==1 & support_b4_12==1, at(windsupport_b4comp=(1(1)5)) atmeans noatlegend predict(outcome(3));

Results:

Expression   : Pr(support==3), predict(outcome(3))

------------------------------------------------------------------------------
|            Delta-method
|     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_at |
1  |    .006218    .003431     1.81   0.070    -.0005065    .0129426
2  |   .0118178   .0050612     2.33   0.020     .0018981    .0217375
3  |   .0223408    .008551     2.61   0.009     .0055811    .0391006
4  |    .041815   .0181077     2.31   0.021     .0063246    .0773054
5  |   .0768499   .0413396     1.86   0.063    -.0041742     .157874
------------------------------------------------------------------------------

and this next command gets me the following results:

margins if incomplete==0 & scenario>1 & support_b4_12==1, at(windsupport_aftercomp =(1(1)5)) atmeans noatlegend predict(outcome(3));

Results:

Expression   : Pr(support==3), predict(outcome(3))

------------------------------------------------------------------------------
|            Delta-method
|     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_at |
1  |   .0029983   .0016072     1.87   0.062    -.0001517    .0061483
2  |   .0116547   .0044805     2.60   0.009     .0028731    .0204362
3  |   .0441348   .0124903     3.53   0.000     .0196543    .0686153
4  |   .1523184   .0403456     3.78   0.000     .0732425    .2313943
5  |    .403774   .0997545     4.05   0.000     .2082588    .5992892
------------------------------------------------------------------------------

I want to essentially estimate and test the difference for the following: 1st estimate in the second table minus 1st estimate in the first table: .0029983 - .006218
and then repeat for each value of my independent variable (i.e. _at 2, 3, 4, and 5)

I'd greatly appreciate it if anyone has any ideas on how to write the code for this.

I think I would need to save
r(b)                estimates
r(V)                variance-covariance matrix of the estimates

Sincerely,
Ross Leupp Hanig

___________________________
Ross Leupp Hanig
Assistant Professor
University of Portland
5000 North Willamette Boulevard
Portland, Oregon 97203-5798
Office telephone: 503-943-7424
E-mail: hanig@up.edu

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```