Statalist


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

AW: AW: AW: AW: AW: AW: st: Re: graph question


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   AW: AW: AW: AW: AW: AW: st: Re: graph question
Date   Mon, 20 Apr 2009 16:42:08 +0200

<> 

Hmmm, works for me. Make sure that the code transfers well from your email
program to the do-file editor. My code should only wrap at the point where
the "///" line break is inserted.


HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Nikolaos Pandis
Gesendet: Montag, 20. April 2009 16:12
An: statalist@hsphsun2.harvard.edu
Betreff: Re: AW: AW: AW: AW: AW: st: Re: graph question

Dear Martin,
 
Thank you very much.
I get the error barwidth () option not allowed?
Any suggestions?
 
Nick

--- On Mon, 4/20/09, Martin Weiss <martin.weiss1@gmx.de> wrote:


From: Martin Weiss <martin.weiss1@gmx.de>
Subject: AW: AW: AW: AW: AW: st: Re: graph question
To: statalist@hsphsun2.harvard.edu
Date: Monday, April 20, 2009, 4:33 PM


<> 

In addition to Maarten`s excellent contribution, let me provide a final
solution for Nikolaos via the -eclplot- package by Roger Newson. I think it
pretty much does what he has wished for all along... 

*************
clear*

qui{
//create data
set obs 600

gen arm= cond(_n<301,0,1)
lab def arms 0 "control" 1 "experimental"
la val arm arms

egen float interval = fill(0 1 3 6 9 12 0 1 3 6 9 12)
egen float measurement = seq(), from(1) to(50) block(6)

//fictional value of measurement (no systematic diff btw control and
experimental group)
gen mymeasurement=rchi2(3)
}

//check
mean mymeasurement, over(arm interval)

//collapse
collapse (mean) mean=mymeasurement (semean) semean=mymeasurement, by(arm
interval)
gen lb= mean-invnormal(0.975)*semean
gen ub= mean+invnormal(0.975)*semean


//get -eclplot- by Roger Newson
cap ssc inst eclplot
//see what happened there...
di in red _rc

//graph
eclplot mean lb ub interval, eplot(bar) ciopts(blcolor(black))
estopts(barwidth(0.25)) ///
estopts1(bcolor(red)) estopts2(bcolor(blue)) supby(arm, spaceby(0.25))
xscale(range(0 6)) xlabel(0 1 3 6 9 12)
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Maarten buis
Gesendet: Montag, 20. April 2009 15:23
An: statalist@hsphsun2.harvard.edu
Betreff: Re: AW: AW: AW: AW: st: Re: graph question


--- On Mon, 20/4/09, Martin Weiss wrote:

> Let me think about combining those two w/o overlapping...

What about this:

*---------------- begin example ---------------------
clear*

qui{
//create data
set obs 600

gen arm= cond(_n<301,0,1)
lab def arms 0 "control" 1 "experimental"
la val arm arms

egen float interval = fill(0 1 3 6 9 12 0 1 3 6 9 12)
egen float measurement = seq(), from(1) to(50) block(6)

//fictional value of measurement (no systematic diff btw control and
experimental group)
gen mymeasurement=rchi2(3)
}

//check
mean mymeasurement, over(arm interval)

//collapse
collapse (mean) mean=mymeasurement (semean) semean=mymeasurement, by(arm
interval)
gen lb= mean-invnormal(0.975)*semean
gen ub= mean+invnormal(0.975)*semean


gen interval2 = cond(arm == 1, interval + .25, interval - .25)
twoway bar mean interval2, barwidth(.4) || ///
       rcap lb ub interval2,               ///
       xlabel(0 1 3 6 9 12)                ///
       xmlabel( -.25 "c"   .25 "e"         ///
                 .75 "c"  1.25 "e"         ///
                2.75 "c"  3.25 "e"         ///
                5.75 "c"  6.25 "e"         ///
                8.75 "c"  9.25 "e"         ///
               11.75 "c" 12.25 "e" )       ///
       legend(off)
*------------------- end example -------------------

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://home.fsw.vu.nl/m.buis/
-----------------------------------------





      

*
*   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/



      

*
*   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/



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