Actuarial Outpost Pseudorandom number generation in Excel
 Register Blogs Wiki FAQ Calendar Search Today's Posts Mark Forums Read
 FlashChat Actuarial Discussion Preliminary Exams CAS/SOA Exams Cyberchat Around the World Suggestions

 Enter your email to subscribe to DW Simpson weekly actuarial job updates. li.signup { display: block; text-align: center; text-size: .8; padding: 0px; margin: 8px; float: left; } Entry Level Casualty Health Life Pension All Jobs

#31
07-17-2009, 12:45 AM
 atomic Member CAS Join Date: Jul 2006 Posts: 4,088

Quote:
 Originally Posted by Actuarialsuck I may be completely off base here but couldn't you use strange attractors to generate random numbers? I think I recall someone talking about that in college but I could be just making it up... atomic to the rescue?
Certain chaotic dynamical systems have the appearance of randomness, but chaos is not necessarily a good criterion for choosing pseudorandom numbers. The reason is that these systems can exhibit global structure within the apparent randomness. Chaos in dynamical systems is characterized by "sensitive dependence on initial conditions" (a.k.a. the "butterfly effect"). But that is not a sufficient condition for statistical randomness.

For example, I read E. N. Lorenz's original paper "Deterministic Nonperiodic Flow" back in college and one of the diagrams that struck me was one in which he plotted something like the successive local maxima of the Lorenz equations. This was a long time ago so I can't remember the exact thing he plotted, but it formed a very nice smooth inverted "v" curve with a sharp cusp in the center. That is anything but random behavior--it is order hidden within chaos.

It stands to reason therefore, that the choice of chaotic dynamical system for a PRNG would need to undergo rigorous statistical analysis before it could be used as such, because it is not readily obvious whether such a system could yield some underlying order if you looked at its behavior in some very specific fashion.

Finally, I also want to point out that the implementation of strange attractors in programming code is not necessarily more efficient compared to existing PRNGs based on, say, cellular automata (this is the method used by Mathematica).
__________________
Spoiler:
"No, Moslems don't believe Jesus was the messiah.

Think of it like a movie. The Torah is the first one, and the New Testament is the sequel. Then the Qu'ran comes out, and it retcons the last one like it never happened. There's still Jesus, but he's not the main character anymore, and the messiah hasn't shown up yet.

Jews like the first movie but ignored the sequels, Christians think you need to watch the first two, but the third movie doesn't count, Moslems think the third one was the best, and Mormons liked the second one so much they started writing fanfiction that doesn't fit with ANY of the series canon."

-RandomFerret
#32
07-17-2009, 12:47 AM
 Actuarialsuck Member Join Date: Sep 2007 Posts: 6,108

Hmm that's very interesting, I was referring to somehow linking in the randomness as to how many loops you make around each node of the attractors if that makes any sense.
__________________
Quote:
 Originally Posted by Buru Buru i'm not. i do not troll.
#33
07-17-2009, 07:24 AM
 JMO Carol Marler Non-Actuary Join Date: Sep 2001 Location: Back home again in Indiana Studying for Nothing actuarial. Posts: 37,084

Quote:
 Originally Posted by ADoubleDot Is this as dumb as I think it is? I keep reading it trying to decipher how that solves anything.
Yes it is. It has been mentioned in the past that MS often makes it clear that they don't use Excel for any serious work. This is just one more clue along that line.
__________________
Carol Marler, "Just My Opinion"

Pluto is no longer a planet and I am no longer an actuary. Please take my opinions as non-actuarial.

My latest favorite quotes, updated Apr 5, 2018.

Spoiler:
I should keep these four permanently.
Quote:
 Originally Posted by rekrap JMO is right
Quote:
 Originally Posted by campbell I agree with JMO.
Quote:
 Originally Posted by Westley And def agree w/ JMO.
Quote:
 Originally Posted by MG This. And everything else JMO wrote.
And this all purpose permanent quote:
Quote:
 Originally Posted by Dr T Non-Fan Yup, it is always someone else's fault.
MORE:
All purpose response for careers forum:
Quote:
 Originally Posted by DoctorNo Depends upon the employer and the situation.
Quote:
 Originally Posted by Sredni Vashtar I feel like ERM is 90% buzzwords, and that the underlying agenda is to make sure at least one of your Corporate Officers is not dumb.
#34
07-17-2009, 07:27 AM
 JMO Carol Marler Non-Actuary Join Date: Sep 2001 Location: Back home again in Indiana Studying for Nothing actuarial. Posts: 37,084

Quote:
 Originally Posted by magillaG One also has to be very careful about running out of randomness. I had a colleague who spent some number of weeks trying to debug a monte carlo simulation, only to eventually find out the randon number generator wasn't "big" enough for the number of simulations. It was starting to create patterns, which was screwing up the distributions of the results, or something like that. I don't know how good the excel rand is in this respect- probably if you are doing something in excel, you don't have so many experiments to worry about it.
Your last sentence is exactly what this thread is discussing - for doing Monte Carlo analysis, Excel's Rand() function is far from adequate.
__________________
Carol Marler, "Just My Opinion"

Pluto is no longer a planet and I am no longer an actuary. Please take my opinions as non-actuarial.

My latest favorite quotes, updated Apr 5, 2018.

Spoiler:
I should keep these four permanently.
Quote:
 Originally Posted by rekrap JMO is right
Quote:
 Originally Posted by campbell I agree with JMO.
Quote:
 Originally Posted by Westley And def agree w/ JMO.
Quote:
 Originally Posted by MG This. And everything else JMO wrote.
