Actuarial Outpost
 
Go Back   Actuarial Outpost > Actuarial Discussion Forum > Software & Technology
FlashChat Actuarial Discussion Preliminary Exams CAS/SOA Exams Cyberchat Around the World Suggestions

DW Simpson International Actuarial Jobs
Canada  Asia  Australia  Bermuda  Latin America  Europe


Reply
 
Thread Tools Display Modes
  #41  
Old 07-17-2009, 11:53 AM
Guilty Bystander Guilty Bystander is offline
Member
SOA AAA
 
Join Date: Jun 2005
College: Meeeshigan
Favorite beer: Bell's Two Hearted IPA & New Holland's Dragon's Milk
Posts: 1,752
Default

You can find some Mersenne Twister information and code from this website...the usual caveats certainly apply. It's part of Makoto Matsumoto's homepage (he is one of the developers of the MT).

http://www.math.sci.hiroshima-u.ac.j...at/MT/emt.html
Reply With Quote
  #42  
Old 07-17-2009, 12:18 PM
MountainHawk's Avatar
MountainHawk MountainHawk is offline
Member
CAS AAA
 
Join Date: Dec 2001
Location: Salem, MA
Studying for Nothing!!!!
College: Lehigh University Alum
Favorite beer: Yuengling
Posts: 63,117
Default

So, you do your own testing of RNG? I use @Risk, and just sort of accepted that the RNG they use is 'random' enough. The current version uses the Mersenne Twister as a default (with 7 other options available), plus a stratified sampling technique if you want called Latin Hypercube, which I've never looked into other than to know it's a stratified sampling technique.
__________________


"I am a most unhappy man. I have unwittingly ruined my country. A great industrial nation is now controlled by its system of credit. We are no longer a government by free opinion, no longer a government by conviction and the vote of the majority, but a government by the opinion and duress of a small group of dominant men." -- Woodrow Wilson

It doesn't matter who you vote for, the government always gets in. -- Elizabeth May

???? Jan 20: Freedom for the Bill of Rights

1 2
Reply With Quote
  #43  
Old 07-17-2009, 12:20 PM
campbell's Avatar
campbell campbell is offline
Mary Pat Campbell
SOA AAA
 
Join Date: Nov 2003
Location: NY
Studying for duolingo and coursera
Favorite beer: Murphy's Irish Stout
Posts: 76,792
Blog Entries: 6
Default

Here is a free implementation of Mersenne Twister for Excel. This is my favorite PRNG [currently]:

http://www.numtech.com/documents/res...re-numeric.php
Reply With Quote
  #44  
Old 07-17-2009, 12:22 PM
campbell's Avatar
campbell campbell is offline
Mary Pat Campbell
SOA AAA
 
Join Date: Nov 2003
Location: NY
Studying for duolingo and coursera
Favorite beer: Murphy's Irish Stout
Posts: 76,792
Blog Entries: 6
Default

NIST resources on testing a PRNG:
http://csrc.nist.gov/groups/ST/toolkit/rng/index.html


Another suite of PRNG tests:
http://www.phy.duke.edu/~rgb/General/dieharder.php
Reply With Quote
  #45  
Old 07-17-2009, 03:48 PM
KRWarner KRWarner is offline
Member
 
Join Date: Oct 2005
Posts: 76
Default

I think I am about to wade into something well beyond my pay grade.

I will start by saying that in the simulations that I have created, I use Excel, VB and seed the rnd/random funtions in VB. I do this so that I have the same randoms to see what the changes in assumptions caused in the results and not worry that is was due to a change in the randoms.

I find it somewhat amusing about auditors who check to see if random numbers fit a pattern. In the end don't you need a random number generator that is sufficiantly random for the number of simulations that you are running. For instance, one poster mentioned random numbers that don't repete for 1 trillion randoms. Wouldn't within that series of randoms there be groups of numbers that are not distributed randomly. So if it is random over 1 trillion, it might not be random over a 1 milllion subset. There must be one of the one million, one milllions that would not fit the pattern the auditors want.
__________________
I'm not an actuary, but I play one on TV.
Reply With Quote
  #46  
Old 07-17-2009, 04:11 PM
campbell's Avatar
campbell campbell is offline
Mary Pat Campbell
SOA AAA
 
Join Date: Nov 2003
Location: NY
Studying for duolingo and coursera
Favorite beer: Murphy's Irish Stout
Posts: 76,792
Blog Entries: 6
Default

