Skipping trials dynamically?


Author
Message
AKrishna
AKrishna
Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)
Group: Forum Members
Posts: 118, Visits: 396
Hi all,

was wondering if there is any way to skip trials dynamically without having to add a /skip attribute to every such trial.

To elaborate, I've started programming my online experiments to end early if participants respond in ways that would render the data unusable (which somewhat mitigates the ethical issue of paying these participants less by also having them spend less time on task). I've created some generic elements that look like this:


<values>
/TimedOut = false
/TimeOutThreshold = 180000
</values>

<expressions>
/FinalPayment = if (values.TimedOut && script.currentblocknumber == 1) 0.0
else if (values.TimedOut && script.currentblocknumber <= 3) 0.5
else if (values.TimedOut && script.currentblocknumber <= 6) 1.0
else if (values.TimedOut && script.currentblocknumber <= 8) 1.5
else if (values.TimedOut) 2.0
else if (script.currentblocknumber == 1) 0.5
else if (script.currentblocknumber <= 3) 1.0
else if (script.currentblocknumber <= 6) 1.5
else if (script.currentblocknumber <= 8) 2.0
else 2.5
</expressions>

<trial QuitDueToAttentionChecks>
/ stimulustimes = [0 = clearscreen, QuitDueToAttentionChecks, PressSpaceToEnd]
/ recorddata = false
/ validresponse = (57)
/ ontrialend = [
    script.abort(true)
]
/ beginresponsetime = 2000
</trial>

