Millisecond Forums

Rotor task nans

https://forums.millisecond.com/Topic23093.aspx

By aquirk - 12/14/2017

Hi,

I'm running a version of the rotor task and getting too many nans in my results. Sometimes this is when the person doesn't move their mouse, but sometimes it's when they get a perfect score. I can't figure out how to differentiate between the two, or how to make it so I'm capturing true time on task. I've attached my script for reference. Thanks.
By Dave - 12/14/2017

aquirk - Thursday, December 14, 2017
Hi,

I'm running a version of the rotor task and getting too many nans in my results. Sometimes this is when the person doesn't move their mouse, but sometimes it's when they get a perfect score. I can't figure out how to differentiate between the two, or how to make it so I'm capturing true time on task. I've attached my script for reference. Thanks.

I've done a number of test runs with that script now and am not seeing any nans under those conditions (not moving mouse and/or (near) perfect target tracking).

Perhaps it would help if you could provide some data files that show the issue. That might provide some pointers as to what may be going wrong and where.
By aquirk - 12/14/2017

Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Hi,

I'm running a version of the rotor task and getting too many nans in my results. Sometimes this is when the person doesn't move their mouse, but sometimes it's when they get a perfect score. I can't figure out how to differentiate between the two, or how to make it so I'm capturing true time on task. I've attached my script for reference. Thanks.

I've done a number of test runs with that script now and am not seeing any nans under those conditions (not moving mouse and/or (near) perfect target tracking).

Perhaps it would help if you could provide some data files that show the issue. That might provide some pointers as to what may be going wrong and where.

Here's a data file with the nans. Under trialcode (column M), test 1 is the hardest and test 7 is the easiest. 
By Dave - 12/14/2017

aquirk - Thursday, December 14, 2017
Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Hi,

I'm running a version of the rotor task and getting too many nans in my results. Sometimes this is when the person doesn't move their mouse, but sometimes it's when they get a perfect score. I can't figure out how to differentiate between the two, or how to make it so I'm capturing true time on task. I've attached my script for reference. Thanks.

I've done a number of test runs with that script now and am not seeing any nans under those conditions (not moving mouse and/or (near) perfect target tracking).

Perhaps it would help if you could provide some data files that show the issue. That might provide some pointers as to what may be going wrong and where.

Here's a data file with the nans. Under trialcode (column M), test 1 is the hardest and test 7 is the easiest. 

Thanks for the data -- after turning it left to right and upside down, I think the following holds:
- The "nan" issue predominantly occurs in the "slow" rotation trials, i.e. mostly trial5 to trial7. The slower the rotation speed, the higher the rate of occurrence.
- It indeed appears to be due to the participant tracking the target _perfectly_, i.e. without slipping off-target even a single time during the entire 20 seconds of rotation. The consequence is that no values/items are ever entered into the per-trial "off distance" and "off duration" <list>s.

<trial test7>
/ stimulusframes = [1 = clearscreen, innerTrack, animatedCircle7]
/ validresponse = (mousemove)
/ isvalidresponse = [
    if (trial.test7.response == "mousemove" && expressions.distance7 > parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_total.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 1) {
            values.startOffTarget = script.elapsedtime;
            values.previous_targetlocation = 0;
        } ;
        1 == 1;
    } else if (trial.test7.response == "mousemove" && expressions.distance7 <= parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 0) {
            values.offDuration = script.elapsedtime - values.startOffTarget;
            list.offDurations_total.insertitem(values.offDuration, 1);
            list.offDurations_trial.insertitem(values.offDuration, 1);
            values.previous_targetlocation = 1;
        } ;
        1 == 1;
    }
]
...
</trial>

They remain empty (i.e. contain zero items), and consequently expressions.sum_offDurations_trial

<expressions>
...
/ sum_offDurations_trial = list.offDurations_trial.mean * list.offDurations_trial.itemcount
...
</expressions>

returns "not a number" ( nan ) with all the follow-on effects.

In most cases, however, it *should* be possible  to verify those instances of perfect target tracking with the data you have at hand nonetheless.
Even though expressions.timeOnTarget_trial does not capture the duration for the reason sketched out above, what *does* capture the relevant information regardless is expressions.timeOnTarget_total. To illustrate, take subject # 185835477 from your data set:



