Statalist


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

Re: st: Table for difference in means test


From   Ronan Conroy <rconroy@rcsi.ie>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Table for difference in means test
Date   Sun, 22 Jul 2007 18:34:00 +0100

On 22 Jul 2007, at 00:35, Hugh Colaco wrote:

I am doing a difference in means test and am having problems
displaying a table. My variables names are q52-q61. I have a
categorical variable q2q6 which takes the value 1 or 2. I need the
table in the following format, based on the categorical variable. N =
no of obs.

Variable        N1     Mean1      N2         Mean2       p-value
You might think of displaying the actual difference between the means and its confidence interval, which helps the reader by doing the subtraction sum for him/her and also giving a margin of uncertainty about the result, neither of which your proposed format does.

Note that this is an easy matter using -regress-,

. sysuse auto
(1978 Automobile Data)

. regress mpg foreign
[snip]

------------------------------------------------------------------------ ------
mpg | Coef. Std. Err. t P>|t| [95% Conf. Interval]
------------- +----------------------------------------------------------------
foreign | 4.945804 1.362162 3.63 0.001 2.230384 7.661225
_cons | 19.82692 .7427186 26.70 0.000 18.34634 21.30751
------------------------------------------------------------------------ ------

The coefficient for foreign is the difference between the means. (If you want the equivalent of a t-test for unequal variances, specify - robust-).

This doesn't solve the problem of giving N1 and N2, but otherwise I think it's a more useful line of output.


P Before printing, think about the environment
=================================
Ronan Conroy
rconroy@rcsi.ie
Royal College of Surgeons in Ireland
120 St Stephen's Green, Dublin 2, Ireland
+353 (0)1 402 2431
+353 (0)87 799 97 95





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