Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Storing and displaying trial responses in real time

Hello everyone,

I am new to OpenSesame and I am currently trying to design an online experiment on risky choices. During the process I ran into the following 2 issues:

1. The image below represents how the display of our experiment should look like. The squares on the screen represent the different trials. There are 40 squares in total, and therefore 40 trials. The yellow square essentially acts as a tracker that indicates in which trial the participant currently is. In addition, in each trial the participant can either choose option (a) or option (b). The trials where the participant has chosen option (a) should be “stored” with a blue color and the trials where the participant has chosen option (b) should be marked with the color red. In other words, we want the experiment to exhibit “memory” by storing the participants’ responses in terms of color. The experiment should keep track of the choices of a participant so that if, for instance, a participant is in trial 13 they can see how they responded in trials 1 to 12 by means of the assigned colors.



I have managed to partially create this display on OpenSesame (condition B of the file attached to this post). When I choose option (a) the color of the corresponding trial turns blue and when I choose option (b) the square turns red. Nevertheless, the history of responses and their corresponding colors are not “stored” as they do not remain on the screen. Currently the only response visible to the participant is that of the last trial, as depicted in the image below:



2. In another condition, we would like the experiment to again exhibit “memory” but this time in a different way. If possible, we would like to recreate the display shown below, where the participants can see a square across trials that displays their responses in terms of the proportion of options (a) and options (b). For example, up to the trial shown below, the participant can see that they have selected a higher number of choice (a) responses (shown in blue) compared to the lower number of (b) choices (shown in red).



Any assistance or tips on how to proceed would be greatly appreciated!


Thank you in advance,

Constantinos


