Howdy, Stranger!

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

Supported by

How can be done trials in a task in diffrent proportion ?

Hi,
I'm trying to create a task switching task (Number-letter task) which has to include switch and non-switch trials. In the task switch trials should be %40 and non-switch should be %60.
I just wrote stimuli on the loop item, and create the list with the "full-factorial design " function. Then I wrote [letter][number] the stimuli sketchpad item to provide display stimuli side by side.

But I need help about how can be control switch and non-switch trials proportion. Could you please help me?

Comments

  • Hi,

    Add an inline_script before your loop and put this code in there (prepare phase):

    <br />import random
    
    no_trials  = 20 
    ratio_rep = 0.6 # how many repetition trials are in a block
    # make sure that the ratio can be reproduced with the number of trials
    var.trials = [0]*0.6*20 + [1]*(1-0.6)*20
    random.shuffle(var.trials)
    

    Now the variable var.trials will have 0s for all the repetitions and 1s for all switches. In your experiment you just have to access every item in that list one after another, so that you get the correct type per trial.

    Does that help?

    Eduard

  • edited January 19

    Thank you very much for the response :)
    But unfortunately, when I tried your solution, I got the "can't multiply sequence by non-int of type 'float'" error for the "var.trials = [0] * 0.6 * 20 + [1] * (1-0.6) * 20" line. I searched about this but ı couldn't understand the solutions suggested because the examples are not similar to mine and they are very complicated for me.

  • Hi,

    my bad, replace var.trials = [0] * 0.6 * 20 + [1] * (1-0.6) * 20 with var.trials = [0] * int(0.6 * 20) + [1] * int((1-0.6) * 20)

    Does that work?

  • Hi,
    it works but I am sorry that I couldn't understand how it show switch ( changed response e.g. b to n) and non-switch (unchanged response e.g. b and again b) trials?

    I tried to analyze the logic from the quickrun file, but I couldn't get it. Could you please help? Thank you :)

  • var.trials will contain 0s and 1s in a certain proportion. When you present your stimuli, you have to do it contingent on the number in the list. If var.trials[current_trial_number] == 0 present a repeated stimulus, else, present a switched stimulus. The exact way to implement this. depends on your stimuli and your preference, there are multiple options.

    Does that make sense?

  • I am sorry it is a bit much for novices, but I am studying on hard. I believe I will achieve B) Until that time I will enter stimuli manually and present sequentially. Thank you very much :)

Sign In or Register to comment.