You can see the "nan" occurence in trial7, but calculating the difference between the value of expressions.timeOnTarget_total in trial7 and its value in the preceding trial verifies that the full time was spent "on target": (71018 - 51018) = 20000.


By aquirk - 12/14/2017

Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Hi,

I'm running a version of the rotor task and getting too many nans in my results. Sometimes this is when the person doesn't move their mouse, but sometimes it's when they get a perfect score. I can't figure out how to differentiate between the two, or how to make it so I'm capturing true time on task. I've attached my script for reference. Thanks.

I've done a number of test runs with that script now and am not seeing any nans under those conditions (not moving mouse and/or (near) perfect target tracking).

Perhaps it would help if you could provide some data files that show the issue. That might provide some pointers as to what may be going wrong and where.

Here's a data file with the nans. Under trialcode (column M), test 1 is the hardest and test 7 is the easiest. 

Thanks for the data -- after turning it left to right and upside down, I think the following holds:
- The "nan" issue predominantly occurs in the "slow" rotation trials, i.e. mostly trial5 to trial7. The slower the rotation speed, the higher the rate of occurrence.
- It indeed appears to be due to the participant tracking the target _perfectly_, i.e. without slipping off-target even a single time during the entire 20 seconds of rotation. The consequence is that no values/items are ever entered into the per-trial "off distance" and "off duration" <list>s.

<trial test7>
/ stimulusframes = [1 = clearscreen, innerTrack, animatedCircle7]
/ validresponse = (mousemove)
/ isvalidresponse = [
    if (trial.test7.response == "mousemove" && expressions.distance7 > parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_total.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 1) {
            values.startOffTarget = script.elapsedtime;
            values.previous_targetlocation = 0;
        } ;
        1 == 1;
    } else if (trial.test7.response == "mousemove" && expressions.distance7 <= parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 0) {
            values.offDuration = script.elapsedtime - values.startOffTarget;
            list.offDurations_total.insertitem(values.offDuration, 1);
            list.offDurations_trial.insertitem(values.offDuration, 1);
            values.previous_targetlocation = 1;
        } ;
        1 == 1;
    }
]
...
</trial>

They remain empty (i.e. contain zero items), and consequently expressions.sum_offDurations_trial

<expressions>
...
/ sum_offDurations_trial = list.offDurations_trial.mean * list.offDurations_trial.itemcount
...
</expressions>

returns "not a number" ( nan ) with all the follow-on effects.

In most cases, however, it *should* be possible  to verify those instances of perfect target tracking with the data you have at hand nonetheless.
Even though expressions.timeOnTarget_trial does not capture the duration for the reason sketched out above, what *does* capture the relevant information regardless is expressions.timeOnTarget_total. To illustrate, take subject # 185835477 from your data set:



You can see the "nan" occurence in trial7, but calculating the difference between the value of expressions.timeOnTarget_total in trial7 and its value in the preceding trial verifies that the full time was spent "on target": (71018 - 51018) = 20000.



Yes, that's right, unfortunately it looks like any time there's an nan in time on target trial, expressions.timeOnTarget_total increases by 20000. You can see that in the attached file, which is only people tracing the most difficult rotation. All nans here are also accompanied by increases of 20000 in the expressions.timeOnTarget_total column, even though it's virtually impossible for anyone in this condition to be getting a perfect score. 
By Dave - 12/15/2017

aquirk - Friday, December 15, 2017
Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Hi,

I'm running a version of the rotor task and getting too many nans in my results. Sometimes this is when the person doesn't move their mouse, but sometimes it's when they get a perfect score. I can't figure out how to differentiate between the two, or how to make it so I'm capturing true time on task. I've attached my script for reference. Thanks.

I've done a number of test runs with that script now and am not seeing any nans under those conditions (not moving mouse and/or (near) perfect target tracking).

Perhaps it would help if you could provide some data files that show the issue. That might provide some pointers as to what may be going wrong and where.

Here's a data file with the nans. Under trialcode (column M), test 1 is the hardest and test 7 is the easiest. 

Thanks for the data -- after turning it left to right and upside down, I think the following holds:
- The "nan" issue predominantly occurs in the "slow" rotation trials, i.e. mostly trial5 to trial7. The slower the rotation speed, the higher the rate of occurrence.
- It indeed appears to be due to the participant tracking the target _perfectly_, i.e. without slipping off-target even a single time during the entire 20 seconds of rotation. The consequence is that no values/items are ever entered into the per-trial "off distance" and "off duration" <list>s.

