Naomi--
I can't see how you can have 3 graphs of RRR when you have three
categories of outcome, unless you change the base case (you have to
compare two to the other, right?). You can, however, have three
graphs of mean predicted probabilities versus some RHS variable, and
there are several ways of calculating these mean predicted
probabilities, corresponding to different assumptions/counterfactuals.
Try this example out:
webuse nlswork, clear
bys id (year): drop if _n<_N
g urb=1+!(not_smsa==1)+c_city
la def urb 1 "Rural" 2 "Suburban" 3 "Urban"
la val urb urb
qui tab race, gen(dr)
qui tab age, gen(da)
gen hg=grade
replace hg=8 if hg<8
la var hg "Years of education"
forv h=8/18 {
qui g ed`h'=(hg==`h') if hg<.
}
qui mlogit urb ed* dr* da* south union
predict p1 p2 p3
forv i=1/3 {
qui g mp`i'=.
forv h=8/18 {
su p`i' if hg==`h', meanonly
qui replace mp`i'=r(mean) if hg==`h'
}
}
forv i=1/3 {
qui g cp`i'=.
}
forv h=8/18 {
qui replace ed`h'=0
}
forv h=8/18 {
if `h'>8 replace ed`=`h'-1'=0
qui replace ed`h'=1
cap drop p?
qui predict p1 p2 p3
forv i=1/3 {
su p`i', meanonly
qui replace cp`i'=r(mean) if hg==`h'
}
}
sort hg
qui {
foreach v in mp1 mp2 mp3 cp1 cp2 cp3 {
by hg: replace `v'=. if _n>1
}
}
local o `"leg(order(1 - 2 - 3) lab(1 "Rural") lab(2 "Suburban") lab(3
"Urban"))"'
line mp1 mp2 mp3 hg, `o' name(m, replace) ti(Mean P within group)
line cp1 cp2 cp3 hg, `o' name(c, replace) ti(Mean P across groups)
On 5/9/07, Naomi Spence <[email protected]> wrote:
I am using a multinomial logit model to predict type of
violence--variable name "violence" with values 0=none, 1=psychological,
2=physical. My main independent variable of interest is an index
"malsum" that ranges from 0-12.
I want a graph that depicts changes in "violence" with increasing values
of "malsum." I'm visualizing a graph with 3 lines--one for each outcome
category on "violence". Ideally, I would like the y axis to show the
relative risks (I'm using mlogit option rrr), but I'll settle for
predicted probabilities. I have tried a few different things, but the
best I can do gives me 3 separate graphs with 1 line each that I can
"combine" to put them on one panel but I'd like to have the 3 lines on
the same graph.
*
* 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/