Stroop Task, Random Color


Author
Message
DannyPilgrim
DannyPilgrim
Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)
Group: Forum Members
Posts: 37, Visits: 146
Hello everyone,

right now I am programming a Stroop-Task with different words and I would like to know whether it is possible to assign the colors (red, green, blue, yellow) in a randomized order for each participant.

Normally it would look like that:
<text rot>
/ items = ("rot")
/ color = red
</text rot>

<trial rot>
/ stimulustimes = [1=rot, redreminder, greenreminder, bluereminder, yellowreminder]
/ correctresponse = ("d")
/ validresponse = ("d" "f" "j" "k")
/ontrialend = [
    if (trial.rot.responsetext == "D"){
        values.responseCategory = "red";
    } else if (trial.rot.responsetext == "F"){
        values.responseCategory = "green";
    } else if (trial.rot.responsetext == "J"){
        values.responseCategory = "blue";
    } else if (trial.rot.responsetext == "K"){
        values.responseCategory = "yellow";
    };        
    list.responses.appenditem(trial.rot.correct);
    list.responses_congruent.appenditem(trial.rot.correct);
    if (trial.rot.correct) {
        list.latencies.appenditem(trial.rot.latency);
        list.latencies_congruent.appenditem(trial.rot.latency);
    }
]
</trial>

I would like to do it this way:
<text rot>
/ items = ("rot")
/ color = red, green, blue, yellow
</text rot>

<trial rot>
/ stimulustimes = [1=rot, redreminder, greenreminder, bluereminder, yellowreminder]
/ correctresponse = ("d") (Now I have the problem that I cannot specifiy the correct answer for this trial because of the randomization. What do I have to define for the result files to see which answer would have been the correct one if the participant pushed a button?)
/ validresponse = ("d" "f" "j" "k")
/ontrialend = [
  if (trial.rot.responsetext == "D"){
   values.responseCategory = "red";
  } else if (trial.rot.responsetext == "F"){
   values.responseCategory = "green";
  } else if (trial.rot.responsetext == "J"){
   values.responseCategory = "blue";
  } else if (trial.rot.responsetext == "K"){
   values.responseCategory = "yellow";
  };  
  list.responses.appenditem(trial.rot.correct);
  list.responses_congruent.appenditem(trial.rot.correct);
  if (trial.rot.correct) {
   list.latencies.appenditem(trial.rot.latency);
   list.latencies_congruent.appenditem(trial.rot.latency);
  }
]
</trial>

I hope you understand this issue. If additional information is required feel free to ask!

Thank you very much!

Best Regards,
Danny

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
DannyPilgrim - 4/29/2021
Hello everyone,

right now I am programming a Stroop-Task with different words and I would like to know whether it is possible to assign the colors (red, green, blue, yellow) in a randomized order for each participant.

Normally it would look like that:
<text rot>
/ items = ("rot")
/ color = red
</text rot>

<trial rot>
/ stimulustimes = [1=rot, redreminder, greenreminder, bluereminder, yellowreminder]
/ correctresponse = ("d")
/ validresponse = ("d" "f" "j" "k")
/ontrialend = [
    if (trial.rot.responsetext == "D"){
        values.responseCategory = "red";
    } else if (trial.rot.responsetext == "F"){
        values.responseCategory = "green";
    } else if (trial.rot.responsetext == "J"){
        values.responseCategory = "blue";
    } else if (trial.rot.responsetext == "K"){
        values.responseCategory = "yellow";
    };        
    list.responses.appenditem(trial.rot.correct);
    list.responses_congruent.appenditem(trial.rot.correct);
    if (trial.rot.correct) {
        list.latencies.appenditem(trial.rot.latency);
        list.latencies_congruent.appenditem(trial.rot.latency);
    }
]
</trial>

I would like to do it this way:
<text rot>
/ items = ("rot")
/ color = red, green, blue, yellow
</text rot>

