Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: postfile problem


From   Chris.Fergusson@STH.NHS.UK
To   statalist@hsphsun2.harvard.edu
Subject   st: postfile problem
Date   Thu, 6 Feb 2003 11:21:24 -0000

Dear Statalisters,

I'm trying to estimate power of a non-linear regression by simulation.
There are three parameters of interest and I can generate samples under H0
(no trend) and H1 (particular model of interest).

The problem is how to write the parameter estimates under H0 and H1 to a
file.  In the code below, the estimation is performed twice - under H0 and
H1.  What I would like to do is post the 6 estimates in one go to the output
file, rather than output to two separate files which would be merged.

forvalues i=1/5000 {
          /* evaluate when H0 true */
              replace err = 0 + 3.5*invnorm(uniform())
              replace tempy = 0 +err
                    nl hyp tempy dose, iterate(30) eps(0.0001)

 /* How do I save parameter estimates from H0 ? */

                 /* evaluate when H1 true */
                replace tempy = yh +err
                    nl hyp tempy dose, iterate(30) eps(0.0001)

   /* here I save the results from estimate given H1 */

             post `powerdat'  (_b[B0])  (_b[B1])  (e(r2_a))


Any thoughts anybody?  Ideally the last statement would be like:
         
           post `powerdat' (_b[B0])  (_b[B1])  (e(r2_a))  (_b[B0])  (_b[B1])
(e(r2_a))

 Where the first 3 are from the estimate under H0 and the second 3 are from
H1

Paul Silcocks BM MSc FRCPath FFPHM CStat
Assistant Director (Research & Intelligence)
Trent Cancer Registry
tel (+44) 114 2265351 / 2265665 (direct line)
                              
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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