Millisecond Forums

Calculate specific incorrect responses

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

By DSaraqini - 6/10/2020

Hello,

For our study we ask participants to sort pictures of people into short hair vs. long hair, while also looking for some targets. To sort for short hair, they have to press the 'S' key on their keyboard. To sort for long hair, they have to press the 'L' key. If they see a target they have to press 'H'. The way our script is right now, it records each correct response and the average correct responses. However, we want to also have a summary variable for the proportion of pictures that participants respond with the "H" key on. So, although the correct 'H' response is only for the targets, we want to calculate each time they press 'H' and have that as a variable in our summary data. Hope that makes sense.

I have attached all of our script and also present a part of it here: 

<trial ShortHairFace>
/ stimulustimes = [0=ready; 100=ShortHairFace,PromptAssign]
/ validresponse = ("L","H", "S")
/ correctresponse = ("S")
/beginresponsetime = 100
/ ontrialend = [
    list.ShortHair.insertitem(trial.ShortHairFace.correct, 1);
    list.ongoingaccuracy.insertitem(trial.ShortHairFace.correct,1);
    if (trial.ShortHairFace.correct) {
        list.ShortHair_correctRT.insertitem(trial.ShortHairFace.latency, 1);
        list.ongoingRT.insertitem(trial.ShortHairFace.latency,1);
    };
]
</trial>
By Dave - 6/10/2020

DSaraqini - 6/10/2020
Hello,

For our study we ask participants to sort pictures of people into short hair vs. long hair, while also looking for some targets. To sort for short hair, they have to press the 'S' key on their keyboard. To sort for long hair, they have to press the 'L' key. If they see a target they have to press 'H'. The way our script is right now, it records each correct response and the average correct responses. However, we want to also have a summary variable for the proportion of pictures that participants respond with the "H" key on. So, although the correct 'H' response is only for the targets, we want to calculate each time they press 'H' and have that as a variable in our summary data. Hope that makes sense.

I have attached all of our script and also present a part of it here: 

<trial ShortHairFace>
/ stimulustimes = [0=ready; 100=ShortHairFace,PromptAssign]
/ validresponse = ("L","H", "S")
/ correctresponse = ("S")
/beginresponsetime = 100
/ ontrialend = [
    list.ShortHair.insertitem(trial.ShortHairFace.correct, 1);
    list.ongoingaccuracy.insertitem(trial.ShortHairFace.correct,1);
    if (trial.ShortHairFace.correct) {
        list.ShortHair_correctRT.insertitem(trial.ShortHairFace.latency, 1);
        list.ongoingRT.insertitem(trial.ShortHairFace.latency,1);
    };
]
</trial>

Set up a <list> to track those responses and then popolate that list as you already do with the other ones /ontrialend.

<trial ShortHairFace>
/ stimulustimes = [0=ready; 100=ShortHairFace,PromptAssign]
/ validresponse = ("L","H", "S")
/ correctresponse = ("S")
/beginresponsetime = 100
/ ontrialend = [
    if (trial.ShortHairFace.response == 35) {
        list.h_responses.insertitem(1, 1);
    } else {
        list.h_responses.insertitem(0, 1);
    }
]
/ ontrialend = [
  list.ShortHair.insertitem(trial.ShortHairFace.correct, 1);
  list.ongoingaccuracy.insertitem(trial.ShortHairFace.correct,1);
  if (trial.ShortHairFace.correct) {
   list.ShortHair_correctRT.insertitem(trial.ShortHairFace.latency, 1);
   list.ongoingRT.insertitem(trial.ShortHairFace.latency,1);
  };
]
</trial>

<list h_responses>
</list>
By DSaraqini - 6/10/2020

Hello Dave,

Thank you so much for your response. I made it work but without the 'else' part of the 'if' statement. In other words, the script was not able to recognize this part: 

else {
   list.h_responses.insertitem(0, 1);
  }

Any idea why? And is it necessary to have the 'else'?
By Dave - 6/11/2020

DSaraqini - 6/11/2020
Hello Dave,

Thank you so much for your response. I made it work but without the 'else' part of the 'if' statement. In other words, the script was not able to recognize this part: 

else {
   list.h_responses.insertitem(0, 1);
  }

Any idea why? And is it necessary to have the 'else'?

<trial ShortHairFace>
/ stimulustimes = [0=ready; 100=ShortHairFace,PromptAssign]
/ validresponse = ("L","H", "S")
/ correctresponse = ("S")
/beginresponsetime = 100
/ ontrialend = [
        if(trial.ShortHairFace.response == 35){
        list.HResponses_NonTarget.insertitem(1,1);
    }else{
        list.HResponses_NonTarget.insteritem(0,1);
    }
]
...
</trial>

Please notice the typo in your script, You've written "insteritem()", not "insertitem()".