|
Hi Gene,
Thank you for your attention. These data are from a study of motor learning, ok. Each subject performs several trials. Every trials has several components (3 components in this example). I need to divide the various trials in 3 blocks. After generating an average of these blocks. The problem is that each individual has different number of trials. The number of trials for each subject will be different. I created a more simpler example. I added the variable block. This is what I want to automate. subject phase trial block 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 2 1 1 1 3 2 1 1 3 2 1 1 3 2 1 1 4 2 1 1 4 2 1 1 4 2 1 1 5 3 1 1 5 3 1 1 5 3 1 1 6 3 1 1 6 3 1 1 6 3 1 2 1 1 1 2 1 1 1 2 1 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 3 2 1 2 3 2 1 2 3 2 1 2 4 2 1 2 4 2 1 2 4 2 1 2 5 2 1 2 5 2 1 2 5 2 1 2 6 3 1 2 6 3 1 2 6 3 1 2 7 3 1 2 7 3 1 2 7 3 1 2 8 3 1 2 8 3 1 2 8 3 2 1 1 1 2 1 1 1 2 1 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 3 2 2 1 3 2 2 1 3 2 2 1 4 2 2 1 4 2 2 1 4 2 2 1 5 3 2 1 5 3 2 1 5 3 2 1 6 3 2 1 6 3 2 1 6 3 2 2 1 1 2 2 1 1 2 2 1 1 2 2 2 1 2 2 2 1 2 2 2 1 2 2 3 1 2 2 3 1 2 2 3 1 2 2 4 2 2 2 4 2 2 2 4 2 2 2 5 2 2 2 5 2 2 2 5 2 2 2 6 2 2 2 6 2 2 2 6 2 2 2 7 3 2 2 7 3 2 2 7 3 2 2 8 3 2 2 8 3 2 2 8 3 2 2 9 3 2 2 9 3 2 2 9 3 In the above example, note that: The first subject has 6 trials in the first phase and 8 trials in the second phase. When divided by 3 blocks were obtained: the first phase, 3 blocks with 2 tries each, and Phase 2 has 3 blocks with 3 trials for the last 2 blocks and trials to block the first. The new variable block was done by hand, what need is automating it. Thanks.. Luciano Basso ===================== 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 |
|
Luciano,
I have question about your problem. I understood you to say that you wanted to group the trials into groups of 3 trials. However, in your example data subject 1, phase 1 has 6 trials but 3 blocks of 2 trials. According to your rule, shouldn't there be 2 blocks? After looking at the data for awhile, I think I finally understand how to do what you want--maybe. The maximum value of trial for a subject-phase is the key element, I think. I want to make sure I understand how you want to group trials based on the maximum number of trials. So, is the following table correct? Max trials number of blocks 1 1 2 1 3 1 4 2 (3 and 1 or 2 and 2)??? 5 2 6 2 7 3 (3 and 3 and 1) OR 2 (3 and 2 and 2)??? 8 3 (3 and 3 and 2) 9 3 Please edit the table to indicate the correct number of blocks for a given number of trials. 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 |
|
In reply to this post by luciano basso
This is the code I sent separately to Luciano for his evaluation. I do not
include his sample data here in the interests of space. I supplemented his data with the creation of another case. Gene Maguin format subject phase trial block(f2.0). crosstabs trial by subject by phase. delete variables block. compute component=1. if (trial eq lag(trial)) component=lag(component)+1. format component(f1.0). * multipliers will need to be adjusted to fit number of trials. compute SubjectPhaseTrial=subject*1000+phase*100+trial. format subjectphasetrial(f4.0). execute. delete variables subject phase trial. casestovars /id=subjectphasetrial. * divisor will need to be adjusted to fit number of trials. compute subjectphase=trunc(subjectphasetrial/100). format subjectphase(f2.0). aggregate outfile=* mode=addvariables/break=subjectphase/recs=nu. * always want to have three blocks of trials. compute nperblock=recs/3. format nperblock(f4.2). * multiplier will need to be adjusted to fit number of trials. compute trial=subjectphasetrial-100*subjectphase. format trial(f2.0). compute block=trunc((trial+rnd(nperblock)-1)/rnd(nperblock)). if (block eq 4) block=3. /* special correction. format block(f2.0). compute subject=trunc(subjectphase/10). compute phase=subjectphase-subject*10. execute. format subject phase(f1.0). delete variables SubjectPhaseTrial subjectphase recs nperblock. varstocases /make component from component.1 component.2 component.3. crosstabs trial by subject by phase. ===================== 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 |
