Block size in the selection system

Simon Bohn's Avatar

Simon Bohn

07 Jan, 2019 02:47 PM

Hi Chris,

I have an experiment in which I want to send trials randomly to the animal via the state system. There are 40 images and 4 trial types. I want the trials to be unevenly distributed, so that 49% of trials are type A, 49% are type B and 1% are type C and 1 % are type D.

Right now I have the experiment set up such that there are nested range replicators creating trials, the upper one generating between 0 and 39 to choose images and the lower one between 1 and 100 for "trial types." Then, within each trial, it checks for a trial type and an image number, and displays the image and trial type specified. If the monkey completes the trial, the selection is accepted, and if the monkey breaks fixation it is rejected. The selection system is operating on random without replacement, so that the monkey cannot break a fixation to skip a particular type of trial and they remain balanced, at least within a block, since the animal can't finish a block without doing all the trials in it.

Right now, I set the block size to the total number of possible trials. This worked fine when the distribution of trial types were 40% type A, 40% type B, 10% C and 10% D because it only required 10 "trial types," so the block size could be 400 trials with 40 images.

However, now that I want to change the distributions it is presenting a problem that the block size would become 4000 trials, far more than the 1200 or so that the animal will do every day. This would mean that the animal can effectively skip trials if he wishes, which we don't want.

So I figured I could change the block size to something smaller, say 200, with the sampling method still set to samples. I was wondering if you could verify if this would get me the result I want, which is to say, blocks of 200 trials chosen from the set of 4000, and within that block of 200 operate as random without replacement. Then, the next block will be a different random block of 200 out of the 4000, and so on.

Let me know,

Simon

  1. Support Staff 1 Posted by Christopher Sta... on 07 Jan, 2019 04:39 PM

    Christopher Stawarz's Avatar

    Hi Simon,

    I was wondering if you could verify if this would get me the result I want, which is to say, blocks of 200 trials chosen from the set of 4000, and within that block of 200 operate as random without replacement.

    Yes, that's correct.

    Then, the next block will be a different random block of 200 out of the 4000, and so on.

    You're guaranteed to get a different 200 only if the experiment isn't stopped between blocks. If the experiment ends (or is stopped), and you restart it, all selections are reset, so any of the previous 200 trials may be repeated.

    Is it important that each image be presented for each of the 100 trial "types"? If not, you could omit the outer range replicator and just use disc_rand to select the image for each trial. Then, set the block's sampling method to "cycles" and nsamples to however many iterations of the 100 types you want. (Note that this would force the animal to perform each of the 100 "types" once before any are repeated.)

    If you do need to ensure that each of the 4000 possible combinations is executed, and you can't get through them all in a single session, then you'll need to do some external bookkeeping to keep track of which combinations you've done in previous sessions. This will probably involve using saved variable sets or reading/write state to external files via Python. If this is the approach you need, let me know, and I'll work up an example showing how you might accomplish it.

    Cheers,
    Chris

  2. Christopher Stawarz closed this discussion on 24 Jan, 2019 02:23 PM.

  3. Christopher Stawarz re-opened this discussion on 30 Jan, 2019 03:59 PM

  4. Support Staff 2 Posted by Christopher Sta... on 30 Jan, 2019 04:07 PM

    Christopher Stawarz's Avatar

    Hi Simon,

    I've attached an example that demonstrates one way to accomplish what you want.

    I couldn't find a way to implement this using MWorks' selection tools, so I moved all the selection stuff in to Python. I changed some of the experiment parameters for ease of demonstration, but the code should work for any trial type percentages or number of images, trial type, and trials per block.

    If you have any questions, please let me know.

    Chris

  5. 3 Posted by Simon Bohn on 30 Jan, 2019 05:06 PM

    Simon Bohn's Avatar

    Thanks Chris, this looks great! I wish it were possible in vanilla MWorks
    -- fewer moving parts -- but this looks like a good solution. Is there any
    way to extend this solution to arrange trials/types the other way? The goal
    would be to alleviate the issue of changing probabilities near the end of a
    block when the block size is small by making the block artificially bigger.
    An example of that would be having 7 trials types, but putting them in
    blocks of 35, with each trial type occurring 5 times in a random order, and
    not allow the animal to continue until all trials in the block of 35 have
    been accepted.

    Simon

  6. Support Staff 4 Posted by Christopher Sta... on 02 Feb, 2019 01:58 PM

    Christopher Stawarz's Avatar

    Hi Simon,

    An example of that would be having 7 trials types, but putting them in blocks of 35, with each trial type occurring 5 times in a random order, and not allow the animal to continue until all trials in the block of 35 have been accepted.

    The Python script can generate the combinations of image index and trial type any way you want. It could definitely be adapted to do this.

    However, this design is also possible without resorting to Python. Please see the attached example.

    Cheers,
    Chris

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

07 Feb, 2019 02:24 PM
02 Feb, 2019 01:58 PM
01 Feb, 2019 06:25 PM
26 Jan, 2019 12:15 AM
18 Jan, 2019 05:44 PM