Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: interactive variables with mlogplot in a multinomial logit

From   Barry Ames <>
To   stata <>
Subject   st: interactive variables with mlogplot in a multinomial logit
Date   Wed, 8 Sep 2004 12:19:41 -0700 (PDT)

    Here's my problem:  Because I'm running a
multinomial logit with lots of categories, I use
prchange and mlogplot from Spost.  This works fine
except when I use interactive independent variables. 
If I have independent variables A, B, and AxB, then
mlogplot would only calculate, I think, the value of a
A when B is zero.  This is useless, as you can

   I have a do file that calculates the coefficients
for the two interacted variables for any value of the
other variable.  In the example that follows, A is Var
1 and B is Var2 and Lula and Serra are two categories
of the dependent variable (actually there are many
more). First I run the mlogit command, in this case
with clustering on a variable called bairro1.  then I
run the following do file.

do c:\temp\neigh; 
neigh A B AxB Lula Serra;

capture program drop neigh
program define neigh
quietly summ `1'
local mean1=r(mean)
local sd1=r(Var)^.5

sort bairro1$which
egen tempneigh=mean(`2'), by (bairro1$which)
by bairro1$which: gen tempnumber=_n
quietly summ tempneigh if tempnumber==1
drop tempneigh tempnumber
local mean2=r(mean)
local sd2=r(Var)^.5
local var1="`1'"
local var2="`2'"
local var3="`3'"
while "`4'"~=""{
display "The following is the slope of `var1' for
`4'/base when `var2' is 1 standard deviations BELOW
its mean
lincom (`mean2'-1*`sd2')*[`4']`var3'+[`4']`var1'
mac shift


   So here the program is calculating, for the first
variable in the interaction, the coefficient and
standard errors for five different values of the other
interacted variable.  What I need to do is to link
this to mlogplot so that I can show the impact of the
variable at various values of the other variable.

  any ideas?
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index