|
|
meanlatency of every five trials
Last post 08-14-2008, 5:36 AM by Dave. 14 replies.
-
08-01-2008, 8:28 AM |
-
ybk
-
-
-
Joined on 08-01-2008
-
-
Posts 7
-
-
|
meanlatency of every five trials
Hi,
in a current survey we are trying to measure reaction times of decisions whether a sentence is correct or absurd. In order to ensure that the participant is actually analyzing the sentence and not just pressing any answer just to get done, we were trying to integrate a branch function which should basically say that if the mean latency of the current trial and the previous four trials is shorter than 800 milliseconds then show a warning like "please work accurately". So far we have tried to write a branch function like this:
<trial sentence> /stimulustimes = [0 = sentence_absurd] /validresponse = ("f", "j") /correctresponse = ("f") /branch = [if (trial.currenttrial.meanlatency < 887) trial.warning] </trial>
This seems not to work thou, for we always receive the following warning:
"Expression 'trial.currenttrial.meanlatency' is invalid. Expression contains an unknown element or property name."
The problem is that we don't know how to specify the currently running trial ... nor the four previous trials. The different sentences are listed in items, which differ with every run. Therefore it is not possible to solve the problem like this:
/branch = [if (meanlatency(trial.sentence_1, trial.sentence_2, sentence_3) < 887) trial.warnung]
Please help!!!
|
|
-
08-01-2008, 12:54 PM |
-
Dave
-
-
-
Joined on 09-18-2005
-
-
Posts 266
-
-
|
Re: meanlatency of every five trials
Hi ybk (what a weird name...;-)),
I'm pretty sure that Inquisit is able to do what you want. However, it would be much easier to help you if you could attach your script to your post. Otherwise it's just too much stumbling in the dark. To attach your script to your post:
- Log in with your user account. - Look for your post and select 'Edit'. - Click on the 'Options' tab and select 'Add/Update'. - Browse for your script file and upload it here.
If your file is too big to be attached here, please put it somewhere else where helpful forum members can download and take a look at it.
To return to your problem: As far as I know, 'currentrial' is a block-level property and hence cannot be used from within a trial element.
Hope to hear more form you, ~Dave
|
|
-
08-05-2008, 5:01 AM |
-
ybk
-
-
-
Joined on 08-01-2008
-
-
Posts 7
-
-
|
Re: meanlatency of every five trials
Hi Dave!
Thanks a lot for your reply! Well, since the script was a bit large and also
written in German, I simplified the items (it would have taken too long to
translate all the sentences) - I know, it might not look like a very
interesting experiment anymore but it should be enough to understand the
"technical" problem we’re facing :)
So far, we have tried these variations just to see how the branch function
works – they do work but don’t satisfy our needs:
/branch = [if (meanlatency < 500) trial.warning]
(takes in account ALL latencies from the first trial up to the
current trial...)
/branch = [if (latency < 500) trial.warning]
(accounts only the CURRENT trial...)
The main
problem is that we do not know how to put the conditional phrase into a correct
Boolean expression:
/branch = [if (the mean latency of the current trial and the previous four
trials < 500) trial.warning]
If anybody
has any ideas; I’d be glad for your answers! Thanks a lot in advance!
ybk
(aka dominikus)
|
|
-
08-05-2008, 5:15 AM |
-
Dave
-
-
-
Joined on 09-18-2005
-
-
Posts 266
-
-
|
Re: meanlatency of every five trials
Hi Dominikus aka. ybk!
Thanks for the reply, but still: Actually having your script at hand would greatly simplify the helping process. The fact that your original script uses German sentences is not a problem for me (as I'm actually German myself). But even the stripped down version would help. So, put it up somewhere or send me a private message with your e-mail address. I'd be happy to take a look and see if I can help you out.
Best, ~Dave
|
|
-
08-05-2008, 6:36 AM |
-
ybk
-
-
-
Joined on 08-01-2008
-
-
Posts 7
-
-
|
Re: meanlatency of every five trials
Hey!
Ah sorry, I thought the file was attached somewhere since I followed the instructions in your first reply! I'll try it again - if it doesn't work I'll send it by email!
dominikus
|
|
-
08-05-2008, 6:40 AM |
-
Dave
-
-
-
Joined on 09-18-2005
-
-
Posts 266
-
-
|
Re: meanlatency of every five trials
Thanks, got it. I'll get back to you.
~Dave
|
|
-
08-05-2008, 9:02 AM |
-
Dave
-
-
-
Joined on 09-18-2005
-
-
Posts 266
-
-
|
Re: meanlatency of every five trials
So, here we go. I've attached a modified version of your script that keeps track of the 5 most recently recorded latencies. You'll have to do some more work to adapt it to your particular needs, but it should show you one way to do what you want. The key components are:
- Initialize 5 variables to store the latencies of the 5 most recent trials, one to store the 'running' mean of those 5 trials plus I've also added a variable for the convenient changing of the latency cutoff that invokes the warning-trial:
<values> / cutoff = 500 / lat01 = 0 / lat02 = 0 / lat03 = 0 / lat04 = 0 / lat05 = 0 / meanlat = 0 </values>
- Update these variables at the end of each trial. 'lat01' always holds the most recent latency, 'lat02' takes on the value that 'lat01' had before (i.e. one trial back), 'lat03' takes on the value that 'lat02' had before (i.e. two trials back) and so on, finally compute their running mean:
<block sentences> ... / ontrialend = [values.lat05 = values.lat04; values.lat04 = values.lat03; values.lat03 = values.lat02; values.lat02 = values.lat01; values.lat01 = block.sentences.latency;values.meanlat = (values.lat01 + values.lat02 + values.lat03 + values.lat04 + values.lat05) / 5] </block>
- Branch to a warning trial whenever the running mean of the last 5 trials drops below the specified cutoff value:
<trial sentence_true_part2> ... / branch = [if (values.meanlat < values.cutoff) trial.warning] </trial>
I've also included some debugging features so that you can follow the recorded latencies on-screen.
Best, ~Dave
|
|
-
08-05-2008, 10:59 AM |
-
seandr
-
-
-
Joined on 11-02-2003
-
Seattle, WA
-
Posts 771
-
-
|
Re: meanlatency of every five trials
Dave, you are awesome.
-Sean
|
|
-
08-07-2008, 1:11 AM |
-
ybk
-
-
-
Joined on 08-01-2008
-
-
Posts 7
-
-
|
Re: meanlatency of every five trials
hey!
wow! thanks for the quick reply! well, since I've just recently started working with inquisit I haven't understood the details yet - but it looks great! I'll let you know how it works as soon as I'm done, thank you!
best regards,
dominikus
|
|
-
08-07-2008, 5:30 AM |
-
Dave
-
-
-
Joined on 09-18-2005
-
-
Posts 266
-
-
|
Re: meanlatency of every five trials
Here's a quick follow-up for anyone that might be interested. Some additional questions have been discussed via private messages, but I'm making this info public since it could be useful for others facing similar problems with their scripts.
Dominikus' experiment uses what I like to call 'split trial' logic: A single task broken down into several parts (i.e. trials, mostly due to technical restrictions). In this experiment, part of a sentence is presented to subjects in the first trial. Subjects then advance to the second trial, where they read the second part of the sentence and decide whether the whole sentence (trialtype 1 + trialtype 2) makes sense. As - according to Dominikus - the latencies from trial 1 are largely irrelevant, the 'running' mean is supposed to be computed from the latencies of the five most recent type2-trials. One way to do this, is to introduce additional conditions (i.e. 'if-statements') that tell Inquisit when to update the variables containing the tracked response latencies.
<block sentences> ... / ontrialend = [ if (script.currenttrial == "sentence_true_part2") values.lat05 = values.lat04; if (script.currenttrial == "sentence_absurd_part2") values.lat05 = values.lat04; if (script.currenttrial == "sentence_true_part2") values.lat04 = values.lat03; if (script.currenttrial == "sentence_absurd_part2") values.lat04 = values.lat03; if (script.currenttrial == "sentence_true_part2") values.lat03 = values.lat02; if (script.currenttrial == "sentence_absurd_part2") values.lat03 = values.lat02; if (script.currenttrial == "sentence_true_part2") values.lat02 = values.lat01; if (script.currenttrial == "sentence_absurd_part2") values.lat02 = values.lat01; if (script.currenttrial == "sentence_true_part2") values.lat01 = block.sentences.latency; if (script.currenttrial == "sentence_absurd_part2") values.lat01 = block.sentences.latency; if (script.currenttrial == "sentence_true_part2") values.meanlat = (values.lat01 + values.lat02 + values.lat03 + values.lat04 + values.lat05) / 5; if (script.currenttrial == "sentence_absurd_part2") values.meanlat = (values.lat01 + values.lat02 + values.lat03 + values.lat04 + values.lat05) / 5] </block>
Or even simpler using a logical 'OR' statement:
<block sentences> ... / ontrialend = [ if (script.currenttrial == "sentence_true_part2" || script.currenttrial == "sentence_absurd_part2" ) values.lat05 = values.lat04; if (script.currenttrial == "sentence_true_part2" || script.currenttrial == "sentence_absurd_part2" ) values.lat04 = values.lat03; if (script.currenttrial == "sentence_true_part2" || script.currenttrial == "sentence_absurd_part2" ) values.lat03 = values.lat02; if (script.currenttrial == "sentence_true_part2" || script.currenttrial == "sentence_absurd_part2" ) values.lat02 = values.lat01; if (script.currenttrial == "sentence_true_part2" || script.currenttrial == "sentence_absurd_part2" ) values.lat01 = block.sentences.latency; if (script.currenttrial == "sentence_true_part2" || script.currenttrial == "sentence_absurd_part2" ) values.meanlat = (values.lat01 + values.lat02 + values.lat03 + values.lat04 + values.lat05) / 5] </block>
The modified script is attached to this post.
Best, ~Dave
|
|
-
08-07-2008, 6:07 AM |
-
ybk
-
-
-
Joined on 08-01-2008
-
-
Posts 7
-
-
|
Re: meanlatency of every five trials
Thanks a lot, you've been a great help!!!
Best regards,
dominikus
|
|
-
08-12-2008, 8:39 AM |
-
ybk
-
-
-
Joined on 08-01-2008
-
-
Posts 7
-
-
|
Re: meanlatency of every five trials
Hi there!
Here I am again :) So far, I've implemented the additions into my
original script and technically they work perfectly! After I made test
run, however, i noticed something which could be a bother to the test
person.
For example:
Sometime during the experiment the proband suddenly slacks off and
starts clicking through the trials - thus he creates latencies such as:
trial20=98ms, trail22=115, trial24=120ms, trial26=110ms, trial28=90ms
(mean latency = 106)
As planned he thereby triggers a warning signaling to work more
accurately because the mean latency drops below the cutoff value (lets
say 800ms) - so far everything is just fine! But now this:
Startled by the warning he decides to work accurately:
trail22=115, trial24=120ms, trial26=110ms, trial28=90ms, trial 30=2500ms
(mean latency = 587)
but then again: "warning"
As you can see, although he works accurately again, he receives still
another warning because the previous short latencies are still included
in the mean latency.
Now my question is if there is a way to backset latencies to their
initial set values (which were 1000ms) after the warning was displayed? Many thanks in advance to
anyone who has an idea!
best regards,
-dominikus
|
|
-
08-12-2008, 8:56 AM |
-
Dave
-
-
-
Joined on 09-18-2005
-
-
Posts 266
-
-
|
Re: meanlatency of every five trials
Of course there is. You probably could have figured it out by yourself by now, because it uses the same functions as the earlier modifications and it's really not a big deal. Simply add a command to the warning trial to reset the latencies when it's run:
<trial warning> /stimulusframes = [1 = warning, currentmeanlatency] /trialduration = 2500 /recorddata = false / ontrialend = [ values.lat01 = 1000; values.lat02 = 1000; values.lat03 = 1000; values.lat04 = 1000; values.lat05 = 1000; values.meanlat =1000] </trial>
Best, ~Dave
|
|
-
08-14-2008, 12:49 AM |
-
ybk
-
-
-
Joined on 08-01-2008
-
-
Posts 7
-
-
|
Re: meanlatency of every five trials
You're absolutely right, i could've figured it out myself! Sorry for the bother but thanks a lot anyway - you've been a great help as always!!
viele grüße, -dominikus
|
|
-
08-14-2008, 5:36 AM |
-
Dave
-
-
-
Joined on 09-18-2005
-
-
Posts 266
-
-
|
Re: meanlatency of every five trials
No problem, mate. I hope you're all set now!
Best wishes, ~Dave
|
|
|
|