Statalist The Stata Listserver

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

Re: st: Proportion tests for non-binary variables

From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: Proportion tests for non-binary variables
Date   Tue, 11 Apr 2006 14:49:48 -0400

Herv� <[email protected]> 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 <[email protected]> wrote:
> Herve STOLOWY <[email protected]> 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
> [email protected]

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index