<trial test7>
/ stimulusframes = [1 = clearscreen, innerTrack, animatedCircle7]
/ validresponse = (mousemove)
/ isvalidresponse = [
    if (trial.test7.response == "mousemove" && expressions.distance7 > parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_total.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 1) {
            values.startOffTarget = script.elapsedtime;
            values.previous_targetlocation = 0;
        } ;
        1 == 1;
    } else if (trial.test7.response == "mousemove" && expressions.distance7 <= parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 0) {
            values.offDuration = script.elapsedtime - values.startOffTarget;
            list.offDurations_total.insertitem(values.offDuration, 1);
            list.offDurations_trial.insertitem(values.offDuration, 1);
            values.previous_targetlocation = 1;
        } ;
        1 == 1;
    }
]
...
</trial>

They remain empty (i.e. contain zero items), and consequently expressions.sum_offDurations_trial

<expressions>
...
/ sum_offDurations_trial = list.offDurations_trial.mean * list.offDurations_trial.itemcount
...
</expressions>

returns "not a number" ( nan ) with all the follow-on effects.

In most cases, however, it *should* be possible  to verify those instances of perfect target tracking with the data you have at hand nonetheless.
Even though expressions.timeOnTarget_trial does not capture the duration for the reason sketched out above, what *does* capture the relevant information regardless is expressions.timeOnTarget_total. To illustrate, take subject # 185835477 from your data set:



You can see the "nan" occurence in trial7, but calculating the difference between the value of expressions.timeOnTarget_total in trial7 and its value in the preceding trial verifies that the full time was spent "on target": (71018 - 51018) = 20000.



Yes, that's right, unfortunately it looks like any time there's an nan in time on target trial, expressions.timeOnTarget_total increases by 20000. You can see that in the attached file, which is only people tracing the most difficult rotation. All nans here are also accompanied by increases of 20000 in the expressions.timeOnTarget_total column, even though it's virtually impossible for anyone in this condition to be getting a perfect score. 

You ought to make use of the information in the list.targetDistances_trial.itemcount variable in addition. If the number recorded there is 0 (as it is in the case of the nans in that 2nd data set) or otherwise very low, you need to discard the data from that trial anyway.

                                                                                                                                                                                       
























By aquirk - 12/15/2017

Dave - Friday, December 15, 2017
aquirk - Friday, December 15, 2017
Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Hi,

I'm running a version of the rotor task and getting too many nans in my results. Sometimes this is when the person doesn't move their mouse, but sometimes it's when they get a perfect score. I can't figure out how to differentiate between the two, or how to make it so I'm capturing true time on task. I've attached my script for reference. Thanks.

I've done a number of test runs with that script now and am not seeing any nans under those conditions (not moving mouse and/or (near) perfect target tracking).

Perhaps it would help if you could provide some data files that show the issue. That might provide some pointers as to what may be going wrong and where.

Here's a data file with the nans. Under trialcode (column M), test 1 is the hardest and test 7 is the easiest. 

Thanks for the data -- after turning it left to right and upside down, I think the following holds:
- The "nan" issue predominantly occurs in the "slow" rotation trials, i.e. mostly trial5 to trial7. The slower the rotation speed, the higher the rate of occurrence.
- It indeed appears to be due to the participant tracking the target _perfectly_, i.e. without slipping off-target even a single time during the entire 20 seconds of rotation. The consequence is that no values/items are ever entered into the per-trial "off distance" and "off duration" <list>s.

<trial test7>
/ stimulusframes = [1 = clearscreen, innerTrack, animatedCircle7]
/ validresponse = (mousemove)
/ isvalidresponse = [
    if (trial.test7.response == "mousemove" && expressions.distance7 > parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_total.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 1) {
            values.startOffTarget = script.elapsedtime;
            values.previous_targetlocation = 0;
        } ;
        1 == 1;
    } else if (trial.test7.response == "mousemove" && expressions.distance7 <= parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 0) {
            values.offDuration = script.elapsedtime - values.startOffTarget;
            list.offDurations_total.insertitem(values.offDuration, 1);
            list.offDurations_trial.insertitem(values.offDuration, 1);
            values.previous_targetlocation = 1;
        } ;
        1 == 1;
    }
]
...
</trial>

