Statalist


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

RE: st: easiest way to get chi-square test


From   "Kieran McCaul" <Kieran.McCaul@uwa.edu.au>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: easiest way to get chi-square test
Date   Wed, 23 Dec 2009 07:15:07 +0800

...

It's not that clear to me what data you have, but if you have counts for each ethnic group, then you can use these as frequency weights.
Something like this:



clear*

input  id tot_asian tot_white group
1 100 200 1
2 50 250 1
3 100 150 2
4 50 250 2
end

rename tot_asian count1
rename tot_white count2

list

reshape long count, i(id) j(ethnicity)
label define ethnicfmt 1 "Asian" 2 "White"
label values  ethnicity ethnicfmt
tab  ethnicity group [fw=count], chi2



-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of B Web
Sent: Wednesday, 23 December 2009 6:41 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: easiest way to get chi-square test

Sorry - the private reply was unintended.

Make believe data:
Group 1:
Asians: 78%
Pacific Islander: 65%
White: 54%
African American: 53%

Group 2:
Asians: 77%
Pacific Islander: 64%
White: 53%
African American: 52%
Do the groups differ with respect to ethnicity percentages?

My data are continuous counts or percents  right now:

tab group, sum( tot_asian)  -- mean # of asians in each group
tab group, sum( tot_white)  -- mean  # of whites in each group
tab group, sum( tot_pacisland)
tab group, sum( tot_afam)

what I want is to create counts variable so I can do a chi-square on
ethnicity (2x2 table)
So                    ethnicity (white,pac.island...)
Group1:
Group2:

data table - columns( Id, tot_asian, tot_white ..., group)

1 100, 200, 1
2 50, 250, 1

3, 100, 150, 2
4, 50, 250, 2

this needs to be transformed so I have a leveled variable with counts
for each group.

http://www.ats.ucla.edu/stat/stata/whatstat/whatstat.htm see the
section here: tabulate female ses, chi2

I guess I need to generate the ses variable for races, but they are
now all different variables.

Sorry for the intrusion.

On Tue, Dec 22, 2009 at 2:14 PM, Maarten buis <maartenbuis@yahoo.co.uk> wrote:
> --- On Tue, 22/12/09, B Web wrote me privately:
>> Null hypothesis is that the group percentages across groups
>> are equal (i think)
>
> The policy on the statalist is not to respond privately for reasons discussed in the Statalist FAQ (see the bottom of every post on
> Statalist).
>
> I am still not clear what it is that you are trying to do. Can you
> tell a bit more about your variables and the aim of your analysis?
>
> -- Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
>
>
> *
> *   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/
>

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


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