<trial rot>
/ stimulustimes = [1=rot, redreminder, greenreminder, bluereminder, yellowreminder]
/ correctresponse = ("d") (Now I have the problem that I cannot specifiy the correct answer for this trial because of the randomization. What do I have to define for the result files to see which answer would have been the correct one if the participant pushed a button?)
/ validresponse = ("d" "f" "j" "k")
/ontrialend = [
  if (trial.rot.responsetext == "D"){
   values.responseCategory = "red";
  } else if (trial.rot.responsetext == "F"){
   values.responseCategory = "green";
  } else if (trial.rot.responsetext == "J"){
   values.responseCategory = "blue";
  } else if (trial.rot.responsetext == "K"){
   values.responseCategory = "yellow";
  };  
  list.responses.appenditem(trial.rot.correct);
  list.responses_congruent.appenditem(trial.rot.correct);
  if (trial.rot.correct) {
   list.latencies.appenditem(trial.rot.latency);
   list.latencies_congruent.appenditem(trial.rot.latency);
  }
]
</trial>

I hope you understand this issue. If additional information is required feel free to ask!

Thank you very much!

Best Regards,
Danny

You can set both the color as well as the correct response key from paired <list> elements.
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
Dave - 4/29/2021
DannyPilgrim - 4/29/2021
Hello everyone,

right now I am programming a Stroop-Task with different words and I would like to know whether it is possible to assign the colors (red, green, blue, yellow) in a randomized order for each participant.

Normally it would look like that:
<text rot>
/ items = ("rot")
/ color = red
</text rot>

<trial rot>
/ stimulustimes = [1=rot, redreminder, greenreminder, bluereminder, yellowreminder]
/ correctresponse = ("d")
/ validresponse = ("d" "f" "j" "k")
/ontrialend = [
    if (trial.rot.responsetext == "D"){
        values.responseCategory = "red";
    } else if (trial.rot.responsetext == "F"){
        values.responseCategory = "green";
    } else if (trial.rot.responsetext == "J"){
        values.responseCategory = "blue";
    } else if (trial.rot.responsetext == "K"){
        values.responseCategory = "yellow";
    };        
    list.responses.appenditem(trial.rot.correct);
    list.responses_congruent.appenditem(trial.rot.correct);
    if (trial.rot.correct) {
        list.latencies.appenditem(trial.rot.latency);
        list.latencies_congruent.appenditem(trial.rot.latency);
    }
]
</trial>

I would like to do it this way:
<text rot>
/ items = ("rot")
/ color = red, green, blue, yellow
</text rot>

<trial rot>
/ stimulustimes = [1=rot, redreminder, greenreminder, bluereminder, yellowreminder]
/ correctresponse = ("d") (Now I have the problem that I cannot specifiy the correct answer for this trial because of the randomization. What do I have to define for the result files to see which answer would have been the correct one if the participant pushed a button?)
/ validresponse = ("d" "f" "j" "k")
/ontrialend = [
  if (trial.rot.responsetext == "D"){
   values.responseCategory = "red";
  } else if (trial.rot.responsetext == "F"){
   values.responseCategory = "green";
  } else if (trial.rot.responsetext == "J"){
   values.responseCategory = "blue";
  } else if (trial.rot.responsetext == "K"){
   values.responseCategory = "yellow";
  };  
  list.responses.appenditem(trial.rot.correct);
  list.responses_congruent.appenditem(trial.rot.correct);
  if (trial.rot.correct) {
   list.latencies.appenditem(trial.rot.latency);
   list.latencies_congruent.appenditem(trial.rot.latency);
  }
]
</trial>

I hope you understand this issue. If additional information is required feel free to ask!

Thank you very much!

Best Regards,
Danny

You can set both the color as well as the correct response key from paired <list> elements.

Short example:

<text stimulus>
/ items = ("The Stimulus Text")
</text>

<list displaycolor>
/ items = (red, green, blue, yellow)
</list>

<list correctkey>
/ items = ("D", "F", "J", "K")
/ selectionmode = list.displaycolor.currentindex
</list>

<values>
/ correctkey = " "
</values>

<block exampleblock>
/ trials = [1-4 = example]
</block>

<trial example>
/ ontrialbegin = [
    text.stimulus.textcolor = list.displaycolor.nextvalue;
    values.correctkey = list.correctkey.nextvalue;
]
/ stimulusframes = [1=stimulus]
/ validresponse = ("D", "F", "J", "K")
/ correctresponse = (values.correctkey)
/ errormessage = true(errortext, 500)
/ correctmessage = true(correcttext, 500)
</trial>

