Calculate specific incorrect responses


Author
Message
DSaraqini
DSaraqini
Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)
Group: Forum Members
Posts: 21, Visits: 59
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>
Attachments
DS_Empathy_S1_6-10.iqx (218 views, 48.00 KB)
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: 12K, Visits: 98K
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>
DSaraqini
DSaraqini
Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)Associate Member (253 reputation)
Group: Forum Members
Posts: 21, Visits: 59
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'?
Attachments
DS_Empathy_S1_6-11.iqx (197 views, 49.00 KB)
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: 12K, Visits: 98K
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()".

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search