# st: RE: Saving RRR with mlogit/ologit

 From "Yulia Marchenko" To Subject st: RE: Saving RRR with mlogit/ologit Date Thu, 10 Feb 2005 13:47:22 -0600

```Paolo wrote:

>Does anybody know a similar method using mlogit and ologit command?

You can use -lincom, eform- sequentially for each of the coefficient in your
model. Below is the program called myeform that does it. It takes two
arguments: name of the command and the number of equations. It returns in
r(b) the matrix of estimated OR/RRR and in r(se) their corresponding
standard errors. You can then use those two matrices to construct confidence
intervals.

Note also that you can use -nlcom- to get exponentiated coefficients and
their standard errors. For example,

. sysuse auto, clear
. logit for mpg weight, or
. nlcom exp(_b[mpg])

Here is the program:

/*****begin do file**************/
capture program drop myeform
program myeform, rclass
args cmd eqnum
local varlist: colfullnames e(b)
forvalues i=1/`eqnum'{
if "`cmd'"=="mlogit"{
local cons `cons' `i':_cons
}
if "`cmd'"=="ologit"{
local cons `cons' _cut`i'
}
if "`cmd'"=="logit"{
local cons _cons
}
}
local varlist: list varlist - cons
local size: list sizeof varlist
mat b=J(1,`size',0)
mat se=J(colsof(b),colsof(b),.)
mat colnames b=`varlist'
mat colnames se=`varlist'
mat rownames se=`varlist'
qui foreach var of local varlist{
tokenize `var', parse(:)
lincom [`1']`3', eform
mat b[1,colnumb(b,"`var'")]=r(estimate)
mat se[colnumb(b,"`var'"),colnumb(b,"`var'")]=r(se)
}
return matrix b=b
return matrix se=se
end

*-----------------example on how to use it-----------------
sysuse auto, clear
logit for mpg weight, or
myeform logit 1
mat list r(b)
mat list r(se)
mlogit rep78 mpg weight, rr
myeform mlogit 4
mat list r(b)
mat list r(se)
ologit rep78 mpg weight, or
myeform ologit 4
mat list r(b)
mat list r(se)
/************end do file*****************/

--Yulia
ymarchenko@stata.com

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```