Howdy, Stranger!

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

Supported by

No more than two items per side (I can't use a constrain bc every item is randomly selected)

Hello,

So I have a paradigm where three items are presented one is presented to the left, one is presented to the right and one is presented on the top. If the top item is the same as the right item than the participant should click on the right item. If the top card is the same as the left item than the participant should click on the left item. So the correct answer is to click on the bottom right when the top card (target) is the same as the bottom right card and the correct answer is to click on the bottom left card when the top card (target) is the same as the bottom left card. I have the paradigm working nicely. Every item is shuffled so the item that is on the right and left is selected randomly and the item that is shown on the top is selected randomly. This is great and how I want it, except that I can't control for the fact that the correct answer could end up on the same side several times in a row. I would like to make it so the correct answer does not end up on the right side more than twice in a row and the same for the left side. I have attached the experiment. Any help would be greatly appreciated. Thank you so much.

Mollie

Comments

  • Hi Mollie,
    Do you still need help with this question, or has it been solved in the other discussion you had with Sebastiaan?

    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    I would still love help with this problem if you could help!

    Thank you so much,

    Mollie

  • Hi Mollie,

    Have you tried advances loop operations: https://osdoc.cogsci.nl/3.2/manual/structure/loop/#pseudorandomization

    It sounds like you just need to constrain that maxrep value of the correct side to 1.

    Is that possible?


    (sorry for the tardy response, btw),


    Eduard

    Buy Me A Coffee

  • Hey Eduard,

    No worries! Thanks for taking the time to respond. The advanced loop operations won't work because I do not have a column that accounts for correct side. The correct answer is defined later on with an in_line script. I have the rows shuffled horizontally such that a random item is selected at random so even I don't know which side the correct object will occur on (ie the match).

    I have defined the correct asnwer as

    if var.left==var.target and var.cursor_roi=='target_l'or var.right==var.target and var.cursor_roi=='target_r':

    var.correct=1

    else:

    var.correct=0

    So basically I do not want var.left==var.target more than twice in a row or var.right==var.target more than twice in a row.

    Sorry it's a bit confusing. Thanks so much!

  • Hi Mollie,


    How about you add a variable that tracks the previous targets? So in the end of your trial loop add an `inline_script`, incl. something like this `var.prev_targets.append(var.target)` (also make sure you initialize the variable before the loop to make the script to crash on the first trial).

    YOu can use this variable then, to select an appropriate target, like so:

    import random
    # to make the operation easy, I just assume target 1 and target 2, are coded as 0 and 1
    if len(var.prev_targets)>1:
        # some the previous 2 entries
        if sum(var.previous_targets[-2:]) == 2:
            # if sum is 2, then there were 2 target 2 trials in a row
            var.target = 0
        elif sum(var.previous_targets[-2:]) == 0:
            # if sum is 0, then there were 2 target 1 trials in a row
            var.target = 1
        else:
            # if it is neither (1), then choose one target randomly
            var.target = random.choice([0,1])
    

    Does that make sense?

    Eduard

    Buy Me A Coffee

  • Hey Eduard,

    Thank you so so much for your help. Unfortunately, I keep getting a syntax error... I have tried to play around with it but I have not been successful.

    Also, I just wanted to clarify. I put this script in an inline script in the run tab before the loop. and at the end of my loop I add var.prev_targets.append(var.target) in another inline script. I am not sure I understand what you mean by initialize the variable before the loop to make the script to crash on the first trial. Thank you very much for your help!


    best,

    Mollie

  • Hi,

    I actually realized that tracking the targets still won't help as those are selected randomly as well. So, the only way to know what the correct side is would be to create a variable called side which I have done like this:

    if var.target== var.left:

    var.side= 1

    if var.target==var.right:

    var.side=0

    and it works meaning when the target matches the card on the right I get a 0 in my output and when the target matches the card on the left I get a 1 in my output. But I still am having the problem where I don't want the correct answer(ie. when either the target matches the right or the target matches the left) to be to the same side more than twice in a row. I have tried to adapt the script you gave me to do so but I keep getting errors. I tried something like this:

    import random

    if len(var.previous_side)>1:

    if sum(var.previous_side[-2:]) == 2:

    var.side = 0

    elif sum(var.previous_side[-2:]) == 0:

    var.side = 1

    I don't know how to define previous_side? I have tried many ways. I'm really struggling. Thank you so much for your help.

    Best,

    Mollie

  • edited April 2019

    Hi Mollie,

    Can you share your experiment here. I think it might be quicker if I directly edit there. Another thought that I have (maybe nonsense), but if your main concern is to control the side at which the target appears, it would make more sense to create the trial sequence in advance, and then access the sequence item by item to present the stimuli. That way, you are in control and you always know where the correct response is. For example:

    import random
    list_to_shuffle = [0,1]*20
    while True:
        random.shuffle(list_to_shuffle)
        for i in range(2,len(list_to_shuffle):
            break_while = True
            seq_count = sumlist_to_shuffle[i-2:i+1])
            if seq_count == 0 or seq_count == 3:
                break_while = False
                break
     
        if break_while:
            break
    

    Unfortunately, I keep getting a syntax error

    That is weird, the line that lead to the error is correct syntactically. So, probably something happened before that. Again, if I see the full script, it'll get clearer.

    Also, I just wanted to clarify.

    There are several things here. First, the important part of you script (that makes sure you won't get 2 of the same kind in a row), relies on information of the current and of the previous two trials. That means, for the first and second trial, information on the previous two trials are not available yet, unless you define them before you need it. This is what I mean with initializing. Before, you even enter the block, you make sure that the variables that you will need to do the computation exist. Does that make sense?

    I put this script in an inline script in the run tab before the loop

    I think prepare tab makes more sense. And just to be clear, only the part in which you initialize the variable that you will need has to come before the loop. The actual computation has to be in the loop (after a response has been given).


    Hope this helps,

    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    Thank you so much for all of your help! I appreciate it so much. I have attached the project here.

    Best,

    Mollie


  • Sorry Molly, I am having a look at your script right now, but I have a hard time understanding what is supposed to happen exactly. Could you maybe summarize again super briefly your final goal and your current approach to achieving (incl. which variables need to be controlled)?

    As far as I understand, you have two images per trial (one left, one right), and one them is also presented on the top. What you want is that the target is never present on the same side for more than 2 trials in a row, right? So, as far as I can see, you can either control the target per trial, and then assign the stimuli to left/right sides according to your rules, or the opposite, you specify which stimuli go where, and then select which of them is the target according to your rules. (or of course both).

    Eduard

    Buy Me A Coffee

  • Hey Eduard,

    Thank you so much. I have a left and right column with objects that are shuffled horizontally that means either object_4 or object_5 will end up on the right or the left. Then I have a top card (here I created two columns target and target_2 and shuffled them horizontally) so either object_4 or object_5 will end up in the top card position. Here the toddlers are supposed to find the match. So if the top card is object_4 and the bottom right card is also object_4 the correct answer is the bottom right card(so they should press the bottom right card). All of that is perfect. The only problem is I do not want the bottom right card to match the top card more than twice in a row. So I have created a variable side. Side= 1 when the bottom right card matches the top card and side=0 when the top card matches the bottom left. From here I think I could make sure that the match is not on the right more than twice in a row or on the left more than twice in a row. Does that make sense? Thanks again for taking a look for me.


    Best,

    Mollie

  • Hi Mollie,

    I finally got to implement something that might be useful to you. The exciting things happen in the inline script "counterbalancing", in which the trial sequence is implemented. In the inline_script "selectTrialItem", the item per trial is being selected. I tried to use clear comments, and not change too much of your code, but if anything is unclear, let me know.


    Eduard


    Buy Me A Coffee

  • amazing! Thank you so much. I just have one last concern. I can't have any of the object pairs repeat more than once. but right now they are repeating. Could you help me with this last thing? I really appreciate your detailed notes and help!!

    Best,

    Mollie

  • edited April 2019


  • Hi Mollie,

    The attached file is updated to make sure no stimuli are repeated.


    Buy Me A Coffee

  • Thank you so so much! I learned so much!

  • Hi Eduard,

    So sorry to keep bothering you. I have now tried to implement this in the context of my entire experimental design but now I have problems. Because I have a training block that comes before this block, for some reason the first trial is using the images from the training block (possibly because we have defined var.target as trial_no -1). Additionally, I have added that the match is revealed when it is touched and that is showing the next match to come (I think for the same reason). I have attached the whole project this time. I really appreciate your input and time. Thank you so much again.

    Best,


    Mollie

  • Just kidding! I figured it out!! Thank you!

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