count the number of tentative in trials


Author
Message
Kevin_Bague
Kevin_Bague
Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)
Group: Forum Members
Posts: 15, Visits: 35
Dave - 2/27/2020
Kevin_Bague - 2/27/2020
Dave - 2/27/2020
Kevin_Bague - 2/27/2020
Dave - 2/27/2020
Kevin_Bague - 2/27/2020
Dave - 2/26/2020
Kevin_Bague - 2/26/2020
Hello I have a new question today. 

Is it possible to count the number of tentative in trials ?

In my task participants must stop a sound in pushing on a knob. But I would like record the number of tentative for each trial, that is the number of time that they have push on other knob.

Could I include 8 knobs in valid response and only one in correct response ? But how code bad response as 0 and correct as 1 ? 

Thanks 


You can use /isvalidresponse and/or /scorrectresponse logic to count the valid (but incorrect) response attempts.

<defaults >
/ screencolor = black
</defaults>

*************************************
SOUND

<item sound>
/ 1="3000Hz (5s).wav"
</item>

<sound son>
/ items = item.sound
</sound>

*************************************
FEEDBACK

<item success>
/ 1="Success!"
</item>

<item fail>
/ 1="Fail !"
</item>

<text sucess>
/ items = success
/ txcolor =black
/ txbgcolor =darkgreen
/txcolor = (255,255,255)
/ size = (90%, 90%)
/ fontstyle = ("Times new roman", 50pt, true, false, false, false, 5, 0)
/ position = (50, 50)
</text>

<text fail>
/ items = fail
/ txcolor =black
/ txbgcolor =crimson
/txcolor = (255,255,255)
/ size = (90%, 90%)
/ fontstyle = ("Times new roman", 50pt, true, false, false, false, 5, 0)
/ position = (50, 50)
</text>
*************************************

<trial uncontrolable >
/ beginresponseframe = -1
/ beginresponsetime = -1
/ correctmessage = true(text.success, 5000)
/ errormessage = true(text.fail, 5000)
/ stimulusframes = [1=sound]
/ timeout = 5000
/ posttrialpause = 10000
/ responseinterrupt = trial
/ isvalidresponse = ["1";"2"
]
/ ontrialend = [if (trial.uncontrolable.timeout > timeout)
 
]
</trial>

It's not stopped if you actually use /isvalidresponse properly.

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

<trial example>
/ posttrialpause = 1000
/ ontrialbegin = [
    values.count_tentative = 0;
]
/ stimulusframes = [1=examplestim]
/ validresponse = (2, 3)
/ isvalidresponse = [
    if(trial.example.response == 2) {
        values.count_tentative += 1;
        false;
    } else if (trial.example.response == 3)
    {
        true;
    }
]
/ correctresponse = (3)
/ iscorrectresponse = [
    trial.example.response == 3 && values.count_tentative == 0;
]
</trial>

<text examplestim>
/ items = ("Press 1 or 2. 2 is the correct response")
</text>

<values>
/ count_tentative = 0
</values>

<data>
/ columns = (date time subject group trialnum trialcode response latency correct values.count_tentative)
/ separatefiles = true
</data>


I tried it... but it seeme don't work.... 

What did you try and what doesn't seem to work?

The count of tentative and correct response don't work... I have tried with your script and with my script in which I adapted your script :


<defaults >
/ screencolor = black
</defaults>

*************************************
SON

<item son >
/ 1="3000Hz (5s).wav"
</item>

<sound son>
/ items = item.son
</sound>

*************************************
FEEDBACK

<item réussi>
/ 1="Réussi !"
</item>

<item échec>
/ 1="Échec !"
</item>

<text réussi>
/ items = réussi
/ txcolor =black
/ txbgcolor =darkgreen
/txcolor = (255,255,255)
/ size = (90%, 90%)
/ fontstyle = ("Times new roman", 50pt, true, false, false, false, 5, 0)
/ position = (50, 50)
</text>

