Message Boards Message Boards

GROUPS:

[?] Use seed random method for Empirical Distribution for RandomVariate?

Posted 1 month ago
330 Views
|
2 Replies
|
2 Total Likes
|

Hello My name is Decha. I have question for " seed random method for Empirical Distribution for RandomVariate[dist]

Sample as follow Wolfram document.

data={3,9,3,6,0,0,5,1,3,9,7,8,3,5,3,2};

FindDistributionParameters[data,NormalDistribution[a,b]]

Map[BlockRandom[SeedRandom[1, Method -> #];

RandomVariate[NormalDistribution[a,b]]] &, {"Congruential", "ExtendedCA", "Legacy",
"MersenneTwister", "MKL", "Rule30CA"}]

It is ok. But for Empirical. it can not use. It can't work with Map of {"Congruential", "ExtendedCA", "Legacy","MersenneTwister", "MKL", "Rule30CA"}

It works only with

data={3,9,3,6,0,0,5,1,3,9,7,8,3,5,3,2};

dist = EmpiricalDistribution[data]

SeedRandom[7, Method -> ExtendedCA]

RandomVariate[dist] 

I must change ExtendedCA to Legacy and to MersenneTwister. only one. It can't work with Map like a NormalDist or other.

Who know Map of random seed can work with Empirical Dist?

Thank you.

Decha

2 Replies
Posted 1 month ago

Documentation for SeedRandom mentions 6 "typical" random generators: Congruential, ExtendedCA, Legacy, MersenneTwister, MKL and Rule30CA.

The first, Congruential, does not seem to work well with RandomVariate[EmpiricalDistribution[data]]. In fact the kernel dies during evaluation.

But the last 5 works:

data = {3, 9, 3, 6, 0, 0, 5, 1, 3, 9, 7, 8, 3, 5, 3, 2};

In[2]:= Table[SeedRandom[1, Method -> k]; RandomVariate[EmpiricalDistribution[data]], 
             {k, {"ExtendedCA", "Legacy", "MersenneTwister", "MKL", "Rule30CA"}}
        ]

Out[2]= {8, 5, 3, 8, 3}

In another form, using Map:

In[3]:= Map[(SeedRandom[1, Method -> #]; RandomVariate[EmpiricalDistribution[data]]) &,
            {"ExtendedCA", "Legacy", "MersenneTwister", "MKL", "Rule30CA"}
        ]

Out[3]= {8, 5, 3, 8, 3}
Posted 1 month ago

It work.
Very thank you Decha

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract