Dear Austin:
I thank you very much for your suggestions. The second solution you propose corresponds to what I was looking for. I simply had to create the relevant "sample" variables to do the chi2 test.
Best regards
Hervé
***********************************************************
Professeur/Professor
Coordinateur du Département/Head of Department
HEC Paris
Département Comptabilité Contrôle de gestion / Dept of Accounting and Management Control
1, rue de la Liberation
78351 - Jouy-en-Josas
France
Tel: +33 1 39 67 94 42 - Fax: +33 1 39 67 70 86
stolowy@hec.fr
http://studies.hec.fr/web/stolowy
>>> austinnichols@gmail.com 04/11 8:49 pm >>>
Hervé <stolowy@hec.fr> wants to see if a categorical variable is the
same in a subpopulation as in the population, I think. Jeff Pitblado
gives a solution for comparing two categorical variables, not subject
to that restriction, by reshaping (though from Hervé's post, I think
he made x1 and x2 from a dataset containing only x). If my
interpretation is correct, I think Hervé might actually prefer a Chi^2
goodness-of-fit test (-findit chi2fit-).
OTOH, if the total sample is not the population, then a test of
equality of proportions in the whole sample (samp==1 | samp==0) and in
a subsample defined by samp==1 is given by a Chi^2 test of
independence of x tabulated versus samp:
. tab x samp, chi2
No variable creation or rehaping, required, I think, for Hervé's data.
On 4/11/06, Jeff Pitblado, StataCorp LP <jpitblado@stata.com> wrote:
> Herve STOLOWY <stolowy@hec.fr> has two categorical variables and wants to
> compare the proportions of each category between them:
>
> > the original variable is the same but are applied to two different
> > populations, the total sample and a restricted sample. I created two
> > different variables. With -tabulate-, I get easily the frequencies of both
> > variables).
> >
>
> I'll assume you have two variables, say -x1- and -x2-. You could reshape your
> data from wide to long and then use -tabulate- to get an association test
> between the categories of your original variables. Here is a simulated data
> example.
> --Jeff
> jpitblado@stata.com
*
* 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/
*
* 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/