Howdy, Stranger!

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

Supported by

Pseudorandomization using mindist

Hi!

In the experiment I'm planning, I have a variable (called Keep) that can be either 0 or 1 .

It should receive the value 0 on 60% of the trails, and the value 1 on 40% of the trails.

The constraint is that after a Keep = 1 trial, there must be a Keep = 0 trial.

(After a Keep =0 trial there could be either Keep = 0 or Keep = 1).

Iv'e tried to add a constrain command:

constrain Keep mindist=2:

But it doesn't work (Python crushed), I believe this is because it was trying to implement this constraint on bot Keep = 0 and Keep = 1, which is impossible.

How would you approach that?

Is it possible to use the mindist comand for a specific value of the variable?


Thanks!

Anat

Comments

  • Hi Anat,

    I don't think these unbalanced conditions can be done with the loop table tools. You probably have to implement it yourself in python code, but it shouldn't be too difficult. If your lists are not too long (you don't have too many trials) you could even use a brute-force approach.

    Basically, you need to do following

    1) Make a list with 60% 0s and 40% 1s.

    2) Write a function that checks the requirements (if prev_target == 1 and cur_target == 1, then problem)

    3) Keep on shuffling the list, until all requirements are fulfilled

    4) Once the sequence is done, you can feed it into the trial loop and access the items one at a time.

    Does that make sense?

    Eduard

Sign In or Register to comment.