Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: RE: Easy Question: pvalues for means for groups


From   Joe Canner <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: Easy Question: pvalues for means for groups
Date   Fri, 6 Sep 2013 17:39:04 +0000

Ben,

While you will have to do some of the formatting yourself, you could use -ttest price==0- and then grab r(mu_1), r(se), r(t), r(p), etc.

Of course, if you want to stratify by type, you will have to loop through the levels of type and get the values you want each time through the loop.  As per a recent thread, -bys type:- will probably not work, because you can't get the values for each level.

Regards,
Joe Canner
Johns Hopkins University School of Medicine

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ben Hoen
Sent: Friday, September 06, 2013 1:16 PM
To: [email protected]
Subject: st: Easy Question: pvalues for means for groups

Hi all,

I am trying to find a simple way to output a set of tests (e.g., p-values) of means (i.e., are they different from 0) across groups (there are 6 of them).  Ideally .tabstat, which outputs a mean and a se would also produce a pvalue (in this case, the probability that the mean is different from zero) because that tabular output is preferable.  

**** example ****

sysuse auto, clear
g type=round((runiform()*5)+1)
tabstat price, stat(mean sem) by(type)  //in addition to these two stats it would, ideally, produce a p-value

***** end *******

I can use .reg, of course, but I then I need to convert the coef using the constant.

**** example ****

sysuse auto, clear
g type=round((runiform()*5)+1)
reg price ib1.type  

***** end *******

I suspect I am missing something very obvious, but I have not been able to figure it out.  Anyone able to quickly send me on my way?

Thanks, in advance,

Ben


Ben Hoen
Staff Research Associate
Lawrence Berkeley National Laboratory
Office: 845-758-1896
Cell: 718-812-7589
[email protected]
http://emp.lbl.gov/staff/ben-hoen

Visit our publications at: 
http://emp.lbl.gov/reports/re

Sign up for our email list to receive publication notifications at: 
https://spreadsheets.google.com/a/lbl.gov/spreadsheet/viewform?formkey=dGlFS
1U1NFlUNzQ1TlBHSzY2VGZuN1E6MQ





*
*   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/

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index