Types of response


Author
Message
EnriqueAguilar
EnriqueAguilar
Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)
Group: Forum Members
Posts: 8, Visits: 86
Hi! I’m new using Inquisit and I was wondering if this procedure is possible and if so, how can I do it. I’ll use Inquisit 6 and planning to run the experiment on phone via Inquisit 6 App.
I'm doing a task which requires different types of response.

So, the general idea is that the trial will display 4 images (one at the center, which is not clickable, and 3 around it). When the person clicks on the right answer, it will be followed by a trial that shows a picture of a square and the person must do 1 out of 3 possible response patterns over the image:
A) Two response are required. The first click starts a timer, and a second click at least 3 seconds later.
B) Ten consecutive responses are required, each less than 3 seconds from the previous response.
C) One click that has to be hold for at least 4 seconds

So for example, trial 1a requires the person to click over picture.1B, then it is followed by trial 1b and the person has to do the response A (from the earlier example). If the participant does any other kind of response, it results in /errormesage.

<trial 1a>
/ stimulusframes = [ 1 = picture.1A, picture.1B, picture.2A, picture.3A] / validresponse = (picture.1B, picture.2A, picture.3A)
/ correctresponse = ( picture.1B) / correctmessage = true(Correct, 500) / errormessage = true(Incorrect,400)
</trial>

<trial 1b>
/ stimulusframes = [ 1 = picture.square)
/ correctresponse = ( ) / correctmessage = true(Correct, 500) / errormessage = true(Incorrect,400)
</trial>

I have already checked this, but I don’t quite understand how could I do this or at least something similar:

https://www.millisecond.com/forums/Topic25922.aspx
https://www.millisecond.com/support/docs/v6/html/language/attributes/response.htm
https://www.millisecond.com/support/docs/v6/html/language/elements/response.htm
https://www.millisecond.com/support/docs/v6/html/language/elements/openended.htm
https://www.millisecond.com/support/docs/v6/html/language/attributes/isvalidresponse.htm


I would really appreciate any kind of help, thanks in advance.

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
EnriqueAguilar - 5/7/2021
Hi! I’m new using Inquisit and I was wondering if this procedure is possible and if so, how can I do it. I’ll use Inquisit 6 and planning to run the experiment on phone via Inquisit 6 App.
I'm doing a task which requires different types of response.

So, the general idea is that the trial will display 4 images (one at the center, which is not clickable, and 3 around it). When the person clicks on the right answer, it will be followed by a trial that shows a picture of a square and the person must do 1 out of 3 possible response patterns over the image:
A) Two response are required. The first click starts a timer, and a second click at least 3 seconds later.
B) Ten consecutive responses are required, each less than 3 seconds from the previous response.
C) One click that has to be hold for at least 4 seconds

So for example, trial 1a requires the person to click over picture.1B, then it is followed by trial 1b and the person has to do the response A (from the earlier example). If the participant does any other kind of response, it results in /errormesage.

<trial 1a>
/ stimulusframes = [ 1 = picture.1A, picture.1B, picture.2A, picture.3A] / validresponse = (picture.1B, picture.2A, picture.3A)
/ correctresponse = ( picture.1B) / correctmessage = true(Correct, 500) / errormessage = true(Incorrect,400)
</trial>

<trial 1b>
/ stimulusframes = [ 1 = picture.square)
/ correctresponse = ( ) / correctmessage = true(Correct, 500) / errormessage = true(Incorrect,400)
</trial>

I have already checked this, but I don’t quite understand how could I do this or at least something similar:

https://www.millisecond.com/forums/Topic25922.aspx
https://www.millisecond.com/support/docs/v6/html/language/attributes/response.htm
https://www.millisecond.com/support/docs/v6/html/language/elements/response.htm
https://www.millisecond.com/support/docs/v6/html/language/elements/openended.htm
https://www.millisecond.com/support/docs/v6/html/language/attributes/isvalidresponse.htm


I would really appreciate any kind of help, thanks in advance.

This is both too vague and too open-ended a question to even begin to answer.

