Discussion about stat consulting, stat packages, applied statistics and data analysis by statistical consultants of Academic Technology Services at UCLA. Please leave your comments or send us email at stattalk at ats.ucla.edu

Saturday, February 24, 2007

The Parent Trap

Here is a question emailed to us by a client:
I have 4 variables from which I want to create a new variable.

v1 = do you live with mom? (0, 1)
v2 = do you live with dad?
v3 = do you live with stepmother?
v4 = do you live with stepfather?

I want to create a variable PCOMP and code
1 if live with mom and dad
2 if live with mom and stepfather
3 if live with stepmother and dad
4 if live with mom only
5 if live with dad only
6 Other

I'd also like to identify who is from a two-parent household.

How do I do this?

There are many ways this could be handled, here is the one I suggested:

pcomp = v1 + 10*v2 + 100*v3 + 1000*v4

recode pcomp 11=1 1001=2 110=3 1=4 10=5 else=6

two_parent = pcomp < 4

Note: This is in pseudo-code and can be adapted to any stat package that supports recode. Also, the client will have to decide how to deal with missing values as this approach will not work with missing values for v1-v4.

pbe

No comments:

Contributors