Howdy, Stranger!

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

Supported by

task switching where the type of previous 3 trials matter

Hello everyone,

First of all I am well aware that my question may sound very silly, but I am very new to this language and 100% sure that there must be a more convenient method of implementing my design than what I was considering.

I am designing a task switching experiment where I am not only interested if there has been a switch in the last trial, but also whether there has been a switch in the previous three trials. So I try to manipulate the length of seeing the same task. Thus, a variable I have will be the number of previous repeats (3 levels: 2,1,0)

To illustrate, let's say the sorting variables are gender and age. I will present
aaag, ggga -switch with two previous repeats
gaag, agga-switch one previous repeat
()()ag,()()ga- switch with no previous repeat

1) Though I am only interested in accuracy and response time of the current trial, how may I know what the previous three trials were? Shall I make a variable for each of the four trials?
2) How may I make sure that overall each previous repeat condition is seen one third of the time, and occurs in each possible combination? (let's say aaag and ggga)

Thanks in advance

Comments

  • Hi,

    Unfortunately, there is no easy, standardized way of doing it, that is, you have to write the conditions yourself in Python. However, if you give me more information on what is an experimental variable that needs to be counterbalanced and what are variables that can be random, I can write a little script that gets you started.
    In essence, you would create the trials for a block all in advance so that you are in full control when switches occur at any point in your experiment (because you have all trials stored in a list).

    Eduard

    Buy Me A Coffee

  • Dear Eduard,

    Thanks for your reply. To illustrate it better, let's say that the tasks are categorizing an object either according to the shape or direction based on the cue. However, there is an irrelevant feature of the object to be manipulated, which is the color of the object and we will measure the switch rate in change from one color to other. My variable will be the number of times the color repeats before it switches, with the assumption that more repeats will result in longer response rate in switch. Thus, I want to compare the times that the color repeats 3 times before, 2 times before and appears only once before it switches (3 levels). So I will manipulate

    task condition (2 levels: switch vs repeat of task)
    task (2 levels: shape vs direction)
    irrelevant cue (3 levels: 3 colors)
    repeats of irrelevant cue before switch (3 levels) ---- of importance only when there is a switch
    irrelevant cue condition (switch color vs repeat color)

    I know this is very complicated, and thus I will probably do it manually. Do you know anyway of logging answers with a if-then rule, such as log as 3 repeat if color in trial 1=color in trial 2= color in trial 3?
    Also what is the variable name python uses for trials or stimuli that repeat each other? In other words, how may I write a code with a if clause such as "if color in previous trial is the same as color in current trial".

    There may be a way of commanding this other than what I have suggested, yet I am very new to OpenSesame and lack the knowledge of tools to implement my design at the moment.

    Thanks in advance for your help

  • how may I write a code with a if clause such as "if color in previous trial is the same as color in current trial".

    Using Opensesame variables for that experiment and choosing colors, tasks, etc. live on every trial, will be a pain. Rather, run a script in the beginning of every block, that defines the variables for all trials at once. Then on each trial, you would just select the current trial info, and you're set. So, you should use an inline_script for that, and how you call the variables is completely up to you.

    task condition (2 levels: switch vs repeat of task)
    task (2 levels: shape vs direction)
    rrelevant cue (3 levels: 3 colors)
    repeats of irrelevant cue before switch (3 levels) ---- of importance only when there is >a switch
    irrelevant cue condition (switch color vs repeat color)

    Ok. And which one of these factors do you want to have to be balanced? That is, should there be the same number of repeats and switches? Same number of shape and direction task trials? Etc... Also keep in mind which interactions you want to balance (e.g. same amount of trials for each number of repeats before switch, for each task condition).
    As you say, the current design is quite complicated and I doubt it is possible to balance out everything. For example, you can't have the same number of switches and repeats, if you have only the options of 1,2, and 3 repeats before a switch. To make it possible, you would need to allow also 0 repeats.

    This script implements a version of your design, that I would consider reasonable:

    import random
    
    colors = ['red','green','blue']
    switch_seq = []
    rep3 = [0,0,0] # making sure to have 3 repeats
    rep2 = [0,0] # making sure to have 2 repeats
    rep1 = [0] # making sure to have 1 repeat
    switch = [1] # a switch
    
    switch_seq = [] # container for the trials
    rep_conditions = [rep1,rep2,rep3]*6 # each condition 6 times --> 54 trials
    random.shuffle(rep_conditions) # randomize them
    
    while len(rep_conditions)>0:
        switch_seq.append(rep_conditions.pop())
        switch_seq.append(switch)
    # flatten everything
    color_seq = [j for i in switch_seq for j in i]
    print(len(color_seq))
    
    # pick colors
    color_choice = [random.choice(colors)]
    for i in color_seq:
        # loop over switch/repeat seq and assign colors
        # if 0 then that is a repetition
        if i == 0:
            color_choice.append(color_choice[-1]) # append the prev item
        else:
            while True:
                new_col = random.choice(colors)
                if new_col != color_choice[-1]:
                    color_choice.append(new_col)
                    break
    
    # task sequence
    tasks = ['shape','direction']
    n_trials = 54 # adjust if necessary
    task_seq = tasks*(int(0.5*n_trials))
    
    # randomize as long as necessary to make switch and repetitions balanced
    while True:
        random.shuffle(task_seq)
        start = task_seq[0]
        rep_counter = 0
        for i in task_seq[1:]:
            if i == start:
                rep_counter += 1
                start = i
        if rep_counter == int(n_trials *0.5)-1:
            break
    
    #final trial info
    trial_info = zip(color_choice,task_seq)
    

    try to understand the logic, and adjust to your needs. You can test the code in an inline_script and the debug window (or a regular python console).

    Feel free to ask if anything is unclear.

    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