They remain empty (i.e. contain zero items), and consequently expressions.sum_offDurations_trial

<expressions>
...
/ sum_offDurations_trial = list.offDurations_trial.mean * list.offDurations_trial.itemcount
...
</expressions>

returns "not a number" ( nan ) with all the follow-on effects.

In most cases, however, it *should* be possible  to verify those instances of perfect target tracking with the data you have at hand nonetheless.
Even though expressions.timeOnTarget_trial does not capture the duration for the reason sketched out above, what *does* capture the relevant information regardless is expressions.timeOnTarget_total. To illustrate, take subject # 185835477 from your data set:



You can see the "nan" occurence in trial7, but calculating the difference between the value of expressions.timeOnTarget_total in trial7 and its value in the preceding trial verifies that the full time was spent "on target": (71018 - 51018) = 20000.



Yes, that's right, unfortunately it looks like any time there's an nan in time on target trial, expressions.timeOnTarget_total increases by 20000. You can see that in the attached file, which is only people tracing the most difficult rotation. All nans here are also accompanied by increases of 20000 in the expressions.timeOnTarget_total column, even though it's virtually impossible for anyone in this condition to be getting a perfect score. 

You ought to make use of the information in the list.targetDistances_trial.itemcount variable in addition. If the number recorded there is 0 (as it is in the case of the nans in that 2nd data set) or otherwise very low, you need to discard the data from that trial anyway.

                                                                                                                                                                                       

























Thanks Dave. This is extremely helpful. Just one more question--in some cases it seems there's 'nan' in the expressions.timeOnTarget_total column as well. Do you know why that would happen? Any suggestions for how to figure out the true time on target in those situations?
By Dave - 12/15/2017

aquirk - Friday, December 15, 2017
Dave - Friday, December 15, 2017
aquirk - Friday, December 15, 2017
Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Hi,

I'm running a version of the rotor task and getting too many nans in my results. Sometimes this is when the person doesn't move their mouse, but sometimes it's when they get a perfect score. I can't figure out how to differentiate between the two, or how to make it so I'm capturing true time on task. I've attached my script for reference. Thanks.

I've done a number of test runs with that script now and am not seeing any nans under those conditions (not moving mouse and/or (near) perfect target tracking).

Perhaps it would help if you could provide some data files that show the issue. That might provide some pointers as to what may be going wrong and where.

Here's a data file with the nans. Under trialcode (column M), test 1 is the hardest and test 7 is the easiest. 

Thanks for the data -- after turning it left to right and upside down, I think the following holds:
- The "nan" issue predominantly occurs in the "slow" rotation trials, i.e. mostly trial5 to trial7. The slower the rotation speed, the higher the rate of occurrence.
- It indeed appears to be due to the participant tracking the target _perfectly_, i.e. without slipping off-target even a single time during the entire 20 seconds of rotation. The consequence is that no values/items are ever entered into the per-trial "off distance" and "off duration" <list>s.

<trial test7>
/ stimulusframes = [1 = clearscreen, innerTrack, animatedCircle7]
/ validresponse = (mousemove)
/ isvalidresponse = [
    if (trial.test7.response == "mousemove" && expressions.distance7 > parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_total.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 1) {
            values.startOffTarget = script.elapsedtime;
            values.previous_targetlocation = 0;
        } ;
        1 == 1;
    } else if (trial.test7.response == "mousemove" && expressions.distance7 <= parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 0) {
            values.offDuration = script.elapsedtime - values.startOffTarget;
            list.offDurations_total.insertitem(values.offDuration, 1);
            list.offDurations_trial.insertitem(values.offDuration, 1);
            values.previous_targetlocation = 1;
        } ;
        1 == 1;
    }
]
...
</trial>

They remain empty (i.e. contain zero items), and consequently expressions.sum_offDurations_trial

<expressions>
...
/ sum_offDurations_trial = list.offDurations_trial.mean * list.offDurations_trial.itemcount
...
</expressions>

returns "not a number" ( nan ) with all the follow-on effects.

In most cases, however, it *should* be possible  to verify those instances of perfect target tracking with the data you have at hand nonetheless.
Even though expressions.timeOnTarget_trial does not capture the duration for the reason sketched out above, what *does* capture the relevant information regardless is expressions.timeOnTarget_total. To illustrate, take subject # 185835477 from your data set:



