Devendra Amre MD., Ph.D.
> I have the following 'family data' set that i wish to analyze.
>
> Subject family proband
> diagnosis marker
> 1 1 0
> 0 1
> 2 1 1
> 2 0
> 3 1 0
> 1 0
> 4 1 0
> 0 1
> and so forth for other families
>
> 1. I wish to estimate the frequency of families in which
> the proband (i.e 1) has diagnosis 1 and is marker positive (i.e 1)
There are FAQs which may be helpful here
at
How do I create variables summarizing for each individual
properties of the other members of a group?
http://www.stata.com/support/faqs/data/members.html
This FAQ was substantially revised last month, after
on-list and off-list interaction with Guillermo Cruces.
How do I create a variable recording whether any members
of a group (or all members of a group) possess some characteristic?
http://www.stata.com/support/faqs/data/anyall.html
For this problem, I would go
bysort family : egen diagpos =
sum((proband == 1) & (diagnosis == 1) & (marker == 1))
which counts how many observations in each family
satisfy this triple criterion.
Hence families with at least one such person
will all be given positive values. If you want to
count families not persons, follow with
egen tag = tag(family) if diagpos
count if tag
... if tag
> 2. Further I wish to estimate the frequency of marker
> positivity (being 1) among 'other family members' of
> families where the proband==1 & diagnosis==1 and marker==1.
We have tagged such families.
First we get the family sum
by family : egen npos = sum(marker == 1) if tag
and then we subtract this person
replace npos = npos - (marker == 1)
to get the number of others in the family who
are positive.
Here, for example,
marker == 1
evaluates to 1 if that condition is true. The treatment of true and
false in Stata is surveyed in
What is true and false in Stata?
http://www.stata.com/support/faqs/data/trueorfalse.html
Nick
[email protected]
*
* 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/