<text échec>
/ items = échec
/ txcolor =black
/ txbgcolor =crimson
/txcolor = (255,255,255)
/ size = (90%, 90%)
/ fontstyle = ("Times new roman", 50pt, true, false, false, false, 5, 0)
/ position = (50, 50)
</text>
*************************************

<trial uncontrolable >
/ beginresponseframe = -1
/ beginresponsetime = -1
/ correctmessage = true(text.réussi, 5000)
/ errormessage = true(text.échec, 5000)
/ stimulusframes = [1=son]
/ timeout = 5000
/ posttrialpause = 10000
/ validresponse = ("1")
/ isvalidresponse = [
  if(trial.uncontrolable.response =="1") {
   values.count_tentative += 1;
   false}]
        
/ ontrialend = [if (trial.uncontrolable.timeout)
    
]
</trial>
**********************************

<trial controlable >
/ beginresponseframe = -1
/ beginresponsetime = -1
/ correctmessage = true(text.réussi, 5000)
/ errormessage = true(text.échec, 5000)
/ stimulusframes = [1=son]
/ timeout = 5000
/ posttrialpause = 10000
/ validresponse = ("1")
/ isvalidresponse = [
  if(trial.controlable.response =="2") {
   values.count_tentative += 1;
   false;
  } else if (trial.controlable.response == "1")
  {
   true;
  }
]
/ correctresponse = ("1")
/ iscorrectresponse = [
  trial.controlable.response == "1"
]
/ ontrialend = [if (trial.controlable.timeout)
    
]
</trial>





******************

<values>
/ count_tentative = "0"
</values>

<data>
/ columns = (date time subject group trialnum trialcode response latency correct values.count_tentative)
/ separatefiles = true
</data>
<block >
/ trials = [1-3=trial.uncontrolable]
</block>








You really need to be clearer, please.

(1) "The count of tentative and correct response don't work... I have tried with your script "

Does it work or not work with the script I gave you? I have tested it and it does work for me, 100%.



(2) "... and with my script in which I adapted your script."

I'm sorry, but you did not adapt your script according to the example code I gave you.

OK i have copy and paste and it works sorry. But could you explain me what is the role of 3 into the script ? Because correct response is 3 in script but is 2 when I run the script...

I'm going to try to adapt it to myscript
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
Kevin_Bague - 2/27/2020
Dave - 2/27/2020
Kevin_Bague - 2/27/2020
Dave - 2/27/2020
Kevin_Bague - 2/27/2020
Dave - 2/27/2020
Kevin_Bague - 2/27/2020
Dave - 2/26/2020
Kevin_Bague - 2/26/2020
Hello I have a new question today. 

Is it possible to count the number of tentative in trials ?

In my task participants must stop a sound in pushing on a knob. But I would like record the number of tentative for each trial, that is the number of time that they have push on other knob.

Could I include 8 knobs in valid response and only one in correct response ? But how code bad response as 0 and correct as 1 ? 

Thanks 


You can use /isvalidresponse and/or /scorrectresponse logic to count the valid (but incorrect) response attempts.

<defaults >
/ screencolor = black
</defaults>

*************************************
SOUND

<item sound>
/ 1="3000Hz (5s).wav"
</item>

<sound son>
/ items = item.sound
</sound>

*************************************
FEEDBACK

<item success>
/ 1="Success!"
</item>

<item fail>
/ 1="Fail !"
</item>

<text sucess>
/ items = success
/ txcolor =black
/ txbgcolor =darkgreen
/txcolor = (255,255,255)
/ size = (90%, 90%)
/ fontstyle = ("Times new roman", 50pt, true, false, false, false, 5, 0)
/ position = (50, 50)
</text>

<text fail>
/ items = fail
/ txcolor =black
/ txbgcolor =crimson
/txcolor = (255,255,255)
/ size = (90%, 90%)
/ fontstyle = ("Times new roman", 50pt, true, false, false, false, 5, 0)
/ position = (50, 50)
</text>
*************************************

