# Re: st: ttest for multiple groups

 From jean ries To statalist@hsphsun2.harvard.edu Subject Re: st: ttest for multiple groups Date Wed, 27 Oct 2004 11:45:41 +0200

I think that you have mixed up two different syntaxes of -ttest-. In your case you should rather do
. bysort nations: ttest PolA == PolB

When you type:
. ttest PolA, by(nation)
where nation is a binary variable, you will test whether the attitude towards policy A is different in two countries

jean

Michael Cha wrote:

Dear listers,
Could you help me with this problem?
I have a data on police from 500 people from 10 different nations.
Now, I need to do paired t-test for variables PolA and PolB, each of which is about attitude toward police A and Police B.
But, I need to do the paired t-test for each countries to test the significance of the test results.
What I did in SPSS is as follows,
MEANS
TABLES=PolA PolB BY Nations
/CELLS MEAN COUNT STDDEV .

where PolA and PolB are the variables to compare and nations are 10 countries.
The output gives me a 10 by 2 tables as follows.
PolA PolB Significance
cnt1 3.4 4.3 ?
cnt2 3.5 3.6 ?
cnt3

cnt10. ?

However, this does not give the significant test results for each country, which is necessary for me.
Could anyone of you tell me what I should do to test the statistical significance
Of course, I can do the test by repeating the paired ttest after selecting each country over and over.
However, it is very tedious and uneasy way of doing analysis.
So, would you please let me know how I can easily do it?
In stata, I tried it as follows in vain,
ttest polA==polB, by <Nations>

So, please let me know how I can make it easily.
In either way, SPSS or STATA, it is OK with me.

MC

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