How to avoid presenting targets consecutively

Michiel Spape Michiel.Spape at nottingham.ac.uk
Mon Jul 25 09:45:56 UTC 2011


Hi Tobias,
416 trial types, as in, none of these may be repeated? I was going to copy-paste a bit of code to show you that yes, you can "just have a look", but it took me longer to explain exactly how to fit in this with your earlier question than I thought was worthwhile (given that I had only minutes). It's Monday, however, so I'll give it a go.

In this experiment, subjects saw a line of 5 numbers, each in the range 1-3. After memorising a sequence, they were asked to tap each number, with a number indicating a finger (1->index, 2->middle, 3->ring). Crucially, we only wanted sequences to make use of ALL three fingers (sequence 12121 therefore not being OK), and we wanted two conditions: simple having 2 transitions between fingers (e.g. 11123, with transitions here from 1 to 2, and from 2 to 3) and complex having 4 transitions (e.g. 13231). So, there you have it, how to generate two lists from a total number of 3x3x3x3x3 (=243) trial types, if you don't want to do the (pretty simple) thing like going through it in excel?

---------------

dim sequences(3*3*3*3*3) as long
dim nfingers(3*3*3*3*3) as integer
dim ntransitions(3*3*3*3*3) as integer
dim seqcount as integer

dim count1 as integer
dim count2 as integer
dim count3 as integer
dim transitions as integer


dim seq(5) as integer
dim r1 as integer
dim r2 as integer
dim r3 as integer
dim r4 as integer
dim r5 as integer
dim to5 as integer
for r1 = 1 to 3
  for r2 = 1 to 3
    for r3 = 1 to 3
          for r4 = 1 to 3
            for r5 = 1 to 3
                   debug.print seqcount & r1 & r2 & r3 & r4 & r5
                   sequences(seqcount) = clng(r1 * 10000) + clng(r2 * 1000 + r3 * 100 + r4 * 10 + r5)
                   seq(1) = r1
                   seq(2) = r2
                   seq(3) = r3
                   seq(4) = r4
                   seq(5) = r5
                   count1 = 0
                   count2 = 0
                   count3 = 0
                   transitions = 0
                   for to5 = 1 to 5
                           if seq(to5) = 1 then count1 = 1
                           if seq(to5) = 2 then count2 = 1
                           if seq(to5) = 3 then count3 = 1
                           if to5 > 1 and seq(to5) <> seq(to5-1) then transitions = transitions + 1
                   next to5
                   nfingers(seqcount) = count1 + count2 + count3
                   ntransitions(seqcount) = transitions
                   seqcount = seqcount + 1
                next r5
          next r4
        next r3
  next r2
next r1
'from here we know all trial types (also including the other ones). Now we split them up according to conditions. Each list is named after number of fingers (Fx) and transitions (Tx).

for transitions = 0 to seqcount
        if nfingers(transitions) = 1 then
                F1T0.AddLevel F1T0.Size + 1
                F1T0.SetWeight cstr(F1T0.Size), "1"
                F1T0.SetAttrib cstr(F1T0.Size), "Sequence", cstr(sequences(transitions))
        end if
        if nfingers(transitions) = 2 AND ntransitions(transitions) = 1 then
                F2T1.AddLevel F2T1.Size + 1
                F2T1.SetWeight cstr(F2T1.Size), "1"
                F2T1.SetAttrib cstr(F2T1.Size), "Sequence", cstr(sequences(transitions))
        end if
        if nfingers(transitions) = 2 AND ntransitions(transitions) = 2 then
                F2T2.AddLevel F2T2.Size + 1
                F2T2.SetWeight cstr(F2T2.Size), "1"
                F2T2.SetAttrib cstr(F2T2.Size), "Sequence", cstr(sequences(transitions))
        end if
        if nfingers(transitions) = 2 AND ntransitions(transitions) = 3 then
                F2T3.AddLevel F2T3.Size + 1
                F2T3.SetWeight cstr(F2T3.Size), "1"
                F2T3.SetAttrib cstr(F2T3.Size), "Sequence", cstr(sequences(transitions))
        end if
        if nfingers(transitions) = 2 AND ntransitions(transitions) = 4 then
                F2T4.AddLevel F2T4.Size + 1
                F2T4.SetWeight cstr(F2T4.Size), "1"
                F2T4.SetAttrib cstr(F2T4.Size), "Sequence", cstr(sequences(transitions))
        end if
        if nfingers(transitions) = 3 AND ntransitions(transitions) = 2 then
                F3T2.AddLevel F3T2.Size + 1
                F3T2.SetWeight cstr(F3T2.Size), "1"
                F3T2.SetAttrib cstr(F3T2.Size), "Sequence", cstr(sequences(transitions))
        end if
        if nfingers(transitions) = 3 AND ntransitions(transitions) = 3 then
                F3T3.AddLevel F3T3.Size + 1
                F3T3.SetWeight cstr(F3T3.Size), "1"
                F3T3.SetAttrib cstr(F3T3.Size), "Sequence", cstr(sequences(transitions))
        end if
        if nfingers(transitions) = 3 AND ntransitions(transitions) = 4 then
                if (cstr(sequences(transitions)) <> "12321") AND (cstr(sequences(transitions)) <> "32123") then
                        F3T4.AddLevel F3T4.Size + 1
                        F3T4.SetWeight cstr(F3T4.Size), "1"
                        F3T4.SetAttrib cstr(F3T4.Size), "Sequence", cstr(sequences(transitions))
                end if
        end if