You can see the "nan" occurence in trial7, but calculating the difference between the value of expressions.timeOnTarget_total in trial7 and its value in the preceding trial verifies that the full time was spent "on target": (71018 - 51018) = 20000.



Yes, that's right, unfortunately it looks like any time there's an nan in time on target trial, expressions.timeOnTarget_total increases by 20000. You can see that in the attached file, which is only people tracing the most difficult rotation. All nans here are also accompanied by increases of 20000 in the expressions.timeOnTarget_total column, even though it's virtually impossible for anyone in this condition to be getting a perfect score. 

You ought to make use of the information in the list.targetDistances_trial.itemcount variable in addition. If the number recorded there is 0 (as it is in the case of the nans in that 2nd data set) or otherwise very low, you need to discard the data from that trial anyway.

                                                                                                                                                                                       

























Thanks Dave. This is extremely helpful. Just one more question--in some cases it seems there's 'nan' in the expressions.timeOnTarget_total column as well. Do you know why that would happen? Any suggestions for how to figure out the true time on target in those situations?

Would it be possible to point me to one or two of such specific cases? It's kind of hard to figure out which ones you may mean.
By aquirk - 12/15/2017

Dave - Friday, December 15, 2017
aquirk - Friday, December 15, 2017
Dave - Friday, December 15, 2017
aquirk - Friday, December 15, 2017
Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Hi,

I'm running a version of the rotor task and getting too many nans in my results. Sometimes this is when the person doesn't move their mouse, but sometimes it's when they get a perfect score. I can't figure out how to differentiate between the two, or how to make it so I'm capturing true time on task. I've attached my script for reference. Thanks.

I've done a number of test runs with that script now and am not seeing any nans under those conditions (not moving mouse and/or (near) perfect target tracking).

Perhaps it would help if you could provide some data files that show the issue. That might provide some pointers as to what may be going wrong and where.

Here's a data file with the nans. Under trialcode (column M), test 1 is the hardest and test 7 is the easiest. 

Thanks for the data -- after turning it left to right and upside down, I think the following holds:
- The "nan" issue predominantly occurs in the "slow" rotation trials, i.e. mostly trial5 to trial7. The slower the rotation speed, the higher the rate of occurrence.
- It indeed appears to be due to the participant tracking the target _perfectly_, i.e. without slipping off-target even a single time during the entire 20 seconds of rotation. The consequence is that no values/items are ever entered into the per-trial "off distance" and "off duration" <list>s.

<trial test7>
/ stimulusframes = [1 = clearscreen, innerTrack, animatedCircle7]
/ validresponse = (mousemove)
/ isvalidresponse = [
    if (trial.test7.response == "mousemove" && expressions.distance7 > parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_total.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 1) {
            values.startOffTarget = script.elapsedtime;
            values.previous_targetlocation = 0;
        } ;
        1 == 1;
    } else if (trial.test7.response == "mousemove" && expressions.distance7 <= parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 0) {
            values.offDuration = script.elapsedtime - values.startOffTarget;
            list.offDurations_total.insertitem(values.offDuration, 1);
            list.offDurations_trial.insertitem(values.offDuration, 1);
            values.previous_targetlocation = 1;
        } ;
        1 == 1;
    }
]
...
</trial>

They remain empty (i.e. contain zero items), and consequently expressions.sum_offDurations_trial

<expressions>
...
/ sum_offDurations_trial = list.offDurations_trial.mean * list.offDurations_trial.itemcount
...
</expressions>

returns "not a number" ( nan ) with all the follow-on effects.

In most cases, however, it *should* be possible  to verify those instances of perfect target tracking with the data you have at hand nonetheless.
Even though expressions.timeOnTarget_trial does not capture the duration for the reason sketched out above, what *does* capture the relevant information regardless is expressions.timeOnTarget_total. To illustrate, take subject # 185835477 from your data set:



You can see the "nan" occurence in trial7, but calculating the difference between the value of expressions.timeOnTarget_total in trial7 and its value in the preceding trial verifies that the full time was spent "on target": (71018 - 51018) = 20000.



Yes, that's right, unfortunately it looks like any time there's an nan in time on target trial, expressions.timeOnTarget_total increases by 20000. You can see that in the attached file, which is only people tracing the most difficult rotation. All nans here are also accompanied by increases of 20000 in the expressions.timeOnTarget_total column, even though it's virtually impossible for anyone in this condition to be getting a perfect score. 

