{"id":219,"date":"2020-04-19T14:12:47","date_gmt":"2020-04-19T14:12:47","guid":{"rendered":"http:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/?p=219"},"modified":"2021-11-08T10:30:15","modified_gmt":"2021-11-08T10:30:15","slug":"60-second-stats-monte-carlo-simulation","status":"publish","type":"post","link":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/2020\/04\/19\/60-second-stats-monte-carlo-simulation\/","title":{"rendered":"60 second stats &#8211; Monte Carlo Simulation"},"content":{"rendered":"\n<p>So, the plan for this post was to look at <a href=\"https:\/\/arxiv.org\/abs\/1708.03625\">a paper which details a method to make unbiased estimation from Monte Carlo Markov chains<\/a>. However, in doing that I realised that:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>In order to understand the paper and why it&#8217;s important, the reader (i.e. you) need to first understand what a Monte Carlo approximation is&#8230; which would be fine, except that;<\/li><li>The only real way I could fit that into the post would be to embed a YouTube video describing it into the start of the post&#8230; which would be fine, except that;<\/li><li>Pretty much all the YouTube videos on this are really boring.<\/li><\/ol>\n\n\n\n<p>Therefore, I thought the best thing to do would be go back to basics, and try and give a quick explanation of Monte Carlo Estimation myself. And what better way to give a quick overview is there than another edition of 60 second stats?<\/p>\n\n\n\n<p>So get out the stopwatch, and get ready. The 60 seconds begins&#8230;NOW!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is Monte Carlo Estimation?<\/h2>\n\n\n\n<p>Monte Carlo Estimation is a technique used to estimate quantities. It is based around simulating a bunch of random numbers, and then using these to make estimates.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why is it called &#8220;Monte Carlo&#8221;?<\/h2>\n\n\n\n<p>It is named after the Monte Carlo Casino, in Monaco, which was frequented by the uncle of Stanislaw Ulam, one the methods founders. It is also a reference to the inherent randomness of the method (as all casino games are based on chance).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-content\/uploads\/sites\/8\/2020\/04\/Real_Monte_Carlo_Casino-1024x683.jpg\" alt=\"\" class=\"wp-image-243\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-content\/uploads\/sites\/8\/2020\/04\/Real_Monte_Carlo_Casino-1024x683.jpg 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-content\/uploads\/sites\/8\/2020\/04\/Real_Monte_Carlo_Casino-300x200.jpg 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-content\/uploads\/sites\/8\/2020\/04\/Real_Monte_Carlo_Casino-768x512.jpg 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-content\/uploads\/sites\/8\/2020\/04\/Real_Monte_Carlo_Casino-1536x1024.jpg 1536w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-content\/uploads\/sites\/8\/2020\/04\/Real_Monte_Carlo_Casino-2048x1366.jpg 2048w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-content\/uploads\/sites\/8\/2020\/04\/Real_Monte_Carlo_Casino-1600x1067.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Some beautiful architecture that just screams &#8220;computational statistics&#8221;.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Ok. So how does it work?<\/h2>\n\n\n\n<p>The overall idea is very simple. Say you have a random variable <em>X<\/em>, and you want to estimate some value related to <em>X<\/em> (e.g. it&#8217;s average). You can then simply simulate a large number of <strong>realisations<\/strong> (i.e. copies) of <em>X<\/em>, and take the average of these. Then (because of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Law_of_large_numbers\">law of large numbers<\/a>) we know that the average of our copies will be a &#8220;good&#8221; estimation of <em>X<\/em>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Wait, what do you mean by &#8220;good&#8221;?<\/h2>\n\n\n\n<p>What we mean by &#8220;good&#8221; is that as you take more and more realisations of <em>X<\/em> to average, the average will get closer and closer to the true value, as shown in the gif below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"480\" height=\"480\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-content\/uploads\/sites\/8\/2020\/04\/60SSMC.gif\" alt=\"\" class=\"wp-image-245\" \/><\/figure>\n\n\n\n<p>The gif clearly shows that the more copies, the closer to the true value we get.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Alright. So how do I do it myself?<\/h2>\n\n\n\n<p>It&#8217;s easy! All you need is:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>A method\/program\/algorithm to simulate copies of your random variable<\/li><li>Enough computational power\/storage to simulate and store many copies of this variable (the more the better)<\/li><\/ol>\n\n\n\n<p>&#8230;and that&#8217;s time! Thanks for participating in another edition of 60 second stats. If you want to know more, there are many further aspects to this, such as known results about the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Central_limit_theorem\">variance of your estimates<\/a>, or what to do if you <a href=\"https:\/\/en.wikipedia.org\/wiki\/Markov_chain_Monte_Carlo\">can&#8217;t easily simulate copies of your random variable<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, the plan for this post was to look at a paper which details a method to make unbiased estimation&hellip;<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[13,5],"class_list":["post-219","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-60-second-stats","tag-statistics"],"_links":{"self":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/posts\/219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/comments?post=219"}],"version-history":[{"count":18,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/posts\/219\/revisions"}],"predecessor-version":[{"id":290,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/posts\/219\/revisions\/290"}],"wp:attachment":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/media?parent=219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/categories?post=219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/hamish-thorburn\/wp-json\/wp\/v2\/tags?post=219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}