Statalist The Stata Listserver


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

st: RE: Rép. : st: RE: formatting and exporting ttest results


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Rép. : st: RE: formatting and exporting ttest results
Date   Wed, 12 Apr 2006 16:09:33 +0100

If you followed this route, you would 
also need to have -univar- installed. 

I suspect -estout- after -regress- 
can give you a competitive solution, but 
I have never used it, so can't advise in
detail. 

Nick 
n.j.cox@durham.ac.uk 

Herve STOLOWY
 
> Sorry, I did not see your first posting. I just discovered 
> Nick's reply. Some time ago, I raised the same issue and 
> received several replies which helped to find a solution. But 
> this solution, as Nick said, is not a "short answer". 
> 
> If you make a ttest with a groupvar, you can use -statsmat- 
> and -makematrix- (downloadable from ssc)(with -ttest-) 
> followed by -mat2txt- (downloadable from ssc) to get a .txt file.
> 
> Here is an example I used for one research project:
> 
> statsmat size1, s(N mean sd) by(format_bs) mat(mat1)
> makematrix mat2, from(r(t) r(p)) label : ttest size1, by(format_bs)
> matrix mat3=mat2' //Transposition of the matrix
> matrix mat4 = mat1, mat3 // Grouping of the two matrices
> matrix colnames mat4 = "Number of observations" Mean 
> "Standard deviation" "Student t-test"
> mat2txt, matrix(mat4) saving(univariate_bs) replace
> 
> If you want to compare two variables with a ttest, here is 
> another example and solution:
>  
> makematrix T5A1, from(r(N) r(mean) r(sd) r(min) r(p50) 
> r(max)) label : univar MAPE_direct_scal MAPE_indirect_scal if 
> outlier_cfo_scal!=1 &outlier_MAPE!=1
> ttest MAPE_direct_scal = MAPE_indirect_scal if 
> outlier_cfo_scal!=1 &outlier_MAPE!=1
> mat T5A2 = r(p) \ r(t)
> mat T5A3 = T5A1, T5A2
> matrix colnames T5A3 = N "Mean" "Std Dev" "Min" "Median"  
> "Max" "T/p-value"
> mat2txt, matrix(T5A3) saving(stat_MAPE_table5A)  replace
> 
> The syntax might not the most effective but I know these 
> commands work.

> >>> n.j.cox@durham.ac.uk 12/04/06 13:50 >>>
> The short answer is: Evidently not. 
> 
> However, as a t-test comparing two group means 
> is really a regression in disguise, you 
> should be able to use your favourite post-regression
> program for this purpose. 
> 
> Nick 
> n.j.cox@durham.ac.uk 
> 
> Ina Ganguli
>  
> > I was wondering whether there is a command (like -outreg-) I can use
> > to format and export multiple -ttest- results to a .txt file for
> > easier conversion to tables?
> > 
> > I would like to have results in the following format:
> > 
> >                     Group1     Group2     Difference
> > variable1       mean       mean        mean*
> >                       (se)          (se)          (se)
> > variable2       mean       mean        mean*
> >                       (se)          (se)          (se)
> > etc.
> > 
> > I've seen references to commands that may perhaps be what I need
> > (-tabexport-, -parmby-?), but I wanted to check whether there is a
> > program/command out there that would work well for this. 

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