{"id":1970,"date":"2021-03-01T14:02:14","date_gmt":"2021-03-01T14:02:14","guid":{"rendered":"http:\/\/optimumsportsperformance.com\/blog\/?p=1970"},"modified":"2021-03-01T14:02:14","modified_gmt":"2021-03-01T14:02:14","slug":"tidyx-episode-50-james-stein-estimator-for-mlb-batting-averages","status":"publish","type":"post","link":"https:\/\/optimumsportsperformance.com\/blog\/tidyx-episode-50-james-stein-estimator-for-mlb-batting-averages\/","title":{"rendered":"TidyX Episode 50: James-Stein Estimator for MLB Batting Averages"},"content":{"rendered":"<p><em><strong>We made it! 50 episodes in one year!<\/strong> <\/em><\/p>\n<p>To celebrate, <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/twitter.com\/ellis_hughes\">Ellis Hughes<\/a><\/span><\/strong> and I take the baseball data we used in <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/optimumsportsperformance.com\/blog\/tidyx-49-rowwise-simulation-of-mlb-batting-average-gt-table-sparklines\/\">Episode 49<\/a><\/span><\/strong> and build a <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/www.jstor.org\/stable\/24954030?seq=1\">James-Stein Estimator<\/a><\/span><\/strong> to attempt to estimate a hitter&#8217;s true batting average given some number of observations (at bats).<\/p>\n<p>After building estimates for the players we show how you can combine <strong>{gt}<\/strong> tables with <strong>{ggplot2}<\/strong> figures in <strong>{patchwork}<\/strong> to produce a figure like this:<\/p>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-01-at-5.59.16-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-1971\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-01-at-5.59.16-AM-1024x511.png\" alt=\"\" width=\"625\" height=\"312\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-01-at-5.59.16-AM-1024x511.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-01-at-5.59.16-AM-300x150.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-01-at-5.59.16-AM-768x383.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-01-at-5.59.16-AM-624x311.png 624w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>To watch our screen cast, <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/www.youtube.com\/watch?v=1WtDWE0UbQg&amp;feature=youtu.be\">CLICK HERE<\/a><\/span><\/strong>.<\/p>\n<p>To access our code, <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/github.com\/thebioengineer\/TidyX\/tree\/master\/TidyTuesday_Explained\/050-James_Stein_Estimators\">CLICK HERE<\/a><\/span><\/strong>.<\/p>\n<p><strong>NOTE:<\/strong> This isn&#8217;t the first time I&#8217;ve applied the James-Stein Estimator to this sort of problem. Nearly 2 years ago I wrote an R tutorial on this approach, comparing it to a Bayesian approach (<span style=\"color: #0000ff;\"><strong><a style=\"color: #0000ff;\" href=\"https:\/\/optimumsportsperformance.com\/blog\/estimating-true-performance\/\">CLICK HERE<\/a><\/strong><\/span>).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We made it! 50 episodes in one year! To celebrate, Ellis Hughes and I take the baseball data we used in Episode 49 and build a James-Stein Estimator to attempt to estimate a hitter&#8217;s true batting average given some number of observations (at bats). After building estimates for the players we show how you can [&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-1970","post","type-post","status-publish","format-standard","hentry","category-tidyx-screen-cast"],"_links":{"self":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/1970","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=1970"}],"version-history":[{"count":1,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/1970\/revisions"}],"predecessor-version":[{"id":1972,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/1970\/revisions\/1972"}],"wp:attachment":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/media?parent=1970"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/categories?post=1970"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/tags?post=1970"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}