Statalist


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

st: cycling paired t test (and signed rank sum test)


From   Diego Bellavia <[email protected]>
To   STATAlist <[email protected]>
Subject   st: cycling paired t test (and signed rank sum test)
Date   Sun, 21 Oct 2007 01:06:39 +0000 (GMT)

Dear Statalisters, 

I have many (~ 500) variables to test in a paired design (I would like to perform both a paired t-test and a signed rank sum test).
To avoid typing all the variables I would like to define a double loop to perform the test for all the variables. 
Since all the variables, after the reshaping in wide format of the dataset are in the format a1 b1 c1... and a2 b2 c2, basing on STATA 
documentation I tried to implement arrays, and I ended up with something like 


#delimit ; 

local array1 "a1 b1 c1";
local array2 "a2 b2 c2";

local i = 1 ;

local n : word count `array1' ;

while `i' <= `n'  {;

 local var1 : word �i' of �array1';
 local var2 : word �i' of �array2';

 ttest `var1' = `var2';
 
local i = `i' + 1;

 };

#delimit cr 


but when i run it I get an "invalid syntax" error...I cannot understand why. 

Last question: to perform a paired t-test or signed rank sum test in STATA, I am forced to 
reshape the dataset in wide format or there is some way to accomplish paired tests with the 
dataset in long format ? 

Thank you in advance for any suggestion 

Diego


      ___________________________________ 
Scopri la community di Yahoo! Mail: trucchi, novit�, consigli... e la tua opinione! http://it.groups.yahoo.com/group/ymail/

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index