Howdy, Stranger!

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

Supported by

Creating 3 (or more) conditions - Between subject design

Hi all,

I want to create multiple conditions to implement a between-subjects design with 3 conditions.
I've succesfully implemented this with 2 conditions before. Here it was quite easy because I programmed it to set even numbers to condition 1 and uneven numbers to condition 2. Of course, this doesn't work with 3 condtions. Hence, I'm looking for an easy way to implement this.

An obvious solution would be to randomly assign people to condition 1,2, or 3 but I want to have balanced groups which is of course not garanteed when using a fully random design.

Thanks!

Eva

Comments

  • Hi Eva,

    The easiest way to do this is with the module (%) operator, which gives you the remainder of an integer division. That sounds abstract, but it goes like this:

    0 % 3 == 0
    1 % 3 == 1
    2 % 3 == 2
    3 % 3 == 0
    4 % 3 == 1
    etc.
    

    Does that make sense?

    So you can create a variable subject_group that rotates from 0 through 2 like so:

    var.subject_group = var.subject_nr % 3
    

    And then you use that variable in much the same way as you used subject_parity before.

    Cheers!
    Sebastiaan

  • Hi, Thanks! Yes ! Will try and implement it but should be straight forward :)

  • Quick question, I added "var.subject_group = var.subject_nr % 3" to the general script but this seems to cause problems. When I run it I get the following error: "' "subject"_"group" == 1' is not a valid conditional statement"

  • Hi Eva,

    This is Python code, which you need to add to an inline_script item. The general script contains OpenSesame script, which is a simple language that defines the experiment. But it's different from Python, which is a full programming language. See also:

    Does that clear things up?

    Cheers,
    Sebastiaan

  • Ahhh ok, no i know what python is, but didn't realise i should use the inline_script item to implement it. Thanks! Eva

  • Hi all,

    I study cognitive science in France and I actually learn how to work with Open Sesame
    thanks to the tutorials of Sebastiaan.

    I have to do exactly the same thing and I have the same problem than Eva at the last step.
    I tried few things with the inline_script and the general script but nothing works correctly.

    Can someone help me a little please?

    Thanks!

    Hugo

  • Hi all, I didn't have time to look at it again until now but I also get similar issues as Hugo has I think.
    If I run it as above it seems to not see subject_group as one thing but rather as "subject"_"group" which it then doesn't count as a valid conditional stateent when I later use it the way I originally used subject_parity. This could be solved by using camelCase so calling the variable subjectGroup. Then Opensesame doesnt return errors and runs, however it skips my condition sequence. Apperently now it thinks that the conditional statement "run if "subjectGroup = 1" is a valid statement but it's not met (neither are subjectGroup=2 or 3) so it just skips the experiment block and goes to the end of the experiment..

    any idea on what may be going wrong?
    Eva

  • Hi Eva,

    In run-if statements, you need to indicate that subject_group is the name of a variable by putting it between square brackets: [subject_group] = 1

    See also:

    Does that clear things up?

    Cheers,
    Sebastiaan

  • Hi,

    I finally found the way to make it work. Courage Eva, the solution is really not so far.
    Just follow the lead of Sebastiaan :)

    Sebastiaan thank you for all your investment for the community !!

    Bye

  • Hi Sebastian,

    Oh god.. how dumb .. -.-" always the stupidest stuff when programming isn't it...

    that basically solved the whole thing, thanks!

    Eva

    p.s. Hugo, nice to hear it solved your problem too :)

  • Hi everyone,

    In my previous study I only had 2 conditions and it was easy: even and odd. But this time I am trying to implement 4 conditions. As it was discussed above I added an inline script item and copied and pasted "var.subject_group = var.subject_nr % 4". Plus I created 4 runifs such as loop_1 [subject_group] = 1, loop_2 [subject_group] = 2, etc. It is perfectly working for 1 and 2 but not 3 and 4. What might be the possible reason?

    Thanks,

    Esra.

  • Hi Esra,

    this commend `var.subject_group = var.subject_nr % 4` will give (depending on the subject nr) the output 0,1,2,3

    Are you sure that the problem is not simply that?

    At least it works for me (see attached example)

    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