Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: estout and stats option


From   "raoul reulen" <r.c.reulen@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: estout and stats option
Date   Thu, 22 May 2008 09:23:07 +0100

This works. Thanks Ben, much appreciated.

Raoul

2008/5/21 Ben Jann <ben.jann@gmail.com>:
> You'd have to use a matrix to add the p-value to e(). Assuming that
> there is only a constant in the model you could do something like
> this:
>
> forvalues i = 1/26  {
>        metareg log_srr if group`i' == 1 , wsse(selog_srr)
>        mat pval = e(b)
>        mat pval[1,1] = chi2tail(e(df_Q), e(Q))
>        estadd matrix pval
>        estout . , cells("b(fmt(%9.1f)) & ci(par( ( - ) )) pval")
> }
>
> ben
>
> On Wed, May 21, 2008 at 3:53 PM, raoul reulen <r.c.reulen@gmail.com> wrote:
>> Dear all,
>>
>> I'm running a meta-regression within a loop and want to use estout to
>> write the output to an excel file.
>> I want to run the regression model for several different groups and
>> have used a loop to do this.
>> Estout works fine, but I also want to add a certain p-value by using
>> the stats option (see example below). Estout puts the p-value
>> below the estimate in the same column. I wondered whether it is
>> possible to put the p-value in a separate column.
>> Thanks very much,
>>
>>
>>
>> .forvalues i = 1/26  {
>> .metareg log_srr if  group`i' == 1 , wsse(selog_srr)
>> .est store m1
>> .estadd scalar pval`i' = chi2tail(e(df_Q), e(Q)):m1
>>
>> .estout m1  using "C:\data\ma_reg.xls",  ///
>> cells("b (fmt(%9.1f)) & ci(par( ( - ) ))" ) eform  ///
>> varlabels( _cons "group`i'" )            ///
>> label collabels(, none)  mlabels(, none) stats( pval`i'  )
>> }
>>
>>
>> Raoul
>> -------------------------------------------------------
>> Raoul C. Reulen
>> Cancer Research UK Training Fellow
>> *
>> *   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/
>>
> *
> *   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/
>



-- 
-------------------------------------------------------
Raoul C. Reulen
Cancer Research UK Training Fellow
*
*   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