{"id":417,"date":"2015-01-05T19:54:49","date_gmt":"2015-01-05T19:54:49","guid":{"rendered":"http:\/\/frees.pajarel.net\/?page_id=417"},"modified":"2015-02-20T19:04:16","modified_gmt":"2015-02-21T01:04:16","slug":"4-1-generating-independent-uniform-observations","status":"publish","type":"page","link":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/actuarial-mathematics\/interest-rate-risks-and-simulation\/4-simulation\/4-1-generating-independent-uniform-observations\/","title":{"rendered":"4.1 Generating Independent Uniform Observations"},"content":{"rendered":"<p>We begin with a historically prominent method.<\/p>\n<p><strong>Linear Congruential Generator. <\/strong>To generate a sequence of random numbers, start with \\(B_0\\), a starting value that is known as a &#8220;seed.&#8221; Update it using the recursive relationship<br \/>\n\\[<br \/>\nB_{n+1} = a B_n + c \\text{ modulo }m, ~~ n=0, 1, 2, \\ldots .<br \/>\n\\]<br \/>\nThis algorithm is called a <em>linear congruential generator<\/em>. The case of \\(c=0\\) is called a <em>multiplicative<\/em> congruential generator; it is particularly useful for really fast computations.<\/p>\n<p>For illustrative values of \\(a\\) and \\(m\\), Microsoft&#8217;s Visual Basic uses \\(m=2^{24}\\), \\(a=1,140,671,485\\), and \\(c = 12,820,163\\) (see http:\/\/support.microsoft.com\/kb\/231847). This is the engine underlying the random number generation in Microsoft&#8217;s Excel program.<\/p>\n<p>The sequence used by the analyst is defined as \\(U_n=B_n\/m.\\) The analyst may interpret the sequence {\\(U_{i}\\)} to be (approximately) identically and independently uniformly distributed on the interval (0,1). To illustrate the algorithm, consider the following.<\/p>\n<p>Example. Take \\(m=15\\), \\(a=3\\), \\(c=2\\) and \\(B_0=1\\). Then we have:<\/p>\n<table>\n<tr>\n<th>step \\(n\\)<\/th>\n<th>\\(B_n\\)<\/th>\n<th>\\(U_n\\)<\/th>\n<\/tr>\n<tr>\n<td>0<\/td>\n<td>\\(B_0=1\\)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>\\(B_1 =\\mod(3 \\times 1 +2) = 5\\)<\/td>\n<td>\\(U_1 = \\frac{5}{15}\\)<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>\\(B_2 =\\mod(3 \\times 5 +2) = 2\\)<\/td>\n<td>\\(U_2 = \\frac{2}{15}\\)<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>\\(B_3 =\\mod(3 \\times 2 +2) = 8\\)<\/td>\n<td>\\(U_3 = \\frac{8}{15}\\)<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>\\(B_4 =\\mod(3 \\times 8 +2) = 11\\)<\/td>\n<td>\\(U_4 = \\frac{11}{15}\\)<\/td>\n<\/tr>\n<\/table>\n<p>Sometimes computer generated random results are known as <em>pseudo<\/em>-random numbers to reflect the fact that they are machine generated and can be replicated. That is, despite the fact that {\\(U_i\\)} appears to be i.i.d, it can be reproduced by using the same seed number (and the same algorithm). The ability to replicate results can be a tremendous tool as you use simulation while trying to uncover patterns in a business process.<\/p>\n<p>The linear congruential generator is just one method of producing pseudo-random outcomes. It is easy to understand and is (still) widely used. The linear congruential generator does have limitations, including the fact that it is possible to detect long-run patterns over time in the sequences generated (recall that we can interpret &#8220;independence&#8221; to mean a total lack of functional patterns). Not surprisingly, advanced techniques have been developed that address some of this method&#8217;s drawbacks.<\/p>\n<p><div class=\"alignleft\"><a href=\"https:\/\/users.ssc.wisc.edu\/~ewfrees\/actuarial-mathematics\/interest-rate-risks-and-simulation\/4-simulation\/\" title=\"4. Simulation\">&#9668 Previous page<\/a><\/div><div class=\"alignright\"><a href=\"https:\/\/users.ssc.wisc.edu\/~ewfrees\/actuarial-mathematics\/interest-rate-risks-and-simulation\/4-simulation\/4-2-inverse-transform-image-inversedf-needed\/\" title=\"4.2 Inverse Transform\">Next page &#9658<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We begin with a historically prominent method. Linear Congruential Generator. To generate a sequence of random numbers, start with \\(B_0\\), a starting value that is known as a &#8220;seed.&#8221; Update it using the recursive relationship &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":415,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"jetpack_post_was_ever_published":false},"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/P8cLPd-6J","acf":[],"_links":{"self":[{"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/pages\/417"}],"collection":[{"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/comments?post=417"}],"version-history":[{"count":3,"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/pages\/417\/revisions"}],"predecessor-version":[{"id":827,"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/pages\/417\/revisions\/827"}],"up":[{"embeddable":true,"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/pages\/415"}],"wp:attachment":[{"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/media?parent=417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}