It is too vague in that it's entirely unclear what determines the "correct" response pattern. It is too broad in that it's not possible to give you a usable response if you have not yet taken the time to familiarize yourself with and learn some of the advanced features you will need for this (/branch, using values, conditional logic, etc.).

Narrow it down, please, and then perhaps I can give you some pointers.

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 - 5/7/2021
EnriqueAguilar - 5/7/2021
Hi! I’m new using Inquisit and I was wondering if this procedure is possible and if so, how can I do it. I’ll use Inquisit 6 and planning to run the experiment on phone via Inquisit 6 App.
I'm doing a task which requires different types of response.

So, the general idea is that the trial will display 4 images (one at the center, which is not clickable, and 3 around it). When the person clicks on the right answer, it will be followed by a trial that shows a picture of a square and the person must do 1 out of 3 possible response patterns over the image:
A) Two response are required. The first click starts a timer, and a second click at least 3 seconds later.
B) Ten consecutive responses are required, each less than 3 seconds from the previous response.
C) One click that has to be hold for at least 4 seconds

So for example, trial 1a requires the person to click over picture.1B, then it is followed by trial 1b and the person has to do the response A (from the earlier example). If the participant does any other kind of response, it results in /errormesage.

<trial 1a>
/ stimulusframes = [ 1 = picture.1A, picture.1B, picture.2A, picture.3A] / validresponse = (picture.1B, picture.2A, picture.3A)
/ correctresponse = ( picture.1B) / correctmessage = true(Correct, 500) / errormessage = true(Incorrect,400)
</trial>

<trial 1b>
/ stimulusframes = [ 1 = picture.square)
/ correctresponse = ( ) / correctmessage = true(Correct, 500) / errormessage = true(Incorrect,400)
</trial>

I have already checked this, but I don’t quite understand how could I do this or at least something similar:

https://www.millisecond.com/forums/Topic25922.aspx
https://www.millisecond.com/support/docs/v6/html/language/attributes/response.htm
https://www.millisecond.com/support/docs/v6/html/language/elements/response.htm
https://www.millisecond.com/support/docs/v6/html/language/elements/openended.htm
https://www.millisecond.com/support/docs/v6/html/language/attributes/isvalidresponse.htm


I would really appreciate any kind of help, thanks in advance.

This is both too vague and too open-ended a question to even begin to answer.

It is too vague in that it's entirely unclear what determines the "correct" response pattern. It is too broad in that it's not possible to give you a usable response if you have not yet taken the time to familiarize yourself with and learn some of the advanced features you will need for this (/branch, using values, conditional logic, etc.).

Narrow it down, please, and then perhaps I can give you some pointers.

Here's an implementation of pattern A:

<values>
/ time_of_first_click = -1 // records the time of the 1st click on the square
/ time_of_second_click = -1 // records the time of the 2nd click on the square
/ n_clicks = 0 // counts the number of clicks on the square
/ diff = 0 // difference in time between the 1st and 2nd click
</values>

<expressions>
// this expressions checks whether the mouse is located within the red square while clicks occur
/ isoversquare = (mouse.x > shape.redsquare.left && mouse.x < shape.redsquare.right && mouse.y > shape.redsquare.top && mouse.y < shape.redsquare.bottom)
</expressions>

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

<trial patternA>
/ ontrialbegin = [
    // resetting the relevant variables
    values.time_of_first_click = -1;
    values.time_of_second_click = -1;
    values.n_clicks = 0;
    values.diff = 0;
]
/ stimulusframes = [1=clearscreen, redsquare, debug]
/ inputdevice = mouse
/ validresponse = (lbuttondown)
/ isvalidresponse = [
    // first click on the square
    if(trial.patternA.response == "lbuttondown" && expressions.isoversquare && values.n_clicks == 0) {
        // record time of 1st click
        values.time_of_first_click = trial.patternA.latency;
        // increase click count by one
        values.n_clicks += 1;
        // do not terminate the trial
        return false;
    }
    // second click on the square
    else if (trial.patternA.response == "lbuttondown" && expressions.isoversquare && values.n_clicks == 1){
        // record time of 2nd click
        values.time_of_second_click = trial.patternA.latency;
        // calculate time elapsed between 1st and 2nd click
        values.diff = values.time_of_second_click - values.time_of_first_click;
        // increase click count by one
        values.n_clicks += 1;
        // now we can terminate the trial
        return true;
    };
]
/ iscorrectresponse = [
    // response is regarded as correct if time elapsed between the two clicks is 3 seconds or greater
    (values.n_clicks == 2 && values.diff >= 3000);
]
/ errormessage = true(text.errormsg, 500)
/ correctmessage = true(text.correctmsg, 500)
</trial>

