Calculate specific incorrect responses


Author
Message
DSaraqini
DSaraqini
New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)
Group: Forum Members
Posts: 12, Visits: 35
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 (8 views, 48.00 KB)
Dave
Dave
Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)
Group: Administrators
Posts: 10K, Visits: 56K
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
New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)
Group: Forum Members
Posts: 12, Visits: 35
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 (11 views, 49.00 KB)
Dave
Dave
Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)Supreme Being (817K reputation)
Group: Administrators
Posts: 10K, Visits: 56K
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