Bookmark and Share

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


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

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


From   "Philip Ryan" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: RE: generate graph (try 2)
Date   Thu, 3 Nov 2011 22:35:40 +1030

<<>>

Nick 

Apologies, my mind was on sample size estimation and alphas, whereas it
should have been on testing and p values.

Using the same approach (-post-ing repeated results to produce a new data
set) but with -ttesti- rather than -sampsi-, try this (apologies in advance
if some carriage returns appear missing in what you receive): 

clear
tempname temp_p
local init 8
local incr 2
local final 20
local sd 10
local m1 20
local m2 10

quietly {

postfile `temp_p'  sample_size  pval  using  my_p, replace

forvalues ssiz = `=`init''(`=`incr'')`=`final'' {

ttesti `ssiz' `m1' `sd' `ssiz' `m2' `sd'

post `temp_p ' (r(N_1)) (r(p)) 

} 

postclose `temp_p'

} 

/* now make use of our new data set */

use my_p

list, clean abbrev(16)

graph twoway line  sample_size pval,  ///  
ytitle("sample size in each group")  ///
ylabel(`=`init''(`=`incr'')`=`final'', ang(hor) ) ///
lwidth(medthick) lcolor(red)

*=== end code ===

Philip Ryan
Professor and Director
Data Management & Analysis Centre
School of Population Health & Clinical Practice
University of Adelaide


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nikolaos Pandis
Sent: Thursday, 3 November 2011 9:21 PM
To: [email protected]
Cc: [email protected]
Subject: 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: [email protected]
[mailto:[email protected]] On Behalf Of Nikolaos Pandis
Sent: Thursday, 3 November 2011 5:34 PM
To: [email protected]
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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index