<shape redsquare>
/ shape = rectangle
/ color = red
/ size = (400px,400px)
/ position = (50%, 50%)
</shape>

<text errormsg>
/ items = ("ERROR")
/ txcolor = red
/ position = (50%, 90%)
</text>

<text correctmsg>
/ items = ("CORRECT")
/ txcolor = green
/ position = (50%, 90%)
</text>

<text debug>
/ items = ("<%script.currenttrial%>")
/ position = (50%, 10%)
</text>

<data>
/ columns = (date time subject group session trialnum trialcode response latency correct values.n_clicks values.time_of_first_click values.time_of_second_click values.diff)
/ separatefiles = true
</data>


Work through this until you fully understand what it does and how it functions; look up any of the properties, attributes or element you're not yet familiar with in the documentation's language reference. If you can't figure out what a specific piece of code in the above does, ask about it here.

Once you've groked the code for pattern A, analogous code for pattern C should be very straightforward to derive from that, so that's what I'd suggest you tackle first.

EnriqueAguilar
EnriqueAguilar
Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)
Group: Forum Members
Posts: 8, Visits: 86
Great!! I really appreciate your time and attention, I will be working on this.
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
EnriqueAguilar - 5/7/2021
Great!! I really appreciate your time and attention, I will be working on this.

Here's something you can try out on your phone:
https://mili2nd.co/kxzb

I'm not posting the code for now, but will do if you get stuck or need something to compare your own solution(s) against.
EnriqueAguilar
EnriqueAguilar
Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)
Group: Forum Members
Posts: 8, Visits: 86
Wow! Thanks for the motivation, this is actually quite educational haha

I've been trying to get pattern B and it kind of works, but it doesn't shows /error when you don't click on the time specified, it only shows correct when I do it.
Also, I'm not sure about this part:

// tenth click on the square
  else if (trial.patternB.response == "lbuttondown" && expressions.isoversquare && values.n_clicks == 9){
  
   values.time_of_tenth_click = trial.patternB.latency;
  
   values.diff = values.time_of_tenth_click - values.time_of_ninth_click;
   values.n_clicks += 1;
   return true;
  };

Am I supposed to have values.diff like this?
values.diff = values.time_of_tenth_click - values.time_of_ninth_click;
Or should I write all the values like: 
values.diff =  values.time_of_tenth_click - values.time_of_ninth_click - values.time_of_eighth_click - values.time_of_seventh_click - values.time_of_sixth_click - values.time_of_fifth_click - values.time_of_fourth_click - values.time_of_third_click - values.time_of_second_click - values.time_of_first_click;

On the other hand, I don't really get how to get pattern C, I assume that I have to declare only one response but not sure how to accomplish the hold function.

Again, thank you so much for all the support.