next transitions
F1T0.Reset
F2T1.Reset
F2T2.Reset
F2T3.Reset
F2T4.Reset
F3T2.Reset
F3T3.Reset
F3T4.Reset
-------------

And voila, 8 lists are generated, which can be inserted as nested lists anywhere you like. Anyway, even if you don't decide to use such tricks, at least it's a pretty nice example of building custom lists.

As a side note on experimental psychology. I know enough people who want to completely do away with repetitions in experiments, and know the reasoning behind it. Here's a few considerations from the opposite perspective:
- if the number of stimuli is large enough (say, 416 trial types), the chance of re-occurrences is really small, especially since we generally draw samples without replacement. Thus, there's only one trial for your list of 416 trial types in which a re-occurrence is possible, namely the first sample. If you have to do an awful lot of programming just to control for that, you are wasting your time (unless you think you might learn something).
- Reoccurrences are completely normal in life, as such. Controlling for it necessarily induces non-randomness which may create expectations. I find it usually more helpful to control for it afterwards, statistically.
- Reoccurrences are interesting and may provide insight into your experimental paradigm which you would otherwise not be able to gain. Much of the field of cognitive control, for instance, would not have been there if somebody had not looked into what happens if conflicting trials are repeated.

That is not to say one might not have perfectly valid reasons for doing conditional randomisation (not the same as pseudo-randomisation; pseudorandom merely means the numbers are gained by deterministic processes, but they may well possess the quality of statistical randomness). As a note of caution however, it can be good not to be too anal about it.
Best,
Mich



Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology
www.cognitology.eu


-----Original Message-----
From: e-prime at googlegroups.com [mailto:e-prime at googlegroups.com] On Behalf Of Tobias
Sent: 22 July 2011 17:14
To: E-Prime
Subject: Re: How to avoid presenting targets consecutively

HI Michiel,

I am afraid I don't quite understand these two options.

What do you mean by "all the legal repetition types"? I have 416 trial
types, I can't just have a look for all legal repetitions.

Furthermore, I don't know how to generate a trial sequence. Is there a
command for that?

Anyway, thanks for your help and time!

Tobias

