|
I've search the usual locations for info on this and so I turn to The List. I want to select a random sample of couples who have been measured at 3 time points. Data is in person-period format. One line for each time point for each individual.
I have data organized in a person-period format for multilevel modeling. The data consists of husband and wife couples measured at up to three time points (not everyone has data for all three points). This gives a max 6 lines for each couple. I have about 1000 couples and would like to sample 200 of those for preliminary descriptive analyses ala Singer and Willet's ALDA Chapters 2 and 3. There is a unique identifier for each couple. I want to only choose those couples that have complete data. All 6 lines. I've thought of some workarounds like sorting by rank then taking those only those couple ids that include a rank of 6. Copying that into Excel and then getting random numbers between 1 and 1000, ranking those in Excel and then taking the first 200 and running a very long select if command in SPSS. Oh gurus of SPSS what shall I do!? I know there must be some easy three line command to do this. Please advise or request clarification if need be. thanks, Matt Matthew Pirritano, Ph.D. Email: [hidden email] Assistant Professor of Psychology Smith Hall 116C Chapman University Department of Psychology One University Drive Orange, CA 92866 Telephone (714)744-7940 FAX (714)997-6780 ----- Original Message ---- From: Joanne Tsai <[hidden email]> To: [hidden email] Sent: Tuesday, April 29, 2008 1:21:42 PM Subject: loop function for integral or summation? Dear colisters: I was advised to explain my question a little bit further. I apologize for the confusion. What I have on my current data set is from column Market to A2, and I'd like to generate a column A11 respond to A1, and A22 respond to A2. Time is my dependent variable which I'd like to take integral of. For example, for row 6, time at 4, A11 should calculate A1 (t=0) + A1 (t=1) +A1 (t=2) +A1 (t=3)+ A1 (t=4), which is equivalent to the summation of A1 from time 0 to time 4. Is the loop function the right direction? Thank you again for your help. MARKET PROD time A1 A2 A11 A22 A B 0 0 0 0 0 A B 1 0.00024 0.00001 0.00024 0.00001 A B 2 0.00059 0.00001 0.00084 0.00002 A B 3 0.00128 0.00005 0.00212 0.00006 A B 4 0.00198 0.00009 0.0041 0.00015 A B 5 0.00286 0.00015 0.00696 0.0003 A B 6 0.00364 0.00022 0.0106 0.00052 A B 7 0.00441 0.00029 0.01501 0.00082 A B 8 0.00531 0.00039 0.02032 0.0012 A B 9 0.00621 0.00049 0.02653 0.00169 ====================To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Matthew,
Although I'm sure you can work the problem with the data in a 'long' format, I'd convert it to 'wide' via a Casestovars command (I'll assume you are familiar with this command from the syntax reference.) Then, Do a count of sysmis/missing values for the six husband/wife T1-T3 variables. Get rid of cases with a count of 1 or greater. Run a frequencies to get the number of valid cases. Let this number be M. Do a sample command of this form (refer to syntax reference for documentation): Sample 200 from M. Finish up with a Varstocases command to restore your data to the prior long format. Gene Maguin ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