You ought to make use of the information in the list.targetDistances_trial.itemcount variable in addition. If the number recorded there is 0 (as it is in the case of the nans in that 2nd data set) or otherwise very low, you need to discard the data from that trial anyway.

                                                                                                                                                                                       

























Thanks Dave. This is extremely helpful. Just one more question--in some cases it seems there's 'nan' in the expressions.timeOnTarget_total column as well. Do you know why that would happen? Any suggestions for how to figure out the true time on target in those situations?

Would it be possible to point me to one or two of such specific cases? It's kind of hard to figure out which ones you may mean.

Here's an example. The third column is time during trial, the fourth is total time, the fifth is the item count, and the sixth and last column is my attempt to replace the nans. As you can see, the ones near the bottom are filling in correctly, because I'm taking the difference from the total column (column four). However, the ones in the first few rows can't calculate because there's a 'nan' in the total column.


By Dave - 12/15/2017

aquirk - Friday, December 15, 2017
Dave - Friday, December 15, 2017
aquirk - Friday, December 15, 2017
Dave - Friday, December 15, 2017
aquirk - Friday, December 15, 2017
Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Dave - Thursday, December 14, 2017
aquirk - Thursday, December 14, 2017
Hi,

I'm running a version of the rotor task and getting too many nans in my results. Sometimes this is when the person doesn't move their mouse, but sometimes it's when they get a perfect score. I can't figure out how to differentiate between the two, or how to make it so I'm capturing true time on task. I've attached my script for reference. Thanks.

I've done a number of test runs with that script now and am not seeing any nans under those conditions (not moving mouse and/or (near) perfect target tracking).

Perhaps it would help if you could provide some data files that show the issue. That might provide some pointers as to what may be going wrong and where.

Here's a data file with the nans. Under trialcode (column M), test 1 is the hardest and test 7 is the easiest. 

Thanks for the data -- after turning it left to right and upside down, I think the following holds:
- The "nan" issue predominantly occurs in the "slow" rotation trials, i.e. mostly trial5 to trial7. The slower the rotation speed, the higher the rate of occurrence.
- It indeed appears to be due to the participant tracking the target _perfectly_, i.e. without slipping off-target even a single time during the entire 20 seconds of rotation. The consequence is that no values/items are ever entered into the per-trial "off distance" and "off duration" <list>s.

<trial test7>
/ stimulusframes = [1 = clearscreen, innerTrack, animatedCircle7]
/ validresponse = (mousemove)
/ isvalidresponse = [
    if (trial.test7.response == "mousemove" && expressions.distance7 > parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_trial.insertitem(expressions.distance7, 1);
        list.offTargetDistance_total.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 1) {
            values.startOffTarget = script.elapsedtime;
            values.previous_targetlocation = 0;
        } ;
        1 == 1;
    } else if (trial.test7.response == "mousemove" && expressions.distance7 <= parameters.targetDiscSize) {
        list.targetDistances_total.insertitem(expressions.distance7, 1);
        list.targetDistances_trial.insertitem(expressions.distance7, 1);
        if (values.previous_targetlocation == 0) {
            values.offDuration = script.elapsedtime - values.startOffTarget;
            list.offDurations_total.insertitem(values.offDuration, 1);
            list.offDurations_trial.insertitem(values.offDuration, 1);
            values.previous_targetlocation = 1;
        } ;
        1 == 1;
    }
]
...
</trial>

They remain empty (i.e. contain zero items), and consequently expressions.sum_offDurations_trial

<expressions>
...
/ sum_offDurations_trial = list.offDurations_trial.mean * list.offDurations_trial.itemcount
...
</expressions>

returns "not a number" ( nan ) with all the follow-on effects.

In most cases, however, it *should* be possible  to verify those instances of perfect target tracking with the data you have at hand nonetheless.
Even though expressions.timeOnTarget_trial does not capture the duration for the reason sketched out above, what *does* capture the relevant information regardless is expressions.timeOnTarget_total. To illustrate, take subject # 185835477 from your data set:



You can see the "nan" occurence in trial7, but calculating the difference between the value of expressions.timeOnTarget_total in trial7 and its value in the preceding trial verifies that the full time was spent "on target": (71018 - 51018) = 20000.



