Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]

Second, exchanges on the statalist have suggested that the confidence
intervals calculated by nlcom may not be the what I want:

I would be grateful to hear recommendations regarding how to calculate
the odds ratios I want.

Is the approach in the code below okay?

Should I use the margins command instead?
When I have seen people use the margins command to get odds and then
calculate odds ratios, they have been working with interactions
between dummy variables and logistic regression.
For example:

I am not sure how to use margins with a dummy X continuous interaction
and a mlogit model where I must specify which outcome I want.  The use
of expression(exp(xb())) for getting the odds seems to preclude the
use of the predict() option that is used to specify which outcome to



*mlogit with binary by continuous interaction
*slightly modified from example posted at
sysuse auto, clear

// create an indicator variable that is
// 1 when an observation has valid values
// on mpg, price, and rep78, and 0 otherwise
gen byte touse = !missing(mpg, price, rep78)

// center mpg
sum mpg if touse, meanonly
gen c_mpg = mpg - r(mean)

// center price and change unit to 1000s of $
sum price if touse, meanonly

*recode price so cheapest car =0
gen c_price = (price - r(min))/1000  // I have changed this line to
subtract the min rather than the mean
sum c_price

// see the example FAQ
recode rep78 1/2 = 3
gen byte baseline = 1

// add value labels to rep78
label define rep78 3 "Average" ///
                   4 "Good"    ///
                   5 "Excellent"
label value rep78 rep78

// the model
mlogit rep78 foreign##c.c_price c_mpg baseline, rrr nocons  // the
original post had an interaction between c_mpg and c_price

*calculate odds ratio for foreign (outcome=Good) with 1,000-9,000
increases in price
sum c_price if e(sample)
foreach x of numlist 1/9 {
    di "Odds Ratio for foreign with a `x' thousand dollar increase in price."
    nlcom exp(_b[Good:1.foreign])*exp(_b[Good:1.foreign#c.c_price])^`x' - 1

Dr. Jeremy Reynolds
Associate Professor
Undergraduate Coordinator
Department of Sociology
117 Baldwin Hall
University of Georgia
Athens, GA 30602-1611
Phone: (706) 583-8072
Fax: (706) 542-4320
*   For searches and help try:

© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index