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

st: RE: "extracting" the p-value from a t-test


From   "Maarten Buis" <M.Buis@fsw.vu.nl>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: "extracting" the p-value from a t-test
Date   Thu, 24 Nov 2005 14:07:15 +0100

Andrei:

The results are saved in r(), type -return list-. I have used the auto dataset, since it is easier to use datasets already available with Stata:

sysuse auto, clear
ttest price, by(foreign)
return list
di r(p)
local p = r(p)
di `p'

If you want to test many hypotheses than it may be worthwhile to look at bonferroni corrections. 

HTH,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z214 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Andrei Malinovschi
Sent: donderdag 24 november 2005 13:55
To: statalist@hsphsun2.harvard.edu
Subject: st: "extracting" the p-value from a t-test

Dear statalisters,

I have quite a beginner's question, but due to the
fact that I could not find the (whole) answer I
decided to bother you with this.

I have to do lots of  t-tests in a dataset and I am
only interested in the p-value for each two-sided
t-test and not the whole listing that results from
running ttest.

My first guess was that it might be some system
variable (like _b or _se in the case of regressions) /
global macro where the p-value is stored, but after
reading the old messages from Statalist I've seen that
it is not so, but on the other hand STATA provides us
with the tools to calculate the p-value. I am
wondering if someone can give me a concrete example
how to do this for a very simple dataset:

ttest var1, by(var2)

var1   var2
32     1
324    1
523    2
525    2

Thank you in advance for your answer!

Best regards,
Andrei



       
               
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
*
*   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/



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