{"id":4079,"date":"2017-06-30T12:58:22","date_gmt":"2017-06-30T17:58:22","guid":{"rendered":"http:\/\/hoolihan.net\/blog-tim\/?p=4079"},"modified":"2017-06-30T12:58:22","modified_gmt":"2017-06-30T17:58:22","slug":"markov-chain-simulation","status":"publish","type":"post","link":"http:\/\/hoolihan.net\/blog-tim\/2017\/06\/30\/markov-chain-simulation\/","title":{"rendered":"Markov Chain Simulation"},"content":{"rendered":"<p>I&#8217;ve been reading up on Markov chains and related concepts. On the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Markov_chain\" target=\"_blank\">wikipedia page there is an example of a 2 state<\/a> Markov process. I decided to simulate it in R and plot the mean of the means. <\/p>\n<p>Quick Code example here: <\/p>\n<script src=\"https:\/\/gist.github.com\/fd426c226bfbd07ffbc52a151b856bc5.js\"><\/script>\n<p><a href=\"http:\/\/hoolihan.net\/blog-tim\/wp-content\/uploads\/2017\/06\/mc.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hoolihan.net\/blog-tim\/wp-content\/uploads\/2017\/06\/mc.png\" alt=\"\" width=\"500\" height=\"283\" class=\"alignnone size-full wp-image-4082\" srcset=\"http:\/\/hoolihan.net\/blog-tim\/wp-content\/uploads\/2017\/06\/mc.png 500w, http:\/\/hoolihan.net\/blog-tim\/wp-content\/uploads\/2017\/06\/mc-300x170.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>The mean of means (of state e) is close to .36. If you take .3 * .36 + .4 * (1-.36), you get .364, so this seems to make sense. Note that I&#8217;m weighting the switching to e percentage based on the percentage of being in that state in the first place. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been reading up on Markov chains and related concepts. On the wikipedia page there is an example of a 2 state Markov process. I decided to simulate it in R and plot the mean of the means. Quick Code example here: The mean of means (of state e) is close to .36. If you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[286,267,316],"tags":[313,324,325,278,317],"class_list":["post-4079","post","type-post","status-publish","format-standard","hentry","category-math","category-r","category-simulation","tag-ggplot2","tag-markov-chain","tag-monte-carlo","tag-r","tag-simulation"],"_links":{"self":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/posts\/4079","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/comments?post=4079"}],"version-history":[{"count":0,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/posts\/4079\/revisions"}],"wp:attachment":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/media?parent=4079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/categories?post=4079"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/tags?post=4079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}