Yes, that's right, unfortunately it looks like any time there's an nan in time on target trial, expressions.timeOnTarget_total increases by 20000. You can see that in the attached file, which is only people tracing the most difficult rotation. All nans here are also accompanied by increases of 20000 in the expressions.timeOnTarget_total column, even though it's virtually impossible for anyone in this condition to be getting a perfect score. 

You ought to make use of the information in the list.targetDistances_trial.itemcount variable in addition. If the number recorded there is 0 (as it is in the case of the nans in that 2nd data set) or otherwise very low, you need to discard the data from that trial anyway.

                                                                                                                                                                                       

























Thanks Dave. This is extremely helpful. Just one more question--in some cases it seems there's 'nan' in the expressions.timeOnTarget_total column as well. Do you know why that would happen? Any suggestions for how to figure out the true time on target in those situations?

Would it be possible to point me to one or two of such specific cases? It's kind of hard to figure out which ones you may mean.

Here's an example. The third column is time during trial, the fourth is total time, the fifth is the item count, and the sixth and last column is my attempt to replace the nans. As you can see, the ones near the bottom are filling in correctly, because I'm taking the difference from the total column (column four). However, the ones in the first few rows can't calculate because there's a 'nan' in the total column.



Thanks for pointing out the specific example. I think the same logic as before is applicable here as well:

The total is 79900 at the end of the 4th trial. The 4th trial's individual result is 19900. So we have:
(79900 - 19900) = 60000

That, paired with the item count data (5th column) strongly suggests perfect performance in the preceding three trials, because

(60000 / 3) = 20000
By aquirk - 1/21/2018

Hi Dave,

I'm hoping to rerun this study, and would really like to not have to go back through and change all the nans by hand. Do you know of a code that can fix this issue?
By Dave - 1/22/2018

aquirk - Monday, January 22, 2018
Hi Dave,

I'm hoping to rerun this study, and would really like to not have to go back through and change all the nans by hand. Do you know of a code that can fix this issue?

I think changing the <expressions> to something along the lines of

<expressions>
...
/ offdurations_trial_mean = if (list.offDurations_trial.itemcount>0) list.offDurations_trial.mean else 0
/ sum_offDurations_trial = expressions.offdurations_trial_mean * list.offDurations_trial.itemcount
...
</expressions>

should do the trick. I.e., in case the off durations list is empty (contains no items, due to perfect target tracking), the above expression should ensure that expressions.sum_offDurations_trial returns 0 as the sum of off durations for the trial, instead of "not a number".
By aquirk - 1/22/2018

Thanks, that's working for the perfect scores, but looks like it's also recording no movement as a perfect score now? Any idea how to fix that?
By Dave - 1/22/2018

aquirk - Monday, January 22, 2018
Thanks, that's working for the perfect scores, but looks like it's also recording no movement as a perfect score now? Any idea how to fix that?

Could you show me a data file that illustrates that? (NB: As before, no or minimal movement should be detectable per the values logged in the list.targetDistances_trial.itemcount column, and trials with low or zero values there should be discarded.)
By aquirk - 1/22/2018

I'm working with the trial version so it doesn't record the data when I test this out, but if you run the attached script you can see for yourself in the feedback pages between each trial it'll say 2 if you don't move your mouse at all (each trial is 2 seconds long). FYI--the instructions may not match the correct times, I shortened the trial and rest times for testing purposes.
By Dave - 1/22/2018

aquirk - Monday, January 22, 2018
I'm working with the trial version so it doesn't record the data when I test this out, but if you run the attached script you can see for yourself in the feedback pages between each trial it'll say 2 if you don't move your mouse at all (each trial is 2 seconds long). FYI--the instructions may not match the correct times, I shortened the trial and rest times for testing purposes.

Hmm, that's not what I'm seeing. I'm getting very low values (both on-screen as well as in the data file) depending on where exactly I positioned the mouse within the circle during the start trial. But maybe something is throwing things off on my system because it's virtually impossible for me to not move the mouse at all.

If you direct message me your trial installation's computer key, I can give you a special registration key that will reset the trial period -- you can then record data again (for another 30 days), and maybe some of your data file(s) will tell me what's going on.
By aquirk - 1/22/2018

Great, thanks so much. The computer key is BE4B400A3A0B4A0E.
By Dave - 1/22/2018

