# Controlling stimulus parameters throughout random trials

Hi there, i am kind of new and i’m trying to replicate an experiment that shows a cross, and the x and y axis both have 2’7cm to 4’7cm length chosen at random (in 1’6mm steps). To get that result, i made an xlsx file with all the different length combinations except the ones in which both lengths matched (the test subject has to press a key to indicate which one of them is longer). Is there a way to balance the number of trials of both conditions (longer horizontal line or longer vertical line) and the difference between both of them? (say, having the same number of trials throughout the different length differences?). I am currently aiming for 30 trials, in blocks of five.

I’m not sure I really understand the question. You say that you’ve created a file with all of the different combinations, so aren’t the choices balanced by definition? You just run through that file multiple times for the required number of trials.

Also, there is no reason to not include the condition with equal lengths. That point still provides useful data if there is a directional bias (which there certainly is with horizontal vs vertical judgments: one of the larger effect sizes in psychology…)

Thanks for answering! The problem im facing is, there are way more combinations than trials (182 different size combinations, not counting the equal size ones, which i will be adding now), and i dont quite know how to program it so that it selects 30 of those combinations while controlling some variables (such as the magnitude of the length difference or whichever line is the longest).

An example of why we need a very precise description of a problem if we are to give anything like a useful answer.

That may not be such a good idea if you aren’t able to cover all combinations. It really depends on the question you are addressing.

A program is just a precise set of instructions to implement what you want to achieve. Without a precise description of the latter, the former can’t be created.

What you need to do is very precisely describe your selection and balancing requirements, as you would for a methods section in a paper or thesis. It is only then that you’ll be able to get any useful suggestions as to how implement that in code.

Pay particular care to define exactly what you mean when you use the phrase “at random…”.

1 Like

Sorry for not quite explaining what i’m aiming for.
Im trying to replicate an attentional blindness study, in which there were 30 trials in which the subject was presented a cross, with x and y lengths between 2,7 and 4.7 centimeters that varied randomly (in 1,6mm steps). Subjects had to use a key to indicate which axis was longer and an unexpected stimulus was present during the 24th. Finally, they were asked if they saw the stimulus and, if they did, its shape.

I made an excel file with all the different axis length combinations, and a loop surrounding the trial that chose randomly from the file, and inserted a code component so that it stopped at 29 reps, but then i realized i had to present the same number of trials per each length difference between both axes, whichever was longer and the lenght difference the unexpected stimulus was presented on (since an easier task would net a different detection ratio)

Now, thats exactly what i dont know how to do, balancing those three conditions throughout the whole experiment.

I thought i could split the conditions file, one per length difference and axis (in example, 0.32cm difference, larger horizontal) and then making as many trials as files i got, then making a loop set as random so that it cycled the same number of times per condition, but in that case i dont know how i could balance the one the unexpected stimulus was presented on across subjects.