<text errortext>
/ items = ("X")
/ txcolor = red
/ position = (50%, 75%)
</text>

<text correcttext>
/ items = ("O")
/ txcolor = green
/ position = (50%, 75%)
</text>

DannyPilgrim
DannyPilgrim
Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)Respected Member (479 reputation)
Group: Forum Members
Posts: 37, Visits: 146
Dave - 4/29/2021
Dave - 4/29/2021
DannyPilgrim - 4/29/2021
Hello everyone,

right now I am programming a Stroop-Task with different words and I would like to know whether it is possible to assign the colors (red, green, blue, yellow) in a randomized order for each participant.

Normally it would look like that:
<text rot>
/ items = ("rot")
/ color = red
</text rot>

<trial rot>
/ stimulustimes = [1=rot, redreminder, greenreminder, bluereminder, yellowreminder]
/ correctresponse = ("d")
/ validresponse = ("d" "f" "j" "k")
/ontrialend = [
    if (trial.rot.responsetext == "D"){
        values.responseCategory = "red";
    } else if (trial.rot.responsetext == "F"){
        values.responseCategory = "green";
    } else if (trial.rot.responsetext == "J"){
        values.responseCategory = "blue";
    } else if (trial.rot.responsetext == "K"){
        values.responseCategory = "yellow";
    };        
    list.responses.appenditem(trial.rot.correct);
    list.responses_congruent.appenditem(trial.rot.correct);
    if (trial.rot.correct) {
        list.latencies.appenditem(trial.rot.latency);
        list.latencies_congruent.appenditem(trial.rot.latency);
    }
]
</trial>

I would like to do it this way:
<text rot>
/ items = ("rot")
/ color = red, green, blue, yellow
</text rot>

<trial rot>
/ stimulustimes = [1=rot, redreminder, greenreminder, bluereminder, yellowreminder]
/ correctresponse = ("d") (Now I have the problem that I cannot specifiy the correct answer for this trial because of the randomization. What do I have to define for the result files to see which answer would have been the correct one if the participant pushed a button?)
/ validresponse = ("d" "f" "j" "k")
/ontrialend = [
  if (trial.rot.responsetext == "D"){
   values.responseCategory = "red";
  } else if (trial.rot.responsetext == "F"){
   values.responseCategory = "green";
  } else if (trial.rot.responsetext == "J"){
   values.responseCategory = "blue";
  } else if (trial.rot.responsetext == "K"){
   values.responseCategory = "yellow";
  };  
  list.responses.appenditem(trial.rot.correct);
  list.responses_congruent.appenditem(trial.rot.correct);
  if (trial.rot.correct) {
   list.latencies.appenditem(trial.rot.latency);
   list.latencies_congruent.appenditem(trial.rot.latency);
  }
]
</trial>

I hope you understand this issue. If additional information is required feel free to ask!

Thank you very much!

Best Regards,
Danny

You can set both the color as well as the correct response key from paired <list> elements.

Short example:

<text stimulus>
/ items = ("The Stimulus Text")
</text>

<list displaycolor>
/ items = (red, green, blue, yellow)
</list>

<list correctkey>
/ items = ("D", "F", "J", "K")
/ selectionmode = list.displaycolor.currentindex
</list>

<values>
/ correctkey = " "
</values>

<block exampleblock>
/ trials = [1-4 = example]
</block>

<trial example>
/ ontrialbegin = [
    text.stimulus.textcolor = list.displaycolor.nextvalue;
    values.correctkey = list.correctkey.nextvalue;
]
/ stimulusframes = [1=stimulus]
/ validresponse = ("D", "F", "J", "K")
/ correctresponse = (values.correctkey)
/ errormessage = true(errortext, 500)
/ correctmessage = true(correcttext, 500)
</trial>

<text errortext>
/ items = ("X")
/ txcolor = red
/ position = (50%, 75%)
</text>

<text correcttext>
/ items = ("O")
/ txcolor = green
/ position = (50%, 75%)
</text>

That helped alot again!
Thank you very much, 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