Attachments
RspD3.iqx (132 views, 6.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
EnriqueAguilar - 5/7/2021
Wow! Thanks for the motivation, this is actually quite educational haha

I've been trying to get pattern B and it kind of works, but it doesn't shows /error when you don't click on the time specified, it only shows correct when I do it.
Also, I'm not sure about this part:

// tenth click on the square
  else if (trial.patternB.response == "lbuttondown" && expressions.isoversquare && values.n_clicks == 9){
  
   values.time_of_tenth_click = trial.patternB.latency;
  
   values.diff = values.time_of_tenth_click - values.time_of_ninth_click;
   values.n_clicks += 1;
   return true;
  };

Am I supposed to have values.diff like this?
values.diff = values.time_of_tenth_click - values.time_of_ninth_click;
Or should I write all the values like: 
values.diff =  values.time_of_tenth_click - values.time_of_ninth_click - values.time_of_eighth_click - values.time_of_seventh_click - values.time_of_sixth_click - values.time_of_fifth_click - values.time_of_fourth_click - values.time_of_third_click - values.time_of_second_click - values.time_of_first_click;

On the other hand, I don't really get how to get pattern C, I assume that I have to declare only one response but not sure how to accomplish the hold function.

Again, thank you so much for all the support.




Pattern C is essentially identical to pattern A; the only difference is that the second event is not lbuttondown, but lbuttonup.

<trial patternC>
/ ontrialbegin = [
    // resetting the relevant variables
    values.time_of_button_down = -1;
    values.time_of_button_up = -1;
    values.n_clicks = 0;
    values.diff = 0;
]
/ stimulusframes = [1=clearscreen, redsquare, debug]
/ inputdevice = mouse
/ validresponse = (lbuttonup, lbuttondown)
/ isvalidresponse = [
    // button down on the square
    if(trial.patternC.response == "lbuttondown" && expressions.isoversquare && values.n_clicks == 0) {
        // record time of button down event
        values.time_of_button_down = trial.patternC.latency;
        // increase click count by one
        values.n_clicks += 1;
        // do not terminate the trial
        return false;
    }
    // button up event
    else if (trial.patternC.response == "lbuttonup" && values.n_clicks == 1){
        // record time of button up event
        values.time_of_button_up = trial.patternC.latency;
        // calculate time elapsed between button down and up events
        values.diff = values.time_of_button_up - values.time_of_button_down;
        // increase click count by one
        values.n_clicks += 1;
        // now we can terminate the trial
        return true;
    };
]
/ iscorrectresponse = [
    // response is regarded as correct if time elapsed between the button down and up events is 4 seconds or greater,
    // i.e. if the click was held for 4 seconds or longer
    (values.n_clicks == 2 && values.diff >= 4000);
]
/ errormessage = true(text.errormsg, 500)
/ correctmessage = true(text.correctmsg, 500)
</trial>


Pattern B is different and lends itself to making use of lists:

<list clicktimes>
</list>

<list diffs>
</list>

<trial patternB>
/ ontrialbegin = [
    // resetting the relevant variables
    values.n_clicks = 0;
    values.diff = 0;
    list.clicktimes.reset();
    list.diffs.reset();
]
/ stimulusframes = [1=clearscreen, redsquare, debug]
/ inputdevice = mouse
/ validresponse = (lbuttondown)
/ isvalidresponse = [
    // collect click within square
    if(trial.patternB.response == "lbuttondown" && expressions.isoversquare){
        // add time of current click to list
        list.clicktimes.appenditem(trial.patternB.latency);
        // increase click count by one
        values.n_clicks += 1;
        // as soon as we have at least two clicks
        if (values.n_clicks > 1) {
            // calculate time elapsed between current click and previous click
            values.diff = list.clicktimes.item(values.n_clicks) - list.clicktimes.item(values.n_clicks-1);
            // add calculated difference to a list
            list.diffs.appenditem(values.diff);
        };
        // if time elapsed between last two clicks is under 3 seconds and we have not yet collected 10 clicks
        if (values.diff < 3000 && values.n_clicks < 10) {
            // we do not terminate the trial and keep collecting clicks
            return false;
        } else {
            // otherwise we terminate the trial
            return true;
        }
    };
]
/ iscorrectresponse = [
    // trial is regarded as correct if we get to 10 clicks and have not observed a difference of 3 seconds or more between consecutive clicks
    (values.n_clicks >= 10 && list.diffs.maximum < 3000);
]
/ errormessage = true(text.errormsg, 500)
/ correctmessage = true(text.correctmsg, 500)
</trial>


Attachments
three_patterns.iqx (129 views, 8.00 KB)
EnriqueAguilar
EnriqueAguilar
Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)Associate Member (97 reputation)
Group: Forum Members
Posts: 8, Visits: 86
Great!  Thank you a lot 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