<text QuitDueToAttentionChecks>
/ items = ("Dear participant, unfortunately, that was the second attention check you answered incorrectly.

This renders your dataset unusable. Thus, the experiment will now end.

You will be paid partial compensation through the Prolific bonus system in the amount of £<%format(~"%.2f~", expressions.FinalPayment)%>. Please do NOT click the completion link or the study coordinator will be forced to reject your submission, impacting your Prolific score. Instead, return the submission.

If you do not receive your bonus payment within three days, please contact the study coordinator via the Prolific messaging system.")
/ fontstyle = ("Verdana", 2%, false, false, false, false, 5, 1)
/ position = (50,50)
/ size = (75%,45%)
</text>

<trial QuitDueToResponsePattern>
/ stimulustimes = [0 = clearscreen, QuitDueToResponsePattern, PressSpaceToEnd]
/ recorddata = false
/ validresponse = (57)
/ ontrialend = [
    script.abort(true)
]
/ beginresponsetime = 2000
</trial>

<text QuitDueToResponsePattern>
/ items = ("Dear participant, unfortunately, your pattern of responses has rendered the data unusable to the researchers.

This has occurred because you responded to 20% or more of the trials of the previous task faster than 100ms. Previous research suggests that responses in this timeframe are unlikely to be reflective of evaluations of the ideographs.

You will be paid partial compensation through the Prolific bonus system in the amount of £<%format(~"%.2f~", expressions.FinalPayment)%>. Please do NOT click the completion link or the study coordinator will be forced to reject your submission, impacting your Prolific score. Instead, return the submission.

If you do not receive your bonus payment within three days, please contact the study coordinator via the Prolific messaging system.")
/ fontstyle = ("Verdana", 2%, false, false, false, false, 5, 1)
/ position = (50,50)
/ size = (75%,45%)
</text>

<text PressSpaceToEnd>
/ items = ("Press the SPACEBAR to end.")
/ fontstyle = ("Verdana", 2%, false, false, false, false, 5, 1)
/ position = (50,75)
</text>

So far, so good. However, I've hit a little snag for my final exclusion criterion. I want participants to skip out of the experiment if they don't respond to any given trial for three minutes. My approach has been to configure all the blocks that contain potential timeouts to check for latency at each trial's end and set a flag if it exceeds my limit:

<block MyBlock>
/ trials = [1-50 = MyTrial]
/ ontrialend = [
    if (script.currenttrial.latency > values.TimeOutThreshold) values.TimedOut = true
]
/ ontrialbegin = [
    if (values.TimedOut) script.currenttrial.trialduration = 0
]
/ branch = [
    if (values.TimedOut) block.TimedOut
]
</block>

<block TimedOut>
/ trials = [1 = QuitDueToTimeout]
</block>


<trial QuitDueToTimeout>
/ stimulustimes = [0 = clearscreen, QuitDueToTimeout, PressSpaceToEnd]
/ recorddata = false
/ validresponse = (57)
/ ontrialend = [
    script.abort(true)
]
/ beginresponsetime = 2000

</trial>

<text QuitDueToTimeout>
/ items = ("Dear participant, prior to your last response, you had not responded in the task for over three minutes. While we appreciate that this may be due to circumstances beyond your control, this renders your dataset unusable for our research, which studies psychological processes that occur in the short term. Thus, the experiment will now end.

You will be paid partial compensation through the Prolific bonus system based on the proportion of the study you completed (£<%format(~"%.2f~", expressions.FinalPayment)%>). Please do NOT click the completion link or the study coordinator will be forced to reject your submission, impacting your Prolific score. Instead, return the submission.

If you do not receive your bonus payment within three days, please contact the study coordinator via the Prolific messaging system.")
/ fontstyle = ("Verdana", 2%, false, false, false, false, 5, 1)
/ position = (50,50)
/ size = (75%,45%)
</text>


The idea is that the flag should lead to all remaining trials in the block being skipped and the block then branching to a special block which informs the participant about the timeout and then aborts the experiment. However, I'm having a little trouble efficiently skipping trials. Setting their duration to 0 (as in the script above) still leads to the stimuli briefly flashing on screen for each trial, which is likely to confuse participants and leads to unnecessary wait time. I can't seem to set the /skip property in script (e.g. "/ ontrialbegin = [if (values.TimedOut) script.currenttrial.skip = true]" does nothing), which would of course be the most efficient solution.

My current solution is to set values.TimedOut as a /skip condition for each trial in the block, which works. However, this is inelegant and vulnerable to copy-paste errors for future experiments. I would like to have these "premature ending" trials as template elements that I can add to a study, briefly configure via the <block> elements and then forget about - and also pass on to other people who use Inquisit without too high of a bar for usage. Anyone have any ideas?

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
AKrishna - 8/10/2021
Hi all,

was wondering if there is any way to skip trials dynamically without having to add a /skip attribute to every such trial.

To elaborate, I've started programming my online experiments to end early if participants respond in ways that would render the data unusable (which somewhat mitigates the ethical issue of paying these participants less by also having them spend less time on task). I've created some generic elements that look like this:


<values>
/TimedOut = false
/TimeOutThreshold = 180000
</values>

<expressions>
/FinalPayment = if (values.TimedOut && script.currentblocknumber == 1) 0.0
else if (values.TimedOut && script.currentblocknumber <= 3) 0.5
else if (values.TimedOut && script.currentblocknumber <= 6) 1.0
else if (values.TimedOut && script.currentblocknumber <= 8) 1.5
else if (values.TimedOut) 2.0
else if (script.currentblocknumber == 1) 0.5
else if (script.currentblocknumber <= 3) 1.0
else if (script.currentblocknumber <= 6) 1.5
else if (script.currentblocknumber <= 8) 2.0
else 2.5
</expressions>

<trial QuitDueToAttentionChecks>
/ stimulustimes = [0 = clearscreen, QuitDueToAttentionChecks, PressSpaceToEnd]
/ recorddata = false
/ validresponse = (57)
/ ontrialend = [
    script.abort(true)
]
/ beginresponsetime = 2000
</trial>

<text QuitDueToAttentionChecks>
/ items = ("Dear participant, unfortunately, that was the second attention check you answered incorrectly.

This renders your dataset unusable. Thus, the experiment will now end.

You will be paid partial compensation through the Prolific bonus system in the amount of £<%format(~"%.2f~", expressions.FinalPayment)%>. Please do NOT click the completion link or the study coordinator will be forced to reject your submission, impacting your Prolific score. Instead, return the submission.

If you do not receive your bonus payment within three days, please contact the study coordinator via the Prolific messaging system.")
/ fontstyle = ("Verdana", 2%, false, false, false, false, 5, 1)
/ position = (50,50)
/ size = (75%,45%)
</text>

<trial QuitDueToResponsePattern>
/ stimulustimes = [0 = clearscreen, QuitDueToResponsePattern, PressSpaceToEnd]
/ recorddata = false
/ validresponse = (57)
/ ontrialend = [
    script.abort(true)
]
/ beginresponsetime = 2000
</trial>

<text QuitDueToResponsePattern>
/ items = ("Dear participant, unfortunately, your pattern of responses has rendered the data unusable to the researchers.

This has occurred because you responded to 20% or more of the trials of the previous task faster than 100ms. Previous research suggests that responses in this timeframe are unlikely to be reflective of evaluations of the ideographs.

You will be paid partial compensation through the Prolific bonus system in the amount of £<%format(~"%.2f~", expressions.FinalPayment)%>. Please do NOT click the completion link or the study coordinator will be forced to reject your submission, impacting your Prolific score. Instead, return the submission.

If you do not receive your bonus payment within three days, please contact the study coordinator via the Prolific messaging system.")
/ fontstyle = ("Verdana", 2%, false, false, false, false, 5, 1)
/ position = (50,50)
/ size = (75%,45%)
</text>

<text PressSpaceToEnd>
/ items = ("Press the SPACEBAR to end.")
/ fontstyle = ("Verdana", 2%, false, false, false, false, 5, 1)
/ position = (50,75)
</text>

So far, so good. However, I've hit a little snag for my final exclusion criterion. I want participants to skip out of the experiment if they don't respond to any given trial for three minutes. My approach has been to configure all the blocks that contain potential timeouts to check for latency at each trial's end and set a flag if it exceeds my limit:

<block MyBlock>
/ trials = [1-50 = MyTrial]
/ ontrialend = [
    if (script.currenttrial.latency > values.TimeOutThreshold) values.TimedOut = true
]
/ ontrialbegin = [
    if (values.TimedOut) script.currenttrial.trialduration = 0
]
/ branch = [
    if (values.TimedOut) block.TimedOut
]
</block>

<block TimedOut>
/ trials = [1 = QuitDueToTimeout]
</block>


<trial QuitDueToTimeout>
/ stimulustimes = [0 = clearscreen, QuitDueToTimeout, PressSpaceToEnd]
/ recorddata = false
/ validresponse = (57)
/ ontrialend = [
    script.abort(true)
]
/ beginresponsetime = 2000

</trial>

<text QuitDueToTimeout>
/ items = ("Dear participant, prior to your last response, you had not responded in the task for over three minutes. While we appreciate that this may be due to circumstances beyond your control, this renders your dataset unusable for our research, which studies psychological processes that occur in the short term. Thus, the experiment will now end.

You will be paid partial compensation through the Prolific bonus system based on the proportion of the study you completed (£<%format(~"%.2f~", expressions.FinalPayment)%>). Please do NOT click the completion link or the study coordinator will be forced to reject your submission, impacting your Prolific score. Instead, return the submission.

If you do not receive your bonus payment within three days, please contact the study coordinator via the Prolific messaging system.")
/ fontstyle = ("Verdana", 2%, false, false, false, false, 5, 1)
/ position = (50,50)
/ size = (75%,45%)
</text>


The idea is that the flag should lead to all remaining trials in the block being skipped and the block then branching to a special block which informs the participant about the timeout and then aborts the experiment. However, I'm having a little trouble efficiently skipping trials. Setting their duration to 0 (as in the script above) still leads to the stimuli briefly flashing on screen for each trial, which is likely to confuse participants and leads to unnecessary wait time. I can't seem to set the /skip property in script (e.g. "/ ontrialbegin = [if (values.TimedOut) script.currenttrial.skip = true]" does nothing), which would of course be the most efficient solution.

My current solution is to set values.TimedOut as a /skip condition for each trial in the block, which works. However, this is inelegant and vulnerable to copy-paste errors for future experiments. I would like to have these "premature ending" trials as template elements that I can add to a study, briefly configure via the <block> elements and then forget about - and also pass on to other people who use Inquisit without too high of a bar for usage. Anyone have any ideas?

It seems to me that what you want isn't a /skip condition for trials, but a /stop condition at the <block>-level.

https://www.millisecond.com/support/docs/v6/html/language/attributes/stop.htm
AKrishna
AKrishna
Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)
Group: Forum Members
Posts: 118, Visits: 396
...and another attribute I never knew about until now. Thanks a lot, Dave!

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search