Thanks to everybody who replied to my graphing question.
My goal was to plot predicted probability confidence intervals for
multinomial logit results, with the probability bands having some
transparency so the reader could see what was going on.
I thought it might be useful to indicate what worked how well, offer a
very brief HOWTO, and offer some simple examples.
In the end, I used R. The samples are up at:
http://www.psci.unt.edu/~battista/ci_plots
ALTERNATIVE ONE: Apply transparency in Word.
(1) Run the model and use the prgen() facility.
(2) Create the graph with
twoway rarea y1LB y1UB x || rarea y2LB y2UB x || rarea y3LB y3UB x
(3) Dump graph to wmf, open in Word
(4) Apply colors and transparency as desired.
The good: it was easy.
The bad: the resulting pdf to feed into pdflatex was clunky. I suspect
this is a result of the local pdf software and that more recent might do
better.
ALTERNATIVE TWO: Do in R
(1) Run the model and use the prgen() tool.
(2) Dump the probability data to a csv.
(3) Edit the csv. This seems to be necessary because the polygon()
function in R is easily confused. The requisite steps are:
A) Grab the relevant X column and the varUB column
B) Flip them both, so that the X goes from high to low
--- the varUB column should also be flipped
C) Paste the resulting columns under the X column and under the varLB
column.
Doing this creates a single X and Y datastream that ``goes around'' the
polygon without confusing the polygon() call.
This could also be done directly in R. I simply found it easier to
grab and twist the columns in Excel, to my infinite shame.
(4) Load data into R
(5) This R worked:
pdf("g:/sd_color.pdf", version = "1.4")
#open output filename. This one displays probability of inliers
#and outliers and normal cmtes in response to changes in maj
#homogeneity
plot(sdx,sdpOUTlb,type="n",ylim=c(0,1),main='',xlab="Maj.Homogeneity",ylab="Pred.probabilities")
#this creates an empty graph of the correct size with labels etc
#the polygons get dumped into it
polygon(sdx,sdpOUT,col=rgb(.9,0,0,.8))
#plots the probability of outlying cmte in red with transparency
#the rgb() is rgb(red,green,blue,alpha)
#the sdx column and sdpOUT column are modified as in step 3
polygon(sdx,sdpIN,col=rgb(0,.9,0,.8))
polygon(sdx,sdp0,col=rgb(0,0,.9,.8))
dev.off()
#draws the other CI bands in green and blue and closes the file
And on to the next plot.
This was obviously more difficult than doing it in Word, but I was
happier with the output.
--
James S. Coleman Battista
Dept. of Political Science, Univ. of North Texas
[log in to unmask] (940)565-4960
**********************************************************
Political Methodology E-Mail List
Editor: Karen Long Jusko <[log in to unmask]>
**********************************************************
Send messages to [log in to unmask]
To join the list, cancel your subscription, or modify
your subscription settings visit:
http://polmeth.wustl.edu/polmeth.php
**********************************************************
|