if statement based on latency of multiple responses within single trial


Author
Message
eleonora_parr
eleonora_parr
Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)
Group: Forum Members
Posts: 40, Visits: 148
Deal Inquisiters, 
I am trying to build an experiment in which participants are presented with circles of different colors, displayed behind a checkerboard.
Whenever the darker circle is presented on the screen (in the code red_circle), they have to press the spacebar by synchronizing the more they can their response with the appearance of the figure on the screen.
The problem is that I want to calculate their accuracy in giving this response for each trial. The accuracy is calculated according to the distance between each spacebar press and each circle appearance. Specifically, the response is considered accurate whenever they managed to press the spacebar in a time window comprised between 125 ms after & -750 ms before the real appearance of the red circle. The problem is that we have many circles displayed within a single trial == many responses given and many latencies. For each of these latencies, we need to repeat this procedure, that is : calculate if every single response can be considered accurate vs. inaccurate (calculated according to the explained criteria).
Then, the ratio between correct/incorrect "stored" responses represent the "accuracy", according to which the next trial is displayed. This is needed as, if participants are very inaccurate, we need to display a trial that presents the circle with an higher constrast (more visible). Instead, if they are very accurate, we need to display a trial which presents the circle with a lower contrast (less visible). All this is needed because we want to reach a certain level of performance for each subject. 

I hope that this would be possible: here is the code 
Thank you very much to all of you!!
Eleonora



<shape red_circle>
/ color = (180,180,180)
/ position = (50%,50%)
/ shape = circle
/size=(10%, 10%)
</shape>


<shape black_circle>
/ color = (185,185,185)
/ position = (50%,50%)
/ shape = circle
/ size=(10%, 10%)
</shape>

<shape blank>
/ color = (192,192,192)
/ position = (50%,50%)
/ shape = rectangle
/size=(30%, 30%)
</shape>

<trial blank>
/stimulusframes=[1=blank]
/ trialduration = 3000
</trial>

<text cross>
/items=("+")
/position = (50%, 50%)
</text>

<picture checker>
/items=("scacchieracc.png")
/ position = (50%, 50%)
/ size = (30%, 30%)
</picture>


<trial fixate>
/ stimulusframes = [1=cross]
/ trialduration = 2000
</trial>

<values values>
/timeofresponse=""
/spacebarpresscount =""
/accuracy = ""
</values>

<trial acc>
/pretrialpause = 1000
/stimulustimes=[
0=red_circle, checker;
1007=red_circle, checker;
2082=red_circle, checker;
3220=red_circle, checker;
4399=red_circle, checker;
5570=red_circle, checker;
6708=red_circle, checker;
7936=red_circle, checker;
9059=red_circle, checker;
10259=red_circle, checker;
11460=red_circle, checker;
12633=red_circle, checker;
13893=red_circle, checker;
15069=red_circle, checker;
16284=red_circle, checker;
17449=red_circle, checker;
18591=red_circle, checker;
19795=red_circle, checker;
20915=red_circle, checker;
22149=red_circle, checker;
23244=red_circle, checker;
24398=red_circle, checker;
25567=red_circle, checker;
26690=red_circle, checker;
27885=red_circle, checker;
28998=red_circle, checker;
30208=red_circle, checker;
31421=red_circle, checker;
32539=red_circle, checker;
33702=red_circle, checker;
34789=red_circle, checker;
35849=red_circle, checker;
36972=red_circle, checker;
38018=red_circle, checker;
39172=red_circle, checker;
40341=red_circle, checker;
41437=red_circle, checker;
42572=red_circle, checker;
43681=red_circle, checker;
44758=red_circle, checker;
45918=red_circle, checker;
46995=red_circle, checker;
48090=red_circle, checker;

50=black_circle, checker;
1057=black_circle, checker;
2132=black_circle, checker;
3270=black_circle, checker;
4449=black_circle, checker;
5620=black_circle, checker;
6758=black_circle, checker;
7986=black_circle, checker;
9109=black_circle, checker;
10309=black_circle, checker;
11510=black_circle, checker;
12683=black_circle, checker;
13943=black_circle, checker;
15119=black_circle, checker;
16334=black_circle, checker;
17499=black_circle, checker;
18641=black_circle, checker;
19845=black_circle, checker;
20965=black_circle, checker;
22199=black_circle, checker;
23294=black_circle, checker;
24448=black_circle, checker;
25617=black_circle, checker;
26740=black_circle, checker;
27935=black_circle, checker;
29048=black_circle, checker;
30258=black_circle, checker;
31471=black_circle, checker;
32589=black_circle, checker;
33752=black_circle, checker;
34839=black_circle, checker;
35899=black_circle, checker;
37022=black_circle, checker;
38068=black_circle, checker;
39222=black_circle, checker;
40391=black_circle, checker;
41487=black_circle, checker;
42622=black_circle, checker;
43731=black_circle, checker;
44808=black_circle, checker;
45968=black_circle, checker;
47045=black_circle, checker;
48140=black_circle, checker;
]
/ trialduration = 48140+1000
/ inputdevice = keyboard
/ beginresponsetime = -1
/ responseinterrupt = trial
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ showmousecursor = false
/ isvalidresponse = [if(trial.acc.response==57){values.spacebarpresscount += 1; values.timeofresponse=concat(concat(values.timeofresponse, trial.acc.latency),","); false}; ]

