Statalist


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

st: ttest, signrank, ranksum with for each?


From   René Geppert <[email protected]>
To   [email protected]
Subject   st: ttest, signrank, ranksum with for each?
Date   Mon, 15 Dec 2008 15:22:14 +0100

Hello,

what I wanna do is the following:

I am having data for 2 groups. For the first group I have 6 quarters of observations, for the second group I have 2 quarters. 1. Q 2007 - 2. Q 2008, and 1. Q 2008 - 2. Q 2008 respecively.
Data are in long format, like this.
Company - Year - Quarter - Variable1 - Group
abc corp - 2007 - 1 - 0.4 - 1
abc corp - 2007 - 2 - 0.1 - 1
abc corp - 2007 - 3 - 0.05 - 1
abc corp - 2007 - 4 - 0.11 - 1
abc corp - 2008 - 1 - 0.70 - 1
abc corp - 2008 - 2 - 0.0 - 1
def corp - 2008 - 1 - 0.1 - 0
def corp - 2008 - 2 - 0.8 - 0
ghi corp...and so on

I now wanna perform difference in means and difference in medians tests for 'Variable1' for both, changes from quarter to quarter within each group (0 and 1) and differences among the groups within one quarter. Similarly, I want to test for difference in medians using signrank for differences within one group across quarters and within one quarter across groups using ranksum. So: What I basically want to examine is, have there been any significant changes in variable 1 between the quarters and between the groups?

Because multiple observations exist for 'Quarter', I cannot simply do a command like:
. ttest Variable1, by(Group) cuz this captures all the quarters at once
I tried nested if-criteria which doesn't work.
So I presume this might be possible using a for each command, anyone got an idea?

thx and regards, René
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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