And this all purpose permanent quote:
Quote:
 Originally Posted by Dr T Non-Fan Yup, it is always someone else's fault.
MORE:
All purpose response for careers forum:
Quote:
 Originally Posted by DoctorNo Depends upon the employer and the situation.
Quote:
 Originally Posted by Sredni Vashtar I feel like ERM is 90% buzzwords, and that the underlying agenda is to make sure at least one of your Corporate Officers is not dumb.
#35
07-17-2009, 07:35 AM
 JMO Carol Marler Non-Actuary Join Date: Sep 2001 Location: Back home again in Indiana Studying for Nothing actuarial. Posts: 37,084

Quote:
 Originally Posted by campbell I've been thinking of writing something up on floating point computation issues for CompAct, or maybe even one of the more technical actuarial journals.
Please do it. This was one of the things that I believe every actuary should know!

__________________
Carol Marler, "Just My Opinion"

Pluto is no longer a planet and I am no longer an actuary. Please take my opinions as non-actuarial.

My latest favorite quotes, updated Apr 5, 2018.

Spoiler:
I should keep these four permanently.
Quote:
 Originally Posted by rekrap JMO is right
Quote:
 Originally Posted by campbell I agree with JMO.
Quote:
 Originally Posted by Westley And def agree w/ JMO.
Quote:
 Originally Posted by MG This. And everything else JMO wrote.
And this all purpose permanent quote:
Quote:
 Originally Posted by Dr T Non-Fan Yup, it is always someone else's fault.
MORE:
All purpose response for careers forum:
Quote:
 Originally Posted by DoctorNo Depends upon the employer and the situation.
Quote:
 Originally Posted by Sredni Vashtar I feel like ERM is 90% buzzwords, and that the underlying agenda is to make sure at least one of your Corporate Officers is not dumb.
#36
07-17-2009, 10:19 AM
 echo Member Join Date: Nov 2002 Posts: 840

Quote:
 Originally Posted by campbell No, it's not Mersenne Twister. [Not the one incorporated in the C3 Phase III interest rate scenario generator. I'm currently working on it with ESIWG.....which is the sequel to ESWG.]
Thanks for the clarification. I see that in the comments it says it is not MT.
#37
07-17-2009, 10:24 AM
 E Eddie Smith SOA AAA Join Date: May 2003 College: UGA Posts: 8,990

This is the kind of thread that really belongs in an actuarial wiki.
__________________

Learn how FSA exams are different from the prelims

LP | LFV-U | LFV-C | LRM | ERM | QFI Core | QFI Adv | QFI IRM | G&H Core | G&H Adv | G&H Sp

Check out our Technical Skills Course and our new R Course!

#38
07-17-2009, 10:45 AM
 campbell Mary Pat Campbell SOA AAA Join Date: Nov 2003 Location: NY Studying for duolingo and coursera Favorite beer: Murphy's Irish Stout Posts: 82,048 Blog Entries: 6

Quote:
 Originally Posted by E This is the kind of thread that really belongs in an actuarial wiki.
Later, later.

Just a few comments on other random digit sources:
Of course the strange attractors from nonlinear dynamical systems [those "chaotic" sequences] are just as deterministic as a regular linear congruential PRNG. [Using radioactive decay of particles is a nifty random digit generation technique, though one still needs to check the stats on the sequence.... gotta make sure God ain't throwing loaded dice. ]

The reason that the linear congruential PRNGs are popular is that they're easy to code, and one knows the repeat cycle and distribution of numbers over that repeat [which covers all possible integers in the cycle] due to number theory. For any given nonlinear dynamic system, it's unlikely you're going to get a uniform distribution, but that's okay as long as you know what the distribution is... then you can "undo" it to force it into a uniform or whatever other distribution you desire.
__________________
It's STUMP

#39
07-17-2009, 11:37 AM
 E Eddie Smith SOA AAA Join Date: May 2003 College: UGA Posts: 8,990

Quote:
 Originally Posted by campbell Later, later.
And of course that was meant as a compliment.
__________________

Learn how FSA exams are different from the prelims

LP | LFV-U | LFV-C | LRM | ERM | QFI Core | QFI Adv | QFI IRM | G&H Core | G&H Adv | G&H Sp

Check out our Technical Skills Course and our new R Course!

#40
07-17-2009, 11:42 AM
 campbell Mary Pat Campbell SOA AAA Join Date: Nov 2003 Location: NY Studying for duolingo and coursera Favorite beer: Murphy's Irish Stout Posts: 82,048 Blog Entries: 6

Quote:
 Originally Posted by campbell The reason that the linear congruential PRNGs are popular is that they're easy to code, and one knows the repeat cycle and distribution of numbers over that repeat [which covers all possible integers in the cycle] due to number theory. For any given nonlinear dynamic system, it's unlikely you're going to get a uniform distribution, but that's okay as long as you know what the distribution is... then you can "undo" it to force it into a uniform or whatever other distribution you desire.
Whups, and I meant to say that for some of these strange attractors, a closed form for the resulting distribution doesn't exist [not always true, just sometimes], so then you'd have to use some sort of histogram results to "undo" the transform.... and that causes practical problems and any benefit from using said strange attractors is now gone. To use the strange attractors over the standard PRNGs, you need to show that they're better in some way - such as you get the same sort of stats on the results, but require fewer computations, or there are certain tests they satisfy that aren't satisfied by the regular PRNGs.
__________________
It's STUMP

 Tags data science, excel, predictive analytics, prngs, pseudorandom numbers, rand, random