Comments

  • Hi Constantinos,

    This sounds like a fun experiment. I adapt your experiment somewhat to make the first part work. Note, I only implemented the first 10 boxes (it is a lot of copy and pasting in the sketchpad skript).

    The second part is a bit more complicated. I haven't yet tried to do it, I might do it later though.

    But most importantly, you have to keep in mind that if this study is supposed online, you cannot use python inline script. For the sakes of demonstration, I still used python, but in a way that would make translation to Javascript rather easy.

    I hope this helps a bit. Let me know if you need more help.


    Good luck,

    Eduard

    Buy Me A Coffee

  • Hello Eduard,

    Your response has been very helpful! The first 10 trials of your file look exactly how we want condition B to look like. The only problem is that this solution does not work for one of our sequences where the choice values are randomized (by setting the order of the loop from “sequential” to “random”). The consequence of this is that the "trial_no" variable does not track the order of the trials anymore, something which messes things up. Do you maybe know how to tackle this?

    I would also appreciate any guidance on how to implement the second part, however you have already been of great help. Thanks a lot for that.


    Kind regards,

    Constantinos

  • Hi Constantinos,

    In this case don't define this variable in the loop table but increment it in each inline_script

    So in the beginning of every block (before the trial sequence), you have to initialize the response (e.g. var.trial_no = 0), and later in the inline_script (before you set the color), increment the variable (var.trial_no += 1). The same you can do in the conditions that currently work.

    Hope this helps,

    Eduard

    Buy Me A Coffee

  • Hello Eduard,

    After following your instructions I was able to progress and create a complete sequence that works perfectly fine. I appreciate the time you have put into this.

    However, when I try to copy the whole setup in order to create two more sequences, a problem arises in the transition between these sequences. What seems to be the problem is that the responses of the first sequence get carried onto the second sequence, whereas the feedback item should reset in every sequence.


    I tried to tweak the code to make it work but my limited programming skills don't seem to help. I also tried copying the first inline script and pasting it the beginning of the second sequence, so that in the new sequence the variables are overwritten/reset. The result was that although the responses of the first sequence were erased from the feedback item of the second sequence, new responses stopped being recorded as blue and red squares. The third sequence seems to work somewhat fine (with the only issue being that it starts on the 2nd trial and it ends on the 42nd trial instead of starting on the 1st and finishing on the 40th).


    Kind regards,

    Constantinos

  • Hi Constantinos,

    Which of the two files should I check?

    Eduard

    Buy Me A Coffee

  • Hello Eduard,

    The first file is the one where only the first sequence works. I think it would be easier to check that one as it is closer to the version that you posted a few days ago.

    Kind regards,

    Constantinos

  • Hi,

    Yes, you have to reset variables in between the blocks. I copied the initial inline_script, but you can also adjust the contents if you want to reset selectively.

    I also added 2 comments to the inline_script within the loop.

    Does this help?

    Eduard

    Buy Me A Coffee

  • oops. forgot to attach a file....


    Buy Me A Coffee

  • Dear Eduard,

    I have tried to reset the variables in between the blocks but that does not seem to solve the problem, as I do not get a new "clean" feedback item in each new sequence. Instead, the responses of the previous sequence are kept on the display. I specifically added the "var.trial_no = 0" command into the inline_script before each new sequence but this does not stop OS from leaving on screen the responses from the previous sequence. Below I include two screenshots that might help illustrate better what I am describing.


    The responses recorded in the first sequence.


    Currently being in the second sequence, and instead of OS recording my responses in this sequence it displays the responses recorded in the first sequence. I therefore do not get feedback on my responses in the trials of the current sequence.


    Kind regards,

    Constantinos

  • Oh yeah, sure. Setting trial_no is not enough. You have to redo all the colors again. So what happened in the very first inline_script if I remember correctly.

    Buy Me A Coffee

  • As it turns out, the experiment was not working properly because in some of the incline_scripts I was inserting the commands in the "prepare" phase instead of the "run" phase. Below I attach the file with the progress that has been made so far (in case someone finds this useful). Thanks again to Eduard for his valuable contribution in completing this stage of the experiment.


  • Hello,

    I am currently working on the final part of this experiment (condition C) where we want to present to the participants their responses on conditions A and B for the corresponding sequences of each single trial. If, for instance, currently a participant is in trial 12 of sequence "ID" of condition C, they shoud be seeing on the display their previous choice from trial 12 of sequence "ID" of condition A and their choice on trial 12 from sequence "ID" of condition B. If in those conditions they opted for choice "a" and "a" respectively, then both halves of the square corresponding to trial 12 should be blue. If alternatively they responded "a" and "b", then the color of the current trial square should turn half blue and half red (as depicted below).


    *Please note that the colored square does not have to be bigger than the rest of the (trial) squares as shown above.


    I was thinking that a potential solution would be to introduce an inline_script in which there is a for loop that overwrites in each trial the variable "response" and saves each trial response as a new variable (e.g., response_trial1, response_trial2, etc.) In this way I can later use the "show if" function to make each blue and red half-square appear depending on the participants' responses in the previous trials. It should be created in a way that the var.response_trialx is equal to var.response so that "x" represents the trial number. Up to now I have not been able to create a loop that creates new variables based on the current trial number. Could someone give me any advice on how to create such a for loop?


    Thanks in advance!

    Constantinos

  • Hi Constantinos,

    Do you still have the problem?

    I was thinking that a potential solution would be to introduce an inline_script in which there is a for loop that overwrites in each trial the variable "response" and saves each trial response as a new variable

    That would work, but I guess it is easier if you have a list for every condition to which you simply append the current respond. That list you can then access later and color the squares based on it.

    For the coloring part, I think it is as easy as doubling the number of colored squares in the sketchpad, and cutting their width in half. Then check the entry of the list of the right condition and the right index (based on trial number), and assign the colors accordingly. The latter procedure shouldnt be much different from the rest of the experiments that I helped you with.

    Hope this helps,

    Eduard

    Buy Me A Coffee

  • Hello Eduard,

    Unfortunately I am still stuck in that part. Could you please further explain how I could implement the first part of your solution? How would I create the list to which I can append the current response?

    Thank you

  • Hi,

    I added some pointers on what I mean.

    • I Initialize a list in the first inline_script in the A sequence to collect the responses there
    • in the first sequence of the A sequence (not the other two a sequences) I append the responses to that list
    • before the C sequence I initialize a trial counter (counting the trials in the C sequence)
    • in the C sequence I retrieve the the response of the ith trial in the A sequence and put it on the sketchpad

    For testing purposes I disabled sequence B, not that you wonder.

    Hope this helps,

    Eduard

    Buy Me A Coffee

  • Dear Eduard,

    I tried to follow your advice and I have made some progress, however there are still some issues:

    1) The colors of the half-squares seem to not always correspond to the right trial responses. For example, in the ID sequence of condition C I can (correctly) see the responses from the corresponding trials of the ID sequence from conditions A and B, however the experiment does not correctly match the responses from the trials of the DI sequence to the right colors.

    2) Is there a way to present only responses relevant to the current trial (in a way that the participants can only see the colored half-squares of the current trial and not of the previous trials)?

    So that it looks like in the image below and not like in the screenshot above:



    Thanks again,

    Constantinos

  • hi Constantinos,

    Sorry for the long delay, this semester is very busy for me...

    2) Is there a way to present only responses relevant to the current trial (in a way that the participants can only see the colored half-squares of the current trial and not of the previous trials)?

    Yes, basically, at the end of every trial you have to change the colors back to white of the relevant blocks. Should be straightforward. What you do to set the colors, should be redone on the previous blocks. Does that make sense?

    Regarding question 1, I am not sure I correctly understand. Do you mind to explain in more detail please? If you have the problem still, that is.

    Hope this helps,

    Eduard

    Buy Me A Coffee

  • Hello Eduard,

    Thank you for getting back to me and sorry for the late reply. Things have been busy with the study.

    At some point after trying some things out with the code I understood how it works and I was thankfully able to solve both issues mentioned in my previous post. I would like to thank you again for all the support because without your help the experiment would not have been completed by now.

    Below I am attaching the final version of the experiment in case someone finds it useful.

    Kind regards,

    Constantinos

  • Hi Costantinos,

    Thanks for sharing and good that it works now! Happy data colletion!

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games