Howdy, Stranger!

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

Supported by

Applying pre-existing randomisation by participant number

Hi so I'm wanting to run an experiment where participants are randomly assigned to one of two video stimuli exposures. It will be run across multiple tablets simultaneously, and I don't really want to use odd/even or other counterbalanced approaches I have seen in the tutorials as I would prefer to be blinded to participant condition. The approach I would ideally like to take is have a third party generate an excel sheet with all my participant numbers in column A and randomly assigned 'condition' (0 or 1) in column B - adding this list into open sesame somehow. Then when the participant number is entered on open sesame I want it to identify what condition that participant number is assigned to (i.e., based on the excel doc) and play the appropriate stimuli, presumably using the 'condition' variable in the 'Run if' function.

Is this possible? If so, can anyone give me a bit of guidance?

Cheers!

Comments

  • Hi Kezzo,

    The idea of a double blind study is a very good one, I like it. One simple way to do it is copy pasting a random list into an inline script and using the subject number as an index to retrieve the random value at that index.

    I guess one potential problem is that if you completely randomize an long list there is a slight chance that you will get a repetition of condition 1 for the first xx subjects.

    A primitive way to avoid that:

    import random   
    nr_subjects = 100
    batch_nr = 10
    total = []
    for i in range(0,nr_subjects/batch_nr):
        nr = [0,1]*batch_nr
        random.shuffle(nr)
        total = (total + nr)
    

    This way you randomize per 'batch' so that after each number of 10 subjects your design is balanced, of course you can reduce or increase this batch number according to your needs, and indeed once you have the random condition variable you can use it in the same manner as described in the example experiments. Hope this helps, good luck

  • Hi Roelof,

    Thanks for your response, you have come at the problem in a slightly different way to how I had thought about it. Yours is much more elegant I think. Really helpful.

    I am new to open sesame and doing inline scripts so bear with me. So just to make sure I understand how this works, in the most basic example if I added the code below into an inline script:

    random_list = [1,1,1,0,0,0]
    var.condition = random_list[var.subject_nr]

    I would then have a new variable [condition] I can refer to elsewhere in open sesame in which subject numbers 0, 1 and 2 have a value for [condition] of 1. And subject numbers 3, 4 and 5 have a value for [condition] of 0. And any other subject numbers will not have a value for the variable [condition]. Is that correct?

    If so this will almost certainly do what I require - but just as a quick extension... is there anyway the random_list can be retrieved from an external file (i.e., an excel) - that way I would never even have to see the random list (as I would if I copy & paste it into inline script) so there can be no possible way I, for example, might remember the first few in the sequence.

  • edited July 2017

    Yes, you are completely correct about the description of the assignment of condition number and subject numbers. There is a way to store the codes in an external file and read in the number in an inline script definitely, you have to be careful with running the experiment on multiple platforms though since if the folder structure is different you would have to change the working directory ('log_path') for each device.

    #before the experiment in a python interpreter (e.g. spyder):
    import random   
    nr_subjects = 100
    batch_nr = 10
    total = []
    for i in range(0,nr_subjects/batch_nr):
        nr = [0,1]*batch_nr
        random.shuffle(nr)
        total = (total + nr)
    
    file_name = 'random_numbers'
    log_path = 'C:\your folder here\' 
    f = open('%s\%s.txt' %(log_path, file_name), 'w')
    f.write(str(total))
    f.close()
    

    and then in the inline script:

            #in the inline script in the experiment
            log_path = 'C:\your folder here\' 
            f = open('%s\\%s.txt' %(log_path,file_name),'r+')
            for row in f:
                condition_list = eval(row)
    

    Now you can use the 'condition_list' the same way as before using the subject number as the index

  • Thats great - thanks Roelof!

  • @Roelof - I've actually had a bit of trouble implementing this. The bit in spyder works fine (although seems to create twice as many numbers as specified in nr_subjects):

    `import random
    nr_subjects = 100
    batch_nr = 10
    total = []
    for i in range(0,nr_subjects // batch_nr):
    nr = [0,1]*batch_nr
    random.shuffle(nr)
    total = (total + nr)

    file_name = 'random_numbers'
    log_path = '/Users/Kieran/Desktop/'
    f = open('%s\%s.txt' %(log_path, file_name), 'w')
    f.write(str(total))
    f.close()`

    However, in open sesame when I put in the following code:

    `file_name = 'random_numbers'
    log_path = '/Users/Kieran/Desktop/'
    f = open('%s\%s.txt' %(log_path, file_name), 'w')
    for row in f:
    condition_list = eval(row)

    var.condition = condition_list[var.subject_nr]`

    I get this error - IOError: File not open for reading

    Any suggestions?

  • Indeed the total number of subjects is twice as large since we are adding two numbers with every execution of the for loop, that is a bit confusing.

    As for the error, if you change the 'w' to an 'r' I think it should work (w= write, r = read)
    f = open('%s\%s.txt' %(log_path, file_name), 'r')

    Let me know if there are any other implementation problems, good luck.

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