</trial>


<block pre>
/ trials = [1=fixate; 2=blank]
</block>

<block acc>
/ trials = [1=acc]
</block>

<expt >
/blocks=[
    1=pre;2=acc;break;3=acc
]
</expt>

<data>
/ columns = [date,time,group,subject, display.refreshrate, display.canvaswidth, display.canvasheight, trialduration, values.timeofresponse,values.spacebarpresscount
shape.black_circle.stimulusonset.1
shape.black_circle.stimulusonset.2
shape.black_circle.stimulusonset.3
shape.black_circle.stimulusonset.4
shape.black_circle.stimulusonset.5
shape.black_circle.stimulusonset.6
shape.black_circle.stimulusonset.7
shape.black_circle.stimulusonset.8
shape.black_circle.stimulusonset.9
shape.black_circle.stimulusonset.10
shape.black_circle.stimulusonset.11
shape.black_circle.stimulusonset.12
shape.black_circle.stimulusonset.13
shape.black_circle.stimulusonset.14
shape.black_circle.stimulusonset.15
shape.black_circle.stimulusonset.16
shape.black_circle.stimulusonset.17
shape.black_circle.stimulusonset.18
shape.black_circle.stimulusonset.19
shape.black_circle.stimulusonset.20
shape.black_circle.stimulusonset.21
shape.black_circle.stimulusonset.22
shape.black_circle.stimulusonset.23
shape.black_circle.stimulusonset.24
shape.black_circle.stimulusonset.25
shape.black_circle.stimulusonset.26
shape.black_circle.stimulusonset.27
shape.black_circle.stimulusonset.28
shape.black_circle.stimulusonset.29
shape.black_circle.stimulusonset.30
shape.black_circle.stimulusonset.31
shape.black_circle.stimulusonset.32
shape.black_circle.stimulusonset.33
shape.black_circle.stimulusonset.34
shape.black_circle.stimulusonset.35
shape.black_circle.stimulusonset.36
shape.black_circle.stimulusonset.37
shape.black_circle.stimulusonset.38
shape.black_circle.stimulusonset.39
shape.black_circle.stimulusonset.40
shape.black_circle.stimulusonset.41
shape.black_circle.stimulusonset.42
shape.black_circle.stimulusonset.43


shape.red_circle.stimulusonset.1
shape.red_circle.stimulusonset.2
shape.red_circle.stimulusonset.3
shape.red_circle.stimulusonset.4
shape.red_circle.stimulusonset.5
shape.red_circle.stimulusonset.6
shape.red_circle.stimulusonset.7
shape.red_circle.stimulusonset.8
shape.red_circle.stimulusonset.9
shape.red_circle.stimulusonset.10
shape.red_circle.stimulusonset.11
shape.red_circle.stimulusonset.12
shape.red_circle.stimulusonset.13
shape.red_circle.stimulusonset.14
shape.red_circle.stimulusonset.15
shape.red_circle.stimulusonset.16
shape.red_circle.stimulusonset.17
shape.red_circle.stimulusonset.18
shape.red_circle.stimulusonset.19
shape.red_circle.stimulusonset.20
shape.red_circle.stimulusonset.21
shape.red_circle.stimulusonset.22
shape.red_circle.stimulusonset.23
shape.red_circle.stimulusonset.24
shape.red_circle.stimulusonset.25
shape.red_circle.stimulusonset.26
shape.red_circle.stimulusonset.27
shape.red_circle.stimulusonset.28
shape.red_circle.stimulusonset.29
shape.red_circle.stimulusonset.30
shape.red_circle.stimulusonset.31
shape.red_circle.stimulusonset.32
shape.red_circle.stimulusonset.33
shape.red_circle.stimulusonset.34
shape.red_circle.stimulusonset.35
shape.red_circle.stimulusonset.36
shape.red_circle.stimulusonset.37
shape.red_circle.stimulusonset.38
shape.red_circle.stimulusonset.39
shape.red_circle.stimulusonset.40
shape.red_circle.stimulusonset.41
shape.red_circle.stimulusonset.42
shape.red_circle.stimulusonset.43
]
</data>

<defaults>
/ screencolor = (192,192,192)
/ txbgcolor = (192,192,192)
/ txcolor = white
/ fontstyle = ("Trebuchet MS", 3.11%, false, false, false, false, 5, 1)
</defaults>


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
eleonora_parr - 4 Years Ago
Dave - 4 Years Ago
Dave - 4 Years Ago
eleonora_parr - 4 Years Ago
Dave - 4 Years Ago
                         Look, the code works like this: - After the trial has completed and...
Dave - 4 Years Ago
                             Oh, I thought that this could be the reason why the number of the...
eleonora_parr - 4 Years Ago
                                 No. 1663 will not be considered accurate for the interval -750 to 125....
Dave - 4 Years Ago
                                     For what it's worth, your confusion may be due to the displayed final...
Dave - 4 Years Ago
                                         Dear Dave, I just wanted to thank you, you were completely right --...
eleonora_parr - 4 Years Ago

Reading This Topic

Explore
Messages
Mentions
Search