Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Creating print-ready tables for one-sample t-tests


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Creating print-ready tables for one-sample t-tests
Date   Thu, 6 Dec 2012 10:42:02 -0500

Tim Streibel <Tim.Streibel@gmx.de>:

So, it's not just different variables, or different models, but a
larger set of changed circumstances over which you wish to iterate?

I still doubt whether this whole exercise is a good idea, since these
results should be obtained from one large regression (or Bayesian
exercise), not a series of t-tests assuming independence, and I don't
know how you plan to pick an appropriate size of test: see help _mtest
for starters.

But you can always build your own file from scratch, for the general
table-writing problem:

sysuse auto, clear
file open h using x.doc, replace write
file write h "{\rtf1\ansi\deff0 {\fonttbl{\f0\fnil Times New Roman;}}"
file write h _n "{\info {\author .}{\company .}{\title .}}"
file write h _n "\deflang1033\plain\fs24"
file write h _n "{\footer\pard\qc\plain\f0\fs24\chpgn\par}"
file write h _n "{"
file write h _n "Draft of `c(current_date)' `c(current_time)'{\par}"
file write h "{\trowd\trgaph108\trleft-108"
file write h "\clbrdrt\brdrw10\brdrs\cellx2268"
file write h "\clbrdrt\brdrw10\brdrs\cellx4284"
file write h "\clbrdrt\brdrw10\brdrs\cellx6300"
file write h "\clbrdrt\brdrw10\brdrs\cellx8316"
file write h "\pard\intbl\ql {Variable and model}\cell "
file write h "\pard\intbl\qc {Mean}\cell "
file write h "\pard\intbl\qr {t for H0:mean=0}\cell "
file write h "\pard\intbl\ql {Stars}\cell\row}" _n
foreach v of var price-turn {
 qui ttest `v'=0
 loc s=cond(r(p)<.05,"*","")
 loc s="`s'"+cond(r(p)<.01,"*","")
 loc s="`s'"+cond(r(p)<.001,"*","")
 di r(mu_1),r(t),r(p) "`s'"
 file write h "{\trowd\trgaph108\trleft-108"
 file write h "\cellx2268"
 file write h "\cellx4284"
 file write h "\cellx6300"
 file write h "\cellx8316"
 file write h "\pard\intbl\ql {`: var lab `v''}\cell "
 file write h "\pard\intbl\qc {`: di %7.3g `r(mu_1)''}\cell "
 file write h "\pard\intbl\qr {`: di %7.3g `r(t)''}\cell "
 file write h "\pard\intbl\ql {`s'}\cell\row}" _n
 }
file write h _n "}" _n
file write h "{\par}{\par}" _n
file write h _n "}" _n _n
file write h _n "}" _n
file close h
!x.doc

On Thu, Dec 6, 2012 at 9:26 AM, Tim Streibel <Tim.Streibel@gmx.de> wrote:
> I am measuring abnormal stock returns, so I have a number of datasets consisting of thousands of abnormal returns (resulting from different models, holding periods etc) and then I am applying a convetional t-test (and also other manually coded tests) to check whether their mean significantly diverges from zero. Now I want to incorporate the means their test statistics and the resulting p-values (in form of stars if possible) into a table reporting these three values for a number of different settings (in e.g. 3 columns and 2-3 panels). So it's always the same variable, which was computed under different assumptions and therefore has different values. If you need more information just let me know what you need exactly?
> Thanks
>
> -------- Original-Nachricht --------
>> Datum: Tue, 4 Dec 2012 18:01:04 -0500
>> Von: Austin Nichols <austinnichols@gmail.com>
>> An: statalist@hsphsun2.harvard.edu
>> Betreff: Re: st: Creating print-ready tables for one-sample t-tests
>
>> Tim Streibel <Tim.Streibel@gmx.de>:
>> What are the variables? Can you provide more context?
>>
>> On Tue, Dec 4, 2012 at 5:22 PM, Tim Streibel <Tim.Streibel@gmx.de> wrote:
>> > Actually I am really using ttest variable==0 and I think it is
>> appropriate due to several reasons (distribution, sample size and literature).
>> However, I just want to create different tables which include some description
>> in the first row and first column and is divided into several panels. I
>> guess I should also mention that the table shall consist of means t-statistics
>> and p-values (in form of stars) resulting from different ttests. I hope
>> thats possible?
>> >
>> > -------- Original-Nachricht --------
>> >> Datum: Mon, 3 Dec 2012 12:06:24 -0600
>> >> Von: Rebecca Pope <rebecca.a.pope@gmail.com>
>> >> An: statalist@hsphsun2.harvard.edu
>> >> Betreff: Re: st: Creating print-ready tables for one-sample t-tests
>> >
>> >> -estout- may still work for you, but more detail on your question
>> >> would be helpful here. E.g. are you using -ttest- against some
>> >> particular value (my guess because that would be informative)? If so,
>> >> this information can be saved in a matrix which -estout- can access.
>> >> -estout-, by the way, is a user-written program (I assume -xml_tab- is
>> >> too) and should be cited as such.
>> >>
>> >>
>> >> Rebecca
>> >>
>> >>
>> >>
>> >> On Mon, Dec 3, 2012 at 11:18 AM, Tim Streibel <Tim.Streibel@gmx.de>
>> wrote:
>> >> >
>> >> > Hey all,
>> >> >
>> >> > I am experiencing the following problem: I want to present the
>> results
>> >> (mostly just means and the overall t-statistic (maybe also the
>> resulting
>> >> p-values) from one-sample t-tests) in a proper style as you can find
>> them in
>> >> journal articles.
>> >> > However, I've only found commands doing that for regression like
>> estout
>> >> or xml_tab. Can you give me a tipp how to do that for t-tests?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index