{"id":2420,"date":"2022-05-09T04:34:42","date_gmt":"2022-05-09T04:34:42","guid":{"rendered":"http:\/\/optimumsportsperformance.com\/blog\/?p=2420"},"modified":"2022-05-09T12:49:40","modified_gmt":"2022-05-09T12:49:40","slug":"tidyx-episode-103-gibbs-sampling","status":"publish","type":"post","link":"https:\/\/optimumsportsperformance.com\/blog\/tidyx-episode-103-gibbs-sampling\/","title":{"rendered":"TidyX Episode 103: GIBBS Sampling"},"content":{"rendered":"<p>This week <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/twitter.com\/ellis_hughes\">Ellis Hughes<\/a><\/span><\/strong> and I wrap up our Intro to Bayesian Analysis series. Up to this point we&#8217;ve been talking about conjugate priors for the <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/optimumsportsperformance.com\/blog\/tidyx-episode-100-beta-conjugate\/\">binomial distribution<\/a><\/span><\/strong>, <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/optimumsportsperformance.com\/blog\/tidyx-episode-101-gamma-poisson-conjugate\/\">poisson distribution<\/a><\/span><\/strong>, and <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/optimumsportsperformance.com\/blog\/tidyx-episode-102-normal-normal-conjugate\/\">normal distribution<\/a><\/span><\/strong>.<\/p>\n<p>Unfortunately, when using the normal-normal conjugate you need to assume that one of the two distribution parameters (mean or standard deviation) are known and then estimate the other parameter. For example, last episode we assumed the standard deviation was known, allowing us to estimate the mean. This is a problem in situations where you don&#8217;t always know what the standard deviation is and, therefore, need to estimate both parameters. For this, we turn to GIBBS sampling. A GIBBS sampler is a Markov Chain Monte Carlo (MCMC) approach to Bayesian inference.<\/p>\n<p>In this episode we will walk through building your own GIBBS sampler, calculating posterior summary statistics, and plotting the posterior samples and trace plots. We wrap up by showing how to use the <strong>normpostsim()<\/strong> function from Jim Albert&#8217;s <strong>{LearnBayes}<\/strong> package, for instances where you don&#8217;t want to code up your own GIBBS sampler.<\/p>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-08-at-9.34.12-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2421\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-08-at-9.34.12-PM-1024x688.png\" alt=\"\" width=\"625\" height=\"420\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-08-at-9.34.12-PM-1024x688.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-08-at-9.34.12-PM-300x202.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-08-at-9.34.12-PM-768x516.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-08-at-9.34.12-PM-624x419.png 624w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-08-at-9.34.12-PM.png 1938w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>To watch our screen cast, <span style=\"color: #0000ff;\"><strong><a style=\"color: #0000ff;\" href=\"https:\/\/www.youtube.com\/watch?v=_nWRUnmpn3o\">CLICK HERE<\/a><\/strong><\/span>.<\/p>\n<p>To access the code, <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/github.com\/thebioengineer\/TidyX\/tree\/master\/TidyTuesday_Explained\/103-Simulating_Data-Applying_Bayes-Gibbs_Sampler\">CLICK HERE<\/a><\/span><\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week Ellis Hughes and I wrap up our Intro to Bayesian Analysis series. Up to this point we&#8217;ve been talking about conjugate priors for the binomial distribution, poisson distribution, and normal distribution. Unfortunately, when using the normal-normal conjugate you need to assume that one of the two distribution parameters (mean or standard deviation) are [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[],"class_list":["post-2420","post","type-post","status-publish","format-standard","hentry","category-tidyx-screen-cast"],"_links":{"self":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/2420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/comments?post=2420"}],"version-history":[{"count":5,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/2420\/revisions"}],"predecessor-version":[{"id":2426,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/2420\/revisions\/2426"}],"wp:attachment":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/media?parent=2420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/categories?post=2420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/tags?post=2420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}