<trial uncontrolable >
/ beginresponseframe = -1
/ beginresponsetime = -1
/ correctmessage = true(text.success, 5000)
/ errormessage = true(text.fail, 5000)
/ stimulusframes = [1=sound]
/ timeout = 5000
/ posttrialpause = 10000
/ responseinterrupt = trial
/ isvalidresponse = ["1";"2"
]
/ ontrialend = [if (trial.uncontrolable.timeout > timeout)
 
]
</trial>

It's not stopped if you actually use /isvalidresponse properly.

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

<trial example>
/ posttrialpause = 1000
/ ontrialbegin = [
    values.count_tentative = 0;
]
/ stimulusframes = [1=examplestim]
/ validresponse = (2, 3)
/ isvalidresponse = [
    if(trial.example.response == 2) {
        values.count_tentative += 1;
        false;
    } else if (trial.example.response == 3)
    {
        true;
    }
]
/ correctresponse = (3)
/ iscorrectresponse = [
    trial.example.response == 3 && values.count_tentative == 0;
]
</trial>

<text examplestim>
/ items = ("Press 1 or 2. 2 is the correct response")
</text>

<values>
/ count_tentative = 0
</values>

<data>
/ columns = (date time subject group trialnum trialcode response latency correct values.count_tentative)
/ separatefiles = true
</data>


I tried it... but it seeme don't work.... 

What did you try and what doesn't seem to work?

The count of tentative and correct response don't work... I have tried with your script and with my script in which I adapted your script :


<defaults >
/ screencolor = black
</defaults>

*************************************
SON

<item son >
/ 1="3000Hz (5s).wav"
</item>

<sound son>
/ items = item.son
</sound>

*************************************
FEEDBACK

<item réussi>
/ 1="Réussi !"
</item>

<item échec>
/ 1="Échec !"
</item>

<text réussi>
/ items = réussi
/ txcolor =black
/ txbgcolor =darkgreen
/txcolor = (255,255,255)
/ size = (90%, 90%)
/ fontstyle = ("Times new roman", 50pt, true, false, false, false, 5, 0)
/ position = (50, 50)
</text>

<text échec>
/ items = échec
/ txcolor =black
/ txbgcolor =crimson
/txcolor = (255,255,255)
/ size = (90%, 90%)
/ fontstyle = ("Times new roman", 50pt, true, false, false, false, 5, 0)
/ position = (50, 50)
</text>
*************************************

<trial uncontrolable >
/ beginresponseframe = -1
/ beginresponsetime = -1
/ correctmessage = true(text.réussi, 5000)
/ errormessage = true(text.échec, 5000)
/ stimulusframes = [1=son]
/ timeout = 5000
/ posttrialpause = 10000
/ validresponse = ("1")
/ isvalidresponse = [
  if(trial.uncontrolable.response =="1") {
   values.count_tentative += 1;
   false}]
        
/ ontrialend = [if (trial.uncontrolable.timeout)
    
]
</trial>
**********************************

<trial controlable >
/ beginresponseframe = -1
/ beginresponsetime = -1
/ correctmessage = true(text.réussi, 5000)
/ errormessage = true(text.échec, 5000)
/ stimulusframes = [1=son]
/ timeout = 5000
/ posttrialpause = 10000
/ validresponse = ("1")
/ isvalidresponse = [
  if(trial.controlable.response =="2") {
   values.count_tentative += 1;
   false;
  } else if (trial.controlable.response == "1")
  {
   true;
  }
]
/ correctresponse = ("1")
/ iscorrectresponse = [
  trial.controlable.response == "1"
]
/ ontrialend = [if (trial.controlable.timeout)
    
]
</trial>





******************

<values>
/ count_tentative = "0"
</values>

<data>
/ columns = (date time subject group trialnum trialcode response latency correct values.count_tentative)
/ separatefiles = true
</data>
<block >
/ trials = [1-3=trial.uncontrolable]
</block>








You really need to be clearer, please.

(1) "The count of tentative and correct response don't work... I have tried with your script "

Does it work or not work with the script I gave you? I have tested it and it does work for me, 100%.



(2) "... and with my script in which I adapted your script."

I'm sorry, but you did not adapt your script according to the example code I gave you.

