Focusing on the first question only:
I take it from this that after
sort ID
obs (1,2) (3,4) etc. define dyads.
Thus dyad identifiers could be
gen long dyadid = ceil(_n/2)
So we generate random numbers:
gen rnd = uniform()
and then shuffle within dyads and select:
bysort dyadid (rnd) : gen byte select = _n == 1
Observations with either value of -select-
are a random sample, one from each dyad.
Nick
[email protected]
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Shyam Kumar
> Sent: 07 February 2006 15:59
> To: [email protected]
> Subject: st: Data set with dyads
>
>
> I have a data set comprising of members in dyads which
> is structured as follows:
>
> ID Member-Income Member-Age Member-Educ. Partner-Age
> Partner- Educ.
>
> My interest lies in understanding how Member-Income is
> influenced by both Member and Partner characteristics.
>
>
> My first question is Stata related. I would like to
> form a data set by randomly choosing one member from
> each dyad. The ID variable tells me the dyad each
> observation belongs to. This variable takes on values
> 11,12, 21, 22... 101,102....2441, 2442 etc. Hence
> observations with ID =101, 102 are two members
> belonging to the 10th dyad. How do I form a data set
> by randomly choosing one member from each dyad using
> the ID variable?
>
> My second question is more general. The reason I am
> randomly choosing one member from each dyad is because
> error terms are likely to be correlated. My plan is to
> form two separate data sets and test my hypotheses in
> both data sets separately and then compare the results
> as a robustness check. Is there a better way to handle
> dyads?
>
> Any insights would be much appreciated. Thanks!
>
> Shyam
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.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/