Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

Creating 3 (or more) conditions - Between subject design

EvaEva Posts: 27

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

  • sebastiaansebastiaan Posts: 2,950

    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

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • EvaEva Posts: 27

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

  • EvaEva Posts: 27

    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"

  • sebastiaansebastiaan Posts: 2,950

    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

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • EvaEva Posts: 27

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

  • IziroIziro Posts: 2

    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

  • EvaEva Posts: 27

    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

  • sebastiaansebastiaan Posts: 2,950

    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

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • IziroIziro Posts: 2

    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

  • EvaEva Posts: 27

    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 :)

Sign In or Register to comment.