Title

mlincom -- Computing linear combinations of margins estimates

General syntax

mlincom exp [ , options ]

exp is the expression for a linear combination of estimates
from the last margins, post command or mtable, post.
Estimates are referred
to by number (1 for 1st, 2 for 2nd, et.). Valid expressions
include 1-2 and (1-2)-(3-4).
If no linear_combination is specified, the results from the last
mlincom are listed.

Overview

mlincom uses lincom to compute linear combinations of estimates
from margins, post. This lets you estimates discrete changes,
second differences, and other linear combinations.
Results can be accumlated from multiple mlincom commands.
Computing a second difference is as simple as
mlincom (1-2)-(3-4) which computes the difference betweeen the first
and second estimate from margins, the difference between the third and
fourth, and then the difference between these differences.

mlincom must be run when the results from margins were placed
in memory with the post option.

Table of contents

Which statistics to display
Controlling how results are displayed
Adding results to prior results
Matrices created
Examples

Options

Statistics to include in the table

statistics(list) select statistics to
display. The following statistics can be included
in list.

Name Description

estimate Estimated linear combination

ll Lower level bound of confidence interval

ul Upper level bound of confidence interval

pvalue p-value for test estimate is 0

se Standard error of estimate

z z-value

noci Only display estimate

all Display all statistics

Controlling what is displayed

rowname(string) Label for row of table. By default rows
are numbered.

roweqnm(string) Add row equation name to table. See matrix rownames

twidth(#) Width of the columns in table.

detail Show output from lincom in addition to table.

notable Show only lincom output.

width(#) Width of the columns in table.

decimal(#) Decimal digits displayed in table.

estname(string) Column name labeling estimates in table.

title(string) Display string above table.

Add results to the table

Results from mlincom are save to the matrix _mlincom. You can
add new rows to an existing matrix _mlincom to create a table combining
results from multiple uses of mlincom.

add Add current results to those saved from an earlier.
All of the mlincom commands must include the same statistics from stat().

clear Clear results saved from prior mlincom.

Matrices used by mlincom

mlincom saves the current table to the matrix _mlincom, adding
them to what is in the matrix if option add is used. The matrix
has columns corresponding to the displayed results. In addition, the
matrix _mlincom_allstats contains all statistics, not just those in
the table.

Examples

Example 1: Test discrete change for wc when k5 = 0

. sysuse binlfp2,clear

. logit lfp k5 k618 age wc hc lwg inc, nolog

. estimates store blm

. margins, at(k5=(0) wc=(0 1)) atmeans post

. mlincom 2-1, rown(DCwc_k5is0)

. estimate restore blm

Example 2: Loop through tests of DC as values of k5 change

mlincom, clear // remove any prior results

foreach k in 0 1 2 3 {

local i = `k' + 1

qui estimate restore blm

qui margins, at(k5=(`k') wc=(0 1)) atmeans post

qui mlincom 2-1, add rowname(DCwc_k5is`k')

}

mlincom

estimate restore blm

Example 3: Second difference at means and average of difference

. estimate restore blm

. margins, at(wc=1 hc=1) at(wc=0 hc=1) at(wc=1 hc=0) at(wc=0 hc=0) atmeans post

. mlincom (1-2)-(3-4), clear rowname(atmeans) stats(est p ll ul)

. estimate restore blm

. margins, at(wc=1 hc=1) at(wc=0 hc=1) at(wc=1 hc=0) at(wc=0 hc=0) post

. mlincom (1-2)-(3-4), add rowname(average) stats(est p ll ul)

Example 4: Access matrix of mlincom

. estimate restore blm

. margins, at(wc=1 hc=1) at(wc=0 hc=1) at(wc=1 hc=0) at(wc=0 hc=0) atmeans post

. mlincom 2-1, clear stats(all)

. mlincom 4-3, stats(all) add

. matrix list _mlincom