3
$\begingroup$

Observe:

cnt = 1000;
rs = 1;

Table[
 SeedRandom[rs];
 r1 = Count[
    Max /@ Partition[RandomVariate[PascalDistribution[1, .02], ss*cnt], ss], 
            x_ /; x >= 198]/cnt;

 SeedRandom[rs];
 r2 = Count[Max /@ RandomVariate[PascalDistribution[1, .02], {cnt, ss}], 
            x_ /; x >= 198]/cnt;

 SeedRandom[rs];
 r3 = Count[Max /@ Table[RandomVariate[PascalDistribution[1, .02], ss], cnt], 
            x_ /; x >= 198]/cnt;

 {r1, r2, r3}, {ss, {10, 62, 63, 100}}]

{{89/500, 89/500, 181/1000}, {137/200, 137/200, 89/125}, {139/200, 139/200, 139/200}, {843/1000, 843/1000, 843/1000}}

Each of the sets of results should have the same results within.

For this use case, it appears that samples <=62 at a time has issues (deeper testing seems to indicate a slight skew right, that is, more large variates than expected).

I suspect this may be another case of algorithm switching based on sample size (perhaps in combination with other parameters).

Confirmation/explanation/etc.?

I'm working around it via the first two methods: array sampling or partition larger samples.

Edit: FML, I knew this seemed familiar: I ran into problem a while ago, addressed in question here, have voted to mark as duplicate.

$\endgroup$
0

1 Answer 1

1
$\begingroup$

The is an extended comment rather than an answer.

I get the same results with 10.4.1 Windows 10.

For the PascalDistribution one gets different random samples for sample sizes less than 63 (as you've noted). (This does not seem to happen with the NormalDistribution, for example.)

Here is what happens with using the same random number seed but differing sample sizes:

Do[SeedRandom[1];
 Print[{n, RandomVariate[PascalDistribution[1, .02], n]}], {n, {1, 2, 3, 61, 62, 63, 64}}]

{1,{56}}

{2,{20,145}}

{3,{41,56,12}}

{61,{20,119,22,81,145,28,25,53,12,20,14,71,88,27,57,1,66,36,48,230,49,26,51,154,25,89,40,39,23,9,43,74,38,49,181,38,6,32,51,10,221,26,25,99,95,51,19,23,15,76,52,49,23,10,106,6,25,43,242,24,7}}

{62,{20,119,93,81,56,87,25,80,12,20,7,38,71,69,27,20,66,98,21,57,49,70,51,47,25,89,40,39,9,94,48,40,38,41,38,6,32,51,10,221,26,25,15,11,95,51,32,1,23,15,21,81,49,43,11,28,6,33,64,54,86,24}}

{63,{85,6,78,11,14,4,39,14,25,60,12,69,28,15,188,87,129,43,18,12,43,7,19,62,25,85,20,45,37,10,32,82,1,19,78,1,25,31,31,65,78,16,18,30,3,33,67,12,39,41,73,180,11,36,20,12,39,31,17,40,42,39,99}}

{64,{85,6,78,11,14,4,39,14,25,60,12,69,28,15,188,87,129,43,18,12,43,7,19,62,25,85,20,45,37,10,32,82,1,19,78,1,25,31,31,65,78,16,18,30,3,33,67,12,39,41,73,180,11,36,20,12,39,31,17,40,42,39,99,55}}

For $n>63$ the same initial sequence is generated. But note that it's not just a rule based on being above or below 63. The first two samples from a sample size of 3 are not the same samples as from a sample size of 2 with the same random number seed.

For your first two examples exactly the same number of random samples are generated with just a single use of RandomVariate and so the resulting sequences are the same which results in the same summary statistics.

That by itself doesn't mean what is going on is wrong or more precisely that one is not generating pseudo-random samples from a Pascal distribution. However, your observation that certain population characteristics don't seem to match up with repeated sampling would be a concern. I think you should consider modifying your question to consider that more potentially damaging aspect.

$\endgroup$
2
  • $\begingroup$ Thanks (again) Jim - see my edit, this seemed familiar to me, should have seemed the same for you ;-} $\endgroup$
    – ciao
    Commented Jan 2, 2017 at 6:20
  • $\begingroup$ Yes, it should have seemed very, very similar. But these days at lunchtime I can't even remember what I had for breakfast let alone something six months ago. But this is a good reminder for me to do a quick search before I comment or answer. $\endgroup$
    – JimB
    Commented Jan 2, 2017 at 19:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.