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]

Re: st: Need help making an ado for Tamhane test


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Need help making an ado for Tamhane test
Date   Fri, 31 May 2013 08:48:27 +0100

See the appropriate chapters in the User's Guide [U] or look at Kit Baum's

http://www.stata.com/bookstore/stata-programming-introduction/

Nick
[email protected]

On 31 May 2013 08:22, Marta García-Granero <[email protected]> wrote:

> Since I come from the SPSS programming world, my understanding of Stata
> programming is somewhere between nil and zero. Anyway, I have attempted
> (perpetrated?) to write some code for Tamhane's T2 multiple comparison of
> means with heterogeneous variances. The method is rather simple, it consists
> simply in unequal variances (Satterthwhite's method) t tests with Sidak
> adjustment of p-values.
>
> Right now, the code is rather automatic: it calculates the number of groups
> (assuming they are numbered starting from 1, and without gaps), number of
> comparisons, cycles through all the pairwise comparisons, and adjusts the
> two-tailed p-values.
>
> qui sum Status,meanonly
> local comp=r(max)*(r(max)-1)/2
> qui levelsof Status,local(levels)
> foreach i of local levels{
>     foreach j of local levels{
>         if `i'<`j'{
>         quietly ttest Hb if (Status==`i')|(Status==`j'), by(Status) unequal
>         display `i' " " _c
>         display "vs "`j' "    " _c
>         display  %6.4f 1-(1-r(p))^`comp'
>         }
>     }
> }
>
> To avoid having to edit it every time I want to use it, to replace "Hb" by
> the dependent variable name and "Status" by the grouping variable, I would
> like to turn it into a program, like this:
>
> tamhane Hb, by(Status)
>
> Unfortunately, I have hit the ceiling of my knowledge in Stata programming
> as it is right now. In a future I want to add some more output, like mean
> differences, standard error and the adjusted confidence intervals for mean
> differences, but I think that would be easy, since most of the information
> is available as r(something) (with the exception of the confidence limits,
> that should be computed using the t value for the Satterthwhite's df).
>
> Any hints (or directions concerning where to look for information)?

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