|
-------------------------------------------------------------
http://www.tagz.info - Search for PHOTOS on the web right now ------------------------------------------------------------- I was hoping that some more knowledge of the syntax below could help answer an SPSS syntax question posed to me by one of our graduate students. I have included a short description of what she is trying to do, followed by the syntax. Thanks in advance! Scott I'm looking at the time (in seconds) that infants look at > images on two screens (area 1 and area 2) after the presentation of an > audio target. The syntax I have written is supposed to use the times to > count the first instance where the infant looks to each area after the > audio cue, however, I've found that instead of giving me the Min(time) > as hoped, it often times gives me a time value that's a later area look > than the min(time). Here's the syntax for the first trial; from the "do repeat" to the compute left11=1 and compute right11=1 works, it's the do if's that don't seem to be working: > > DO REPEAT looks=b11l2 TO b11l16/time=t11l2 TO t11l16. > DO IF (time LT target11) and (looks='area 1'). > COMPUTE left11=1. > ELSE IF (time LT target11) and (looks='area 2'). > COMPUTE right11=1. > END IF. > DO IF (time GE target11) and (left11+right11=2) and (looks='area 1'). > COMPUTE a1min11=MIN(time). > COMPUTE a1late11=(a1min11-target11). > END IF. > DO IF (time GE target11) and (left11+right11=2) and (looks='area 2'). > COMPUTE a2min11=MIN(time). > COMPUTE a2late11=(a2min11-target11). > END IF. > END REPEAT. > EXECUTE. > |
|
At 10:01 PM 5/22/2007, Scott Roesch wrote:
>[This is] an SPSS syntax question posed by one of our graduate >students. I have included a short description of what she is trying to >do, followed by the syntax. Thanks in advance! Scott > > >>I'm looking at the time (in seconds) that infants look at images on >>two screens (area 1 and area 2) after the presentation of an audio >>target. The syntax I have written is supposed to use the times to >>count the first instance where the infant looks to each area after >>the audio cue, however, I've found that instead of giving me the >>Min(time) as hoped, it often times gives me a time value that's a >>later area look than the min(time). Here's the syntax for the first >>trial; from the "do repeat" to the compute left11=1 and compute >>right11=1 works, it's the do if's that don't seem to be working: >> >> >>DO REPEAT looks=b11l2 TO b11l16 >> /time =t11l2 TO t11l16. >>. DO IF (time LT target11) >> and (looks='area 1'). >>. COMPUTE left11=1. >>. ELSE IF (time LT target11) >> and (looks='area 2'). >>. COMPUTE right11=1. >>. END IF. >>. DO IF (time GE target11) >> and (left11+right11=2) /* Note 1 */ >> and (looks='area 1'). >>. COMPUTE a1min11=MIN(time) /* Note 2 */. >>. COMPUTE a1late11=(a1min11-target11). >>. END IF. >>. DO IF (time GE target11) >> and (left11+right11=2) /* Note 1 */ >> and (looks='area 2'). >>. COMPUTE a2min11=MIN(time) /* Note 2 */. >>. COMPUTE a2late11=(a2min11-target11). >>. END IF. >>END REPEAT. >>EXECUTE /* Note 3 */. Note 1: ------ I don't think this is your problem, but the test in . DO IF (time GE target11) and (left11+right11=2) /* Note 1 */ and (looks='area 1'). will evaluate 'missing' if either 'left11' or 'right11' is missing. That'll happen to you, unless 'left11' and 'right11' are initialized, maybe to 0, before you start the DO REPEAT. That's OK if you only have a "DO IF" clause, as you do. However, if the DO IF test evaluates 'missing', all subsequent "ELSE IF" and "ELSE" clauses in the DO IF construct are *skipped*, *without warning*. Note 2: ------ This looks like the problem. The statement . COMPUTE a1min11=MIN(time) /* Note 2 */. assigns to 'a1min11' the value of the variable that is 'time', on the current pass through the DO REPEAT loop. You write "it often times gives me a time value that's a later area look than the min(time)". Exactly. When the DO IF this statement is in evaluates 'true', it stores the current 'time' value in 'a1min11', ignoring whatever value 'a1min11' had to that point. I think you want this, or something like it: . COMPUTE a1min11=MIN(a1min11,time). Note 3: ------ The "EXECUTE" is neither necessary nor helpful. (OK, you knew I would say that.) Good luck! Richard Ristow |
| Free forum by Nabble | Edit this page |
