Howdy, Stranger!

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

Supported by

[solved] How to assign participants to different sequences?

edited October 2015 in OpenSesame

Hey there,
I am an Open Sesame newbie who is totally unfamiliar with phyton. Nonetheless, I got along pretty well - the program is really intuitive and easy to use. There is just one thing that I really struggle with: I've got three experimental conditions that I realized by creating different loops (positive, negative and ambivalent) and I would like to randomly assign my participants to these conditions. How can I do this? I suggest I have to create an if-statement but since I need three conditions I can not just divide the participants by their subject parity (odd vs. even). Can anybody help me out?
Thanks in advance!
Best,
L.

Comments

  • edited 2:06AM

    Hi Lisa,

    So you're talking about a between-subject design? You could use the modulo ('%') for your if-statement. The idea of modulo is that it fits a number as often as possible in another number, e.g. in 10%3, 3 will fit three times in 10, and that will leave you with 1: hence, 10%3 is 1. A bit odd, but this comes in handy in your design. Taking subject_nr % 3, we could say that

        if subject_nr % 3 == 0:
               subject_group = 'A'
        elif subject_nr % 3 == 1:
               subject_group = 'B'
        elif subject_nr % 3 == 2:
               subject_group = 'C'
    
        exp.set('subject_group', subject_group) # (this makes the variable available outside
                                                                     # your inline script)
    

    Then, in the overview window clicking on the experimental sequence that contains your three loops, you'll find that all loops run 'always' by default. You can change this into a logic statement - for instance, [subject_group] = 'B'.

    Hope this helps

    Josh

  • edited 2:06AM

    Josh,
    Thank you so much for your help! This is definitely a step in the right direction. Unfortunately, I still get an error message that says"IndentationError: unexpected indent". Do you happen to know how I could solve this?
    Sorry for being so helpless, but I really don't know anything about phyton.
    Thanks in advance!
    best,
    L.

  • edited 2:06AM

    Never mind, I figured it out! Thank you so much!!

  • Hi Josh,

    I am also very new to programming and OpenSesame.

    Where exactly do I put that code into the general script? Everytime I click apply it takes the code away so I assume I'm putting it in the wrong place.

    Best,

    Matthew

  • @MDJ

    > Where exactly do I put that code into the general script? Everytime I click apply it takes the code away so I assume I'm putting it in the wrong place.

    This is Python code, so you have to insert in an inline_script item, ideally at the very start of the experiment.

    For information about Python in OpenSesame, see:

  • MDJMDJ
    edited March 2019

    Thanks Sebastian....I didn't realise that I needed to use an inline_script item to do that!

    I have now placed the item at the start of the experiment and used similar code to Josh except I have 6 categories instead of 3.

    However, an error is now coming up:

    " Inline script, line 1, in <module>

    NameError: name 'subject_nr' is not defined "

    This is probably really obvious but where and how exactly should I define subject_nr?

    Thanks again,

    Matthew

  • Hi Matthew,

    The script that Josh provided above is actually not entirely correct. Here's what it should look like:

    if var.subject_nr % 3 == 0:
      var.subject_group = 'A'
    elif var.subject_nr % 3 == 1:
      var.subject_group = 'B'
    elif var.subject_nr % 3 == 2:
      var.subject_group = 'C'
    

    If you want to use an inline_script, I recommend at least walking through the intermediate tutorial to get some understanding of how this works. Otherwise you'll blindly stumble from one confusing problem into the other which is frustrating and inefficient!

    Cheers!

    Sebastiaan

  • My pleasure :)

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