Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Nikolaos Pandis <npandis@yahoo.com> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

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

Date |
Thu, 3 Nov 2011 08:01:23 -0700 (PDT) |

Phil, Looks great! I just had to change increments to better serve my needs. Many thanks. Nick ________________________________ From: Philip Ryan <philip.ryan@adelaide.edu.au> To: statalist@hsphsun2.harvard.edu Sent: Thursday, November 3, 2011 2:05 PM Subject: RE: st: RE: RE: generate graph (try 2) <<>> 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: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nikolaos Pandis Sent: Thursday, 3 November 2011 9:21 PM To: statalist@hsphsun2.harvard.edu Cc: npandis@yahoo.com 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: 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/

**References**:**st: generate graph***From:*Nikolaos Pandis <npandis@yahoo.com>

**Re: st: RE: RE: generate graph (try 2)***From:*Nikolaos Pandis <npandis@yahoo.com>

**RE: st: RE: RE: generate graph (try 2)***From:*"Philip Ryan" <philip.ryan@adelaide.edu.au>

- Prev by Date:
**Re: st: Looking for simple examples, with data, regarding STRUCTS in Mata** - Next by Date:
**st:Forest plot with p from overall z test** - Previous by thread:
**RE: st: RE: RE: generate graph (try 2)** - Next by thread:
**RE: st: moderated mediation logistic outcome** - Index(es):