Quote:
Originally Posted by KRWarner View Post
I find it somewhat amusing about auditors who check to see if random numbers fit a pattern. In the end don't you need a random number generator that is sufficiantly random for the number of simulations that you are running. For instance, one poster mentioned random numbers that don't repete for 1 trillion randoms. Wouldn't within that series of randoms there be groups of numbers that are not distributed randomly. So if it is random over 1 trillion, it might not be random over a 1 milllion subset. There must be one of the one million, one milllions that would not fit the pattern the auditors want.
Thing is, if you're not specific about what constitutes a pattern before you look at a sequence, you are almost definitely going to find something that you will consider a pattern, even if the sequence were perfectly "random". A rough search yields this: http://www.fourmilab.ch/rpkp/experim...tatistics.html -- search on "999999"

For the randomness tests mentioned in my above links, you need to produce a lot of numbers to test the PRNG. It's not just a matter of the numbers being uniformly distributed, there are other things [such as doubles, triples, etc. having the right distributions].
Reply With Quote
  #47  
Old 07-17-2009, 06:53 PM
ultrafilter ultrafilter is offline
Member
 
Join Date: Nov 2006
Posts: 366
Default

Quote:
Originally Posted by Dr T Non-Fan View Post
Question: is RAND() random? Meaning, can you create a program that predicts the next number it will create?
RAND() is not random, and its output can be predicted. The fundamental issue with generating random numbers on a computer is that software is deterministic--if you run a program multiple times with the same inputs*, you'll get the same outputs every time. Whether this is a problem or not depends on how hard to predict your sequence needs to be. For most purposes, something like a Mersenne Twister implementation is fine--that's much harder to learn than something like RAND() (at least as far as we know)--but if you need something that absolutely can't be predicted, you're looking at buying specialized hardware**.


*: For purposes of this discussion, let's ignore issues of statefulness and assume that everything the program uses to compute its output is part of the current input.
**: The major CPU manufacturers have discussed including random number generators in future chipsets, but so far as I know, no one has concrete plans to do so.
Reply With Quote
  #48  
Old 07-17-2009, 06:57 PM
campbell's Avatar
campbell campbell is offline
Mary Pat Campbell
SOA AAA
 
Join Date: Nov 2003
Location: NY
Studying for duolingo and coursera
Favorite beer: Murphy's Irish Stout
Posts: 76,792
Blog Entries: 6
Default

Remember, there are multiple purposes for uses of PRNGs.

For Monte Carlo [trying to estimate an integral, generate a probability distribution/histogram, what-have-you] determinism/predictability is not necessarily a bad thing.

For cryptography, determinism/predictability is dangerous, which is why MT is not considered cryptographically sound.

Last edited by campbell; 07-17-2009 at 06:57 PM.. Reason: why am I using weasel words?
Reply With Quote
  #49  
Old 07-17-2009, 09:53 PM
Brad Gile's Avatar
Brad Gile Brad Gile is offline
Member
CAS SOA AAA
 
Join Date: Sep 2001
Studying for whatever I feel like
College: Alumnus of Brown and UW-Madison
Posts: 11,341
Default

Quote:
Originally Posted by campbell View Post
Remember, there are multiple purposes for uses of PRNGs.

For Monte Carlo [trying to estimate an integral, generate a probability distribution/histogram, what-have-you] determinism/predictability is not necessarily a bad thing.

For cryptography, determinism/predictability is dangerous, which is why MT is not considered cryptographically sound.

That is a superb concise statement on this subject. It basically boils down to this, IMO.
If you are just doing Monte Carlo, you can do a practical test of your PRNG by using it on problems that are similar to what you are working with but have known exact solutions and see how well your simulation does.

Example: Try the Birthday Problem using simulations on various sample sizes and compare to the exact results. How well does RAND() work? VBA Rnd? Something else?
__________________
Brad Gile, FSA, MAAA
Affiliate Member of the CAS
Dedicated Retired Actuary

Spoiler:
Obama sucks and we all know it-TDA


Spoiler:

That's been the funniest subplot of this whole thing, the people on the left attacking this bill for not being even more of a steaming pile. - erosewater
Reply With Quote
  #50  
Old 07-17-2009, 11:32 PM
Get Busy Livin''s Avatar
Get Busy Livin' Get Busy Livin' is offline
Member
SOA
 
Join Date: Jan 2008
Favorite beer: Bottle of suds
Posts: 1,202
Default

Quote:
Originally Posted by KRWarner View Post
For instance, one poster mentioned random numbers that don't repete for 1 trillion randoms. Wouldn't within that series of randoms there be groups of numbers that are not distributed randomly. So if it is random over 1 trillion, it might not be random over a 1 milllion subset. There must be one of the one million, one milllions that would not fit the pattern the auditors want.
Spoilered for Dilbert:
Spoiler:


Reply With Quote
Reply

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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT -4. The time now is 10:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
*PLEASE NOTE: Posts are not checked for accuracy, and do not
represent the views of the Actuarial Outpost or its sponsors.
Page generated in 0.37304 seconds with 9 queries