aquirk - Monday, January 22, 2018
Great, thanks so much. The computer key is BE4B400A3A0B4A0E.

Thanks for the computer key. Please paste the following key

A44ABAABA2356644

into the "REGISTRATION KEY:" field and then click the "Get Registration Key" button. This should reset the trial period.
By aquirk - 1/22/2018

Here's the data file. In trials 1-3 I didn't move my mouse at all. In trials 4-6 I did move it, and got a perfect score on trial 5. In trials 7 and 8, I didn't move my mouse again.
By Dave - 1/23/2018

aquirk - Tuesday, January 23, 2018
Here's the data file. In trials 1-3 I didn't move my mouse at all. In trials 4-6 I did move it, and got a perfect score on trial 5. In trials 7 and 8, I didn't move my mouse again.

Thanks for the data file. Since the non-movement in trials 1-3 as well as trials 7-8 appears to be correctly detected / reflected by list.targetDistances_trial.itemcount, it shoud be possible to factor that in to the expression calculating the per-trial off-target duration:

<expressions>
...
/ offdurations_trial_mean = if (list.offDurations_trial.itemcount>0 && list.targetDistances_trial.itemcount>0) {
                            list.offDurations_trial.mean
                        } else if (list.targetDistances_trial.itemcount == 0) {
                            "nan"
                        } else
                            0   
                        }
/ sum_offDurations_trial = expressions.offdurations_trial_mean * list.offDurations_trial.itemcount
...
</expressions>


By aquirk - 1/23/2018

Hm, this returned a bunch of errors (see photo), and kept calculating perfect scores as zero (see data file).
By Dave - 1/23/2018

aquirk - Tuesday, January 23, 2018
Hm, this returned a bunch of errors (see photo), and kept calculating perfect scores as zero (see data file).

Copy and paste error on my part is responsible for that, sorry. The expression in my previous reply was missing a crucial "{":

/ offdurations_trial_mean = if (list.offDurations_trial.itemcount>0 && list.targetDistances_trial.itemcount>0) {
                            list.offDurations_trial.mean
                        } else if (list.targetDistances_trial.itemcount == 0) {
                            "nan"
                        } else {
                            0
                        }
By aquirk - 1/23/2018

Oh perfect, thank you so much! One last question (not a huge deal but I figured I'd check): on the feedback page if someone has 'nan' for any of the trials, in the section where it says their high score, nan is reported as the high score. Is there any way around this? To only list actual numbers for the high score?
By Dave - 1/23/2018

aquirk - Tuesday, January 23, 2018
Oh perfect, thank you so much! One last question (not a huge deal but I figured I'd check): on the feedback page if someone has 'nan' for any of the trials, in the section where it says their high score, nan is reported as the high score. Is there any way around this? To only list actual numbers for the high score?

About the only thing I can think of would be something like this:

<trial rest>
/ ontrialbegin = [if(expressions.offdurations_trial_mean >= 0){
    item.ontargettimes.appenditem(expressions.timeOnTarget_trial)
    } else {
        item.ontargettimes.appenditem("-1000")
    }
]

/ stimulusframes = [1 = clearscreen, BetweenTest]
/ timeout = parameters.restTime
/ branch = [
    trial.startRotate;
]
/ recorddata = false
</trial>

<trial rest1>
/ ontrialbegin = [if(expressions.offdurations_trial_mean >= 0){
    item.ontargettimes.appenditem(expressions.timeOnTarget_trial)
    } else {
        item.ontargettimes.appenditem("-1000")
    }
]

/ stimulusframes = [1 = clearscreen, BetweenTest1]
/ timeout = 5000
/ branch = [
    trial.startRotate;
]
/ recorddata = false
</trial>

<trial prequestion>
/ ontrialbegin = [if(expressions.offdurations_trial_mean >= 0){
    item.ontargettimes.appenditem(expressions.timeOnTarget_trial)
    } else {
        item.ontargettimes.appenditem("-1000")
    }
]

/ stimulusframes = [1 = clearscreen, BetweenTest2]
/ validresponse = (lbuttondown)
/ recorddata = false
/ branch = [
    trial.end
]
</trial>

That should result in the value -1 being displayed for "no movement" trials instead of the value "nan" (not a number). That, in turn, should lead to the high-score -- longest time on target for trials when there was movement -- being reported accurately as well.