Re: st: RE: RE: generate graph (try 2)

Dear Phil,
The first piece of code worked well, the second had a minor issue on the twoway part probably from copy/paste etc-I fixed it no problem
On a more careful reading of the code, although the graphs have a similar look to what want, I am wondering if this is not the graph I need.
On the x-axis I would like to show the p-value and how the p-value decreases for a given effect/sd (effect/sd remain constant) as we increase the sample size. The idea is to show how interpreting trial results from p-values may be misleading as you may have an uniportant clinical effect which may be statistically significant or nonsignificant depending on the sample size used.
If I unerstood correctly the code you supplied indicates how the sample size requirements decrease as the a-level changes?
Please advise.
Many thanks,
Nick
----- Original Message -----
From: Philip Ryan <philip.ryan@adelaide.edu.au>
To: statalist@hsphsun2.harvard.edu
Cc:
Sent: Thursday, November 3, 2011 9:48 AM
Subject: st: RE: RE: generate graph (try 2)
<<>>
For reasons not clear to me, the return from my own initial posting seemed
to have left out some carriage returns that were present in what I sent.
Perhaps this, inserting several double carriage returns, will be better. (Of
course, code should be run from the do file editor).
*==== begin code ====*
clear
tempname temp_ss
local sd .75
local pow 0.8
local m1 0.35
local m2 0
quietly {
postfile `temp_ss' sample_size alpha using my_ss, replace
forvalues alpha = .01(.01).2{
sampsi `m1' `m2', alpha(`alpha') power(`pow') sd(`sd') r(1)
post `temp_ss' (r(N_1)) (`alpha')
}
postclose `temp_ss'
}
/* now make use of our new data set */
use my_ss
list, clean abbrev(16)
graph twoway line sample_size alpha, /// ytitle("sample size in each
group") xlabel(0(.01).2) ///
lwidth(medthick) lcolor(blue)
*=== end code ===
Philip Ryan
Professor and Director
Data Management & Analysis Centre
School of Population Health & Clinical Practice
University of Adelaide
Postal address:
DMAC
Mail Drop DX650 511
University of Adelaide 5005
South Australia
Australia
location:
Level 6
Bice Building
Royal Adelaide Hospital
North Terrace
Adelaide SA
tel: +61 (0)8 83033570
fax: +61 (0)8 82234075
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Philip Ryan
Sent: Thursday, 3 November 2011 6:04 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: generate graph
<<>>
Something like this (grafting onto -sampsi-) ?:
*==== begin code ====*
clear
tempname temp_ss
local sd .75
local pow 0.8
local m1 0.35
local m2 0
quietly {
postfile `temp_ss' sample_size alpha using my_ss, replace
forvalues alpha = .01(.01).2{
sampsi `m1' `m2', alpha(`alpha') power(`pow') sd(`sd') r(1)
post `temp_ss' (r(N_1)) (`alpha')
}
postclose `temp_ss'
}
/* now make use of our new data set */
use my_ss
list, clean abbrev(16)
graph twoway line sample_size alpha, ///
ytitle("sample size in each group") xlabel(0(.01).2) ///
lwidth(medthick) lcolor(blue)
*=== end code ===
Philip Ryan
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nikolaos Pandis
Sent: Thursday, 3 November 2011 5:34 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: generate graph
Hi to all.
I was wondering if someone could help me generate the following graph:
twoway line graph showing on the y-axis: sample size and on the x-axis:
p-value.
The objective is to show how the p-value decreases (increases) as the sample
size increases (decreases) given the same effect size and sd
Many thanks,
Nick
*
* 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/