On 22 Jul., 17:37, Michiel Spape <Michiel.Sp... at nottingham.ac.uk>
wrote:
> Hi Tobias,
> I don't think David specifically meant my example when he said an answer has been offered time and again. What you are looking for tends to be called conditional randomisation, which is usually done in such a way as to either
> -----
> 1. Figure out all the legal repetition types
> 2. Build trial list
> 3. Run trial list.
> -----
> 1. Generate one trial sequence (dist-dist-targ-dist-targ) etc,
> 2. If 1) is illegal, goto 1.
> ... but many more ways are possible.
>
> Making a list shouldn't be too hard, and indeed, if you have that, List.Run works if you really must "draw a trial".
> Best,
> Mich
>
> Michiel Spapé
> Research Fellow
> Perception & Action group
> University of Nottingham
> School of Psychologywww.cognitology.eu
>
> -----Original Message-----
> From: e-prime at googlegroups.com [mailto:e-prime at googlegroups.com] On Behalf Of Tobias
> Sent: 22 July 2011 15:06
> To: E-Prime
> Subject: Re: How to avoid presenting targets consecutively
>
> I have a similar problem. In a visual search experiment, I have four
> target types and it happens often that one of them is used 10 times in
> a row. Let's not discuss how random E-Primes "random" is (I don't
> really trust it!).
>
> But: How can I implement a pseudorandom selection from a list? Let's
> say I want E-Prime to choose randomly trials from a list, but one of
> the four target types must not be repeated more than twice in a row.
>
> I see your answers here, but I think we have to tell apart two things
> here: No repitition of stimuli within a trial (e.g. attentional blink)
> on one side and no repition from trial to trial (e.g. two target types
> in visual search) on the other side.
>
> Michiel's solution works perfectly for the former case I think. But I
> don't see any way of implementing that for my case. Micah's solution
> might be a good idea, but it is not very handy if you want a different
> random order of trials for each subject.
>
> I guess it would be best if there is a way to make this in code. For
> example, E-Prime could record the recent trial types:
>
> target_t1 = target_t2
> target_t2 = c.getattrib("targettype")
>
> and then, E-Prime could check each new trial for repition:
>
> if c.getattrib("targettype")=target_t1 or
> c.getattrib("targettype")=target_t2 then "draw new trial".
>
> Unfortunately there is no command "draw new trials"
>
> That would be my way to go. Any hints?
>
> On 22 Jul., 11:02, Michiel Spape <Michiel.Sp... at nottingham.ac.uk>
> wrote:
> > Hi all,
> > Pseudo- (or actually offline) randomisation, would work depending on the task and duration (if indeed fMRI, I'd go for that - but EEG with hundreds of trials, not so much). Another answer may be found inspired in an old trick for programming an attentional blink (see my post here:http://www.google.co.uk/url?sa=t&source=web&cd=4&ved=0CDoQFjAD&url=ht...)
>
> > Outtake:
> > -----------
> > If the image-sequence is a procedure in a blocklist, make that something like
> > (start procedure)-->imagedisplay1-->imagedisplay2-->...-->imagedisplay9
> > Let the blocklist have 9 attributes: "imagefile1", "imagefile2",.., "imagefile9", and two nested lists: distracters and targets, set them both to randomise. Give them both an attribute, respectively "distracter" and "target". Fill these attributes with all the targets and distracters you like. Let these lists randomise.
> > Set the filename properties of the 9 imagedisplays to [imagefile1], [imagefile2], .., [imagefile9].
> > Set the attributes of imagefile1 to 9 (i.e. in the blocklist) to
> > [distracter:1]
> > [distracter:2]
> > [distracter:3]
> > [distracter:4]
> > [distracter:5]
> > [target:1]
> > [distracter:6]
> > [distracter:7]
> > [distracter:8]
>
> > For a trial sequence in which the 6th display is the different (i.e. target, odd) picture. Obviously, you need two more lines, for the other 7th or 8th image to be the target.
> > ----------------
>
> > Given that you want something like distractor/distractor/distractor/target/distractor... etc, it may well be best to programme your experiment such that rather than having a "target" trial, you have a number of slides (or whatnots) after another in a single trial. You can then make your list so that sequences are randomised between trials, rather than trials themselves. So, if I have a list like:
> > Slide1Word,Slide2Word,Slide3Word,Slide4Word
> > [Distractor:1],[Target:1],[Distractor:2],Target:2],[Distractor:3]
> > [Distractor:1],[Target:1],[Distractor:2],[Distractor:3],[Target:2]
> > [Distractor:1],[Distractor:2],[Target1],[Distractor:3],[Target:2]
> > ...
> > And the list randomises between these 3 sequences, 1) there's no way that two targets can come after another, 2) targets/distractors are randomised and 3) orders are randomised to a very safe degree (since it's unlikely that for one participant, for example, all targets will come relatively to the end).
> > Hope that helps.
> > Best,
> > Mich
>
> > Michiel Spapé
> > Research Fellow
> > Perception & Action group
> > University of Nottingham
> > School of Psychologywww.cognitology.eu
>
> > -----Original Message-----
> > From: e-prime at googlegroups.com [mailto:e-prime at googlegroups.com] On Behalf Of David McFarlane
> > Sent: 21 July 2011 22:05
> > To: e-prime at googlegroups.com
> > Subject: Re: How to avoid presenting targets consecutively
>
> > Micah,
>
> > Great answer.  I often get so wrapped up in looking for sophisticated
> > automated solutions that I overlook the simple ones, and what you
> > recommend is exactly what we do for fMRI in order to avoid problems
> > with accidental multicollinearity (which flusters correlation &
> > deconvolution analyses).  And as it turns out, this answer also
> > appeared in a discussion athttp://support.pstnet.com/forum/Topic3166-5-1.aspx.
>
> > -- David McFarlane, Professional Faultfinder
>
> > >Just as a general comment, and certainly not the best solution:
>
> > >I generally do my stimulus randomizations outside of e-prime. It's
> > >much easier to specific a pseudo-random or fully random sequence of
> > >stimuli outside of e-prime (in excel for example) and to then import
> > >it into one triallist that is sequentially sampled. This way you can
> > >randomize the list while keeping a look out for exactly the kinds of
> > >problem you mention.
>
> > >Hope that helps,
> > >Micah
>
> > >Mark A wrote:
> > > > Dear E-Prime group,
> > > > I am fairly new to E-Prime, but thus far have found online discussions
> > > > within the group, as well as PST instructions and examples that have
> > > > allowed me to program everything required, with one exception. The
> > > > experimental task is simple: A participant listens to a series of
> > > > words and presses a button whenever a particular word is heard (i.e.,
> > > > the target word, "apple" in the example below). The target word is
> > > > presented 4 times.
>
> > > > My problem is this: I wish to present a series of stimuli (.wav files)
> > > > randomly, with the restriction that I do not want "Target" files to be
> > > > presented consecutively. Rather, I want them to be separated by at
> > > > least one distractor (or non-target).
>
> > > > To illustrate, this is an excerpt from one of my lists:
>
> > > Weight        Nested  Procedure       Sound           Talker  Target  SoundDur
>
> > > 1                             MAppleTrial     m1apple.wav     m1
> > >            yes             422
>
> > > 1                             MAppleTrial     f4apple.wav     f4
> > >            yes             546
>
> > > 1                             MAppleTrial     m1apple.wav     m1
> > >            yes             422
>
> > > 1                             MAppleTrial     f4apple.wav     f4
> > >            yes             546
>
> > > 1                             MAppleTrial     m2bear.wav      m2
> > >            no              332
>
> > > 1                             MAppleTrial     f3bin.wav       f3
> > >            no              375
>
> > > 1                             MAppleTrial     m3cat.wav
> > >    m3              no              383
>
> > > 1                             MAppleTrial     f2chalk.wav     f2
> > >            no              586
> > > > ..... and so forth (there are 4 targets and 23 distractors).
>
> > > > Currently, I have the list set to "Random", however, this does not
> > > > guarantee that the Target files (top 4 rows) will not occur
> > > > consecutively. I think that the solution will involve a conditional
> > > > statement (perhaps using In line) comparing whether the previous file
> > > > presented was a target, but I am unsure how to implement this.
>
> > > > An additional consideration is what to do if there are only 2 cycles
> > > > left, and the two files left are both target files. If this is very
> > > > hard to avoid, I am willing to live with this, as it is unlikely to
> > > > occur very often. Any tips or links to helpful discussions on similar
> > > > topics will be very much appreciated.
>
> > --
> > You received this message because you are subscribed to the Google Groups "E-Prime" group.
> > To post to this group, send email to e-prime at googlegroups.com.
> > To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/e-prime?hl=en.
>
> > This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
>
> > This message has been checked for viruses but the contents of an attachment
> > may still contain software viruses which could damage your computer system:
> > you are advised to perform your own checks. Email communications with the
> > University of Nottingham may be monitored as
>
> ...
>
> Erfahren Sie mehr »

--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list