OK i have copy and paste and it works sorry. But could you explain me what is the role of 3 into the script ? Because correct response is 3 in script but is 2 when I run the script...

I'm going to try to adapt it to myscript

2 is the keyboard scancode for the "1" key at the top of your keyboard. 3 is the keyboard scancode for the "2" key at the top of your keyboard. Numerical keyboard scancodes are what a <trial> elements response property (trial.example.response) returns when the input device is the keyboard. See https://www.millisecond.com/support/docs/v5/html/language/scancodes.htm in the documentation and Tools -> Keyboard Scancodes...:





Kevin_Bague
Kevin_Bague
Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)
Group: Forum Members
Posts: 15, Visits: 35
Dave - 2/27/2020
Kevin_Bague - 2/27/2020
Dave - 2/27/2020
Kevin_Bague - 2/27/2020
Dave - 2/27/2020
Kevin_Bague - 2/27/2020
Dave - 2/26/2020
Kevin_Bague - 2/26/2020
Hello I have a new question today. 

Is it possible to count the number of tentative in trials ?

In my task participants must stop a sound in pushing on a knob. But I would like record the number of tentative for each trial, that is the number of time that they have push on other knob.

Could I include 8 knobs in valid response and only one in correct response ? But how code bad response as 0 and correct as 1 ? 

Thanks 


You can use /isvalidresponse and/or /scorrectresponse logic to count the valid (but incorrect) response attempts.

<defaults >
/ screencolor = black
</defaults>

*************************************
SOUND

<item sound>
/ 1="3000Hz (5s).wav"
</item>

<sound son>
/ items = item.sound
</sound>

*************************************
FEEDBACK

<item success>
/ 1="Success!"
</item>

<item fail>
/ 1="Fail !"
</item>

<text sucess>
/ items = success
/ txcolor =black
/ txbgcolor =darkgreen
/txcolor = (255,255,255)
/ size = (90%, 90%)
/ fontstyle = ("Times new roman", 50pt, true, false, false, false, 5, 0)
/ position = (50, 50)
</text>

<text fail>
/ items = fail
/ txcolor =black
/ txbgcolor =crimson
/txcolor = (255,255,255)
/ size = (90%, 90%)
/ fontstyle = ("Times new roman", 50pt, true, false, false, false, 5, 0)
/ position = (50, 50)
</text>
*************************************

<trial uncontrolable >
/ beginresponseframe = -1
/ beginresponsetime = -1
/ correctmessage = true(text.success, 5000)
/ errormessage = true(text.fail, 5000)
/ stimulusframes = [1=sound]
/ timeout = 5000
/ posttrialpause = 10000
/ responseinterrupt = trial
/ isvalidresponse = ["1";"2"
]
/ ontrialend = [if (trial.uncontrolable.timeout > timeout)
 
]
</trial>

It's not stopped if you actually use /isvalidresponse properly.

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

<trial example>
/ posttrialpause = 1000
/ ontrialbegin = [
    values.count_tentative = 0;
]
/ stimulusframes = [1=examplestim]
/ validresponse = (2, 3)
/ isvalidresponse = [
    if(trial.example.response == 2) {
        values.count_tentative += 1;
        false;
    } else if (trial.example.response == 3)
    {
        true;
    }
]
/ correctresponse = (3)
/ iscorrectresponse = [
    trial.example.response == 3 && values.count_tentative == 0;
]
</trial>

<text examplestim>
/ items = ("Press 1 or 2. 2 is the correct response")
</text>

<values>
/ count_tentative = 0
</values>

<data>
/ columns = (date time subject group trialnum trialcode response latency correct values.count_tentative)
/ separatefiles = true
</data>


I tried it... but it seeme don't work.... 

What did you try and what doesn't seem to work?

The count of tentative and correct response don't work... I have tried with your script and with my script in which I adapted your script :


<defaults >
/ screencolor = black
</defaults>

*************************************
SON

<item son >
/ 1="3000Hz (5s).wav"
</item>

<sound son>
/ items = item.son
</sound>

*************************************
FEEDBACK

