Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Question on graph twoway and graph combine

 From Alberto R Osella To statalist@hsphsun2.harvard.edu Subject Re: st: Question on graph twoway and graph combine Date Wed, 07 Dec 2011 10:39:23 +0100

```Dear Nick,
I'm using -seqlogit-. Here a portion of code:
xi: seqlogit steato_grade i.StatCiv Etarecl glicemia i.scalacat GOT GPT ///
if Sesso == 0, or                 ///
tree(0:1 2 3 , 1:2 3 , 2 : 3)     ///
ofinterest(BMI) over(Etarecl)          ///
levels(0=0, 1=1.5, 2=4, 3=5.1)

preserve

keep if e(sample)

replace StatCiv=2

sum BMI, meanonly
replace BMI = r(mean)
replace _BMI_X_Etarecl = BMI*Etarecl
bys Etarecl : keep if _n == 1

predict wM* , trweight
_estimates hold model1

mkspline  edad 8= Etarecl if Sesso==0
predict SwM1
predict SwM2
predict SwM3

_estimates unhold model1

forvalues i = 1/3 {
```
gen contr`i' = SwM`i'*([#`i']_b[BMI]+ [#`i']_b[ _BMI_X_Etarecl]*Etarecl)
```}

gen contr0 = 0
replace contr2 = contr1 + contr2
replace contr3 = contr2 + contr3

twoway rarea contr0 contr1 Etarecl  || ///
rarea contr1 contr2 Etarecl  || ///
rarea contr2 contr3 Etarecl,  ///
xlab(2(2)8)                ///
legend(order( 1 "Light or more vs. no" ///
2 "Moderate or more vs. light or less" ///
3 "Severe vs Moderate or less" ) pos(6))
graph save uomini, replace

```
I've said "I can't use". It may be: " I don't know how to use the by() option".
```Best

Alberto R. Osella, MD, PhD
Laboratorio di Epidemiologia e Biostatistica
IRCCS Saverio de Bellis
Via Turi, 27
70013 Castellana Grotte (BA)
Italia
Tel:    +39 0804994655
Fax:    +39 0804994650
e-mail: arosella@irccsdebellis.it

Il 07/12/2011 10:16, Nick Cox ha scritto:
```
```That's good advice, but I don't understand why -by()- couldn't be used
in the first place. What does any estimation process have to do with
graphing?

Nick

On Wed, Dec 7, 2011 at 9:09 AM, Phil Clayton
<philclayton@internode.on.net>  wrote:

```
```You could try -findit grc1leg-

On 07/12/2011, at 8:09 PM, Alberto R Osella wrote:

```
```I'm using Stata 12.0 on W7. I've drawn two graphs (one for each sex) by using -graph twoway- and then I've combined them by using -graph combine-. I've drawn graphics separately because I can't using the by() option as a result of the estimation process. The resulting combine graph has two legends (the same) and I want a graph with only one legend.
```
```*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

```
```*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```