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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: RE: Creating a Non-Self Mean & Proportions |

Date |
Tue, 30 Jun 2009 18:57:25 +0100 |

Thanks for the detailed example, which helps enormously. Otherwise I find your reply puzzling. You don't state which of my three guesses are wrong but your example implies to me that all are on the right lines, and so my code is relevant (except that the name -total- is a slip for -fraction- or -proportion-). In line with Martin Weiss' suggestion note that . tab score stratum is a very simple way to get the table you give. Nick n.j.cox@durham.ac.uk ====================== P.S. to save you from some future examiner or reviewer as pedantic as myself I underline that stratum is the singular of strata. ====================== Emmanuel Koku Dear, Nick, thanks for attempting to resolve my question, though the code fragment did not help. Please, below are 20 cases, covering 3 different strata, as well as their respective values on the index variable of interest (i.e., score), for your examination. What I want is the count or proportion of each value of the index variable (i.e., score) in each strata. Cluster Hhold# Line# Strata score 46 7 1 1 0 122 20 4 1 0 122 6 2 1 1 46 1 1 1 2 122 11 2 1 1 122 6 1 1 0 122 16 6 2 0 46 13 1 2 1 46 12 1 2 2 122 17 1 2 0 122 8 2 2 1 46 13 3 2 1 122 5 2 2 0 46 6 3 3 1 122 16 2 3 0 122 15 1 3 2 46 4 2 3 0 46 19 3 3 1 122 4 2 3 0 46 20 4 3 2 So from this scratch data we can have the following distribution of the 3 score values by strata: ScoreValues Strata1 Strata2 Strata3 Total 0 3 3 3 9 1 2 3 2 7 2 1 1 2 4 N 20 Thus, we can state that across all strata 9 individuals had a score of 0, 7 had a score of 1 and 4 had a score of 2 -- that is we aggregate or count each of the values of the index variable (Score) across or over all strata. In this way I can describe the distribution of the scores over the strata. I hope this makes it a bit clearer. If, not please let me know and I can try and provide further clarification. On Mon, Jun 29, 2009 at 4:30 PM, Nick Cox <n.j.cox@durham.ac.uk> wrote: > A meta-question here is why no one has replied to this since it was > posted. An answer to that is that trying to work out what is wanted > requires too much effort. Why not give an example of your data? Why make > everyone try to imagine what you have? > > Anyway, my guesses are: > > 1. You have a long data structure with personal id (say -id-) and > stratum id (say -stratum-). (One stratum, several strata.) > > 2. You have a variable (say -score-) with values 0,1,2. (What that > variable represents, how many negative attitudes the others in the > stratum have, it seems, is not important here.) > > 3. You want to summarize the fractions of 0, 1, 2 in each stratum. > > If these guesses are all correct, then one answer is > > bysort stratum score : gen freq = _N > by stratum: gen total = freq / _N > > You may also want to -collapse- the data. > > If these guesses are wrong, you may need to try again with more > information. Emmanuel Koku > I have created a summed scale of 2 dichotomous items coded originally > 0 1. The new variable now has values ranging from 0 to 2. > > Since I am using a survey that I want to create summary measures like > non-self mean or non-self proportions that represent other members of > the respondents strata but excluding the respondent. Eg. I would want > to know the proportion of the respondents strata who hold no negative > attitudes - ie 0 in the summed scale; the proportion who hold only one > of the negative attitudes, ie, 1 in the summed scale as well as those > members of the strata who hold both negative values or 2 in the summed > scale. > > Through help received here and from a statafaq article, i have been > able to create similar summary measures for dichotomous items, but i'm > stumped with this 3-category variable, and would appreciate any > assistance. * * 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/

**References**:**st: Creating a Non-Self Mean & Proportions***From:*Emmanuel Koku <emmanuelkoku@gmail.com>

**st: RE: Creating a Non-Self Mean & Proportions***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: RE: Creating a Non-Self Mean & Proportions***From:*Emmanuel Koku <emmanuelkoku@gmail.com>

- Prev by Date:
**Re: st: AW: what does constant implies in fixed effect** - Next by Date:
**RE: st: adoupdate question** - Previous by thread:
**AW: st: RE: Creating a Non-Self Mean & Proportions** - Next by thread:
**st: Create an ado file which contains multiple mata functions** - Index(es):

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