<item réussi>
/ 1="Réussi !"
</item>

<item échec>
/ 1="Échec !"
</item>

<text réussi>
/ items = réussi
/ txcolor =black
/ txbgcolor =darkgreen
/txcolor = (255,255,255)
/ size = (90%, 90%)
/ fontstyle = ("Times new roman", 50pt, true, false, false, false, 5, 0)
/ position = (50, 50)
</text>

<text échec>
/ items = échec
/ txcolor =black
/ txbgcolor =crimson
/txcolor = (255,255,255)
/ size = (90%, 90%)
/ fontstyle = ("Times new roman", 50pt, true, false, false, false, 5, 0)
/ position = (50, 50)
</text>
*************************************

<trial uncontrolable >
/ beginresponseframe = -1
/ beginresponsetime = -1
/ correctmessage = true(text.réussi, 5000)
/ errormessage = true(text.échec, 5000)
/ stimulusframes = [1=son]
/ timeout = 5000
/ posttrialpause = 10000
/ validresponse = ("1")
/ isvalidresponse = [
  if(trial.uncontrolable.response =="1") {
   values.count_tentative += 1;
   false}]
        
/ ontrialend = [if (trial.uncontrolable.timeout)
    
]
</trial>
**********************************

<trial controlable >
/ beginresponseframe = -1
/ beginresponsetime = -1
/ correctmessage = true(text.réussi, 5000)
/ errormessage = true(text.échec, 5000)
/ stimulusframes = [1=son]
/ timeout = 5000
/ posttrialpause = 10000
/ validresponse = ("1")
/ isvalidresponse = [
  if(trial.controlable.response =="2") {
   values.count_tentative += 1;
   false;
  } else if (trial.controlable.response == "1")
  {
   true;
  }
]
/ correctresponse = ("1")
/ iscorrectresponse = [
  trial.controlable.response == "1"
]
/ ontrialend = [if (trial.controlable.timeout)
    
]
</trial>





******************

<values>
/ count_tentative = "0"
</values>

<data>
/ columns = (date time subject group trialnum trialcode response latency correct values.count_tentative)
/ separatefiles = true
</data>
<block >
/ trials = [1-3=trial.uncontrolable]
</block>








You really need to be clearer, please.

(1) "The count of tentative and correct response don't work... I have tried with your script "

Does it work or not work with the script I gave you? I have tested it and it does work for me, 100%.



(2) "... and with my script in which I adapted your script."

I'm sorry, but you did not adapt your script according to the example code I gave you.

Okay thank you very much !  Sorry I'm a novice in Inquisit

It's good, your script works with my script. I have just a last question, how can I add valide response ? For exemple if I want to count the tentative for other numbers ? Is it enough that I add them with commas?
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
Kevin_Bague - 2/27/2020

Okay thank you very much !  Sorry I'm a novice in Inquisit

It's good, your script works with my script. I have just a last question, how can I add valide response ? For exemple if I want to count the tentative for other numbers ? Is it enough that I add them with commas?

No, not quite. The most efficient way would be something like this (here, the valid responses are "1" to "8" -- that is, scancodes 2 to 9):

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

<trial example>
/ posttrialpause = 1000
/ ontrialbegin = [
    values.count_tentative = 0;
]
/ stimulusframes = [1=examplestim]
/ validresponse = (2, 3, 4, 5, 6, 7, 8, 9)
/ isvalidresponse = [
    if(trial.example.response > 1 && trial.example.response < 10 && trial.example.response != 3) {
        values.count_tentative += 1;
        false;
    } else if (trial.example.response == 3)
    {
        true;
    }
]
/ correctresponse = (3)
/ iscorrectresponse = [
    trial.example.response == 3 && values.count_tentative == 0;
]
</trial>

<text examplestim>
/ items = ("Press any key between 1 or 8. 2 is the correct response")
</text>

<values>
/ count_tentative = 0
</values>

<data>
/ columns = (date time subject group trialnum trialcode response latency correct values.count_tentative)
/ separatefiles = true
</data>



Edited 4 Years Ago by 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