Randomly selecting one of twins or siblings

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

torra
Posts: 1
Joined: Sat Oct 03, 2015 5:19 pm

Randomly selecting one of twins or siblings

Postby torra » Sat Oct 03, 2015 10:43 pm

I'm working with a sample that contains twins and siblings, and I want to randomly select one member of each family so that the data will be independent. I have a family ID variable and a variable for the type of relationship (e.g., twins, siblings).

For example,

Family ID_______Relationship
11111__________twin
11111__________twin
11112__________other
11113__________sibling
11113__________sibling
11113__________sibling

I'd appreciate if someone could teach me how I can do this. I use the Windows version of SPSS 22.

Thanks!
JonPedersen
Posts: 118
Joined: Wed May 25, 2011 7:07 am
Contact:

Re: Randomly selecting one of twins or siblings

Postby JonPedersen » Tue Oct 06, 2015 8:27 am

Hi,
One way to do this that comes to mind is:

Code: Select all

compute randomnumber=rv.uniform(0,100).
aggregate outfile * mode=addvariables
/break famid
/selnum=min(randomnumber).
compute selected=0.
if randomnumber=selnum selected=1.
exe.


Then the variable selected will be 1 if the case should be selected, and 0 if not. You can use filter or select if to select the right cases.
In principle you could also use some sort of robust standard errors to handle the lack of independence.
Best
Jon

Who is online

Users browsing this forum: No registered users and 4 guests

cron