EPrime - motion stim issues

David McFarlane mcfarla9 at msu.edu
Fri Aug 26 14:41:59 UTC 2011


Paul,

Thanks for checking on the equivalence between PRNG and Randomize, 
etc., and posting a very nice test.  I had wondered about that 
myself, and some time ago ran extensive tests to convince myself that 
they all use the same underlying generator.  Perhaps it is time that 
I posted that as part of my "Mastering E-Prime" series.  In short, I 
concluded that PRNG just gathers into one E-Object all of the 
functions of the standard VBA randomization functions, and that PRNG 
includes a GetSeed method lacking from standard VBA.  Beyond that, 
which you use comes down to matter of personal programming taste or 
style.  I like keeping all those functions neatly organized under one 
object, but I always comment that in my source code.

But of course no one should take my word for anything, so it is good 
to have someone else verify this.

Best,
-- David McFarlane, Professional Faultfinder


At 8/25/2011 07:17 PM Thursday, Paul Groot wrote:
>Hi David,
>
>That is indeed what happens when using the random function. (I was
>just trying to talk myself out of a silly typo ;-)
>
>A deeper understanding of the problem often raises new questions...
>Purely academic off course!
>I just realized that the EPrime (1.2) documentation mentions two types
>of random generators: The standard visual basic functions (random,
>randomize) and the E-Basic specific PRNG object. This might be
>important if you use the seed value to setup your experiment to a
>known state (for reproducibility and testing). The edat output file
>logs a single seed value retrieved with PRNG.GetSeed(), so it would be
>interesting to know if there is only one active PRNG under the hood. A
>simple test shows that this is indeed the case:
>
>PRNG.SetSeed 987654321
>debug.print PRNG.GetSeed()
>Randomize 123456789
>debug.print  PRNG.GetSeed()
>
>will print:
>987654321
>123456789
>
>cheers
>Paul
>
>2011/8/25 David McFarlane <mcfarla9 at msu.edu>:
> > Ah, I was not thinking about the underlying architecture of the Random()
> > function, so you got me there!  Now the discussion must get more
> > technical...
> >
> > Of course, if Random() is based on, say, a 32-bit cyclic PRNG, then it will
> > repeat its sequence after no more than 2^32 = 4,294,967,296 samples (or
> > perhaps more like 2^31 = 2,147,483,648 samples, because 
> E-Basic/VBA does not
> > use unsigned integers).  But that is not what I had in mind, because we
> > rarely use Random() to pick numbers from that entire range.
> >
> > Rather, I had in mind more common & prosaic uses such as Random(0,99).  The
> > underlying architecture now parses the full 32-bit range into 100 segments,
> > with no guarantee that it will not draw samples from the same segment until
> > a sample has been drawn from each segment.  To the contrary, it 
> is extremely
> > likely in this case that it will draw duplicate numbers within 
> the first 100
> > samples.  You can see this readily if you try a scaled-down example, say,
> > Random(0,9) or even Random(0,2) -- I know, I just did this.
> >
> > More to the point, I was thinking in terms of my understanding of the
> > *intent* or *specification* of the Random() function, apart from its actual
> > implementation.  As I understand it, Random() is *meant* to act as a die
> > roll, not as a shuffled deck of cards.  IOW, Random(1,6) should return a
> > random number from 1 to 6 each time, without regard to what came before
> > (just like a six-sided die), rather than return a number and then remember
> > that number and not return it again until all other numbers have been
> > returned (like a shuffled six-card deck).
> >
> > Did I get this right now?
> >
> > Best,
> > -- David McFarlane, Professional Faultfinder
> >
> >
> > At 8/25/2011 03:25 PM Thursday, Paul Groot wrote:
> >>
> >> Absolutely; the cyclic chain of numbers will definitely pop-up the
> >> same numbers after a while... So they must have been but back ;-)
> >>
> >> my mistake!
> >>
> >> 2011/8/25 David McFarlane <mcfarla9 at msu.edu>:
> >> > At 8/24/2011 03:20 PM Wednesday, Paul Groot wrote:
> >> >>
> >> >> Alternatively you could use a simple inline script at the start of the
> >> >> trial and use the E-Basic random() function to set durations. (That
> >> >> would be
> >> >> uniform random w/o replacement.)
> >> >
> >> > Um, wouldn't the E-Basic random() function result in uniform random
> >> > samples
> >> > *with* replacement?
> >> >
> >> > -- David McFarlane, Professional Faultfinder

-- 
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