{"id":2314,"date":"2022-04-07T05:34:25","date_gmt":"2022-04-07T05:34:25","guid":{"rendered":"http:\/\/optimumsportsperformance.com\/blog\/?p=2314"},"modified":"2022-11-08T03:37:36","modified_gmt":"2022-11-08T03:37:36","slug":"bayes-adjusted-3-point","status":"publish","type":"post","link":"https:\/\/optimumsportsperformance.com\/blog\/bayes-adjusted-3-point\/","title":{"rendered":"Tyrese Maxey&#8217;s 3pt%, Bayes, Shrinkage"},"content":{"rendered":"<p>Some friends were discussing Philadelphia 76er&#8217;s point guard, Tyrese Maxey&#8217;s, three point% today. They were discussing how well he has performed over 72 games with a success rate of 43% behind the arc (at the time this data was scraped, 4\/6\/2022). While his percentage from 3pt range is very impressive I did notice that he has 294 attempts, which is less than 3 out of the 4 player&#8217;s that are ahead of him (Kyrie only has 214 attempts and he is ranked 3rd at the time of this writing) and Steph Curry is just behind Maxey in the ranking (42.4% success) with nearly 70 more attempts.<\/p>\n<p>The question becomes, how can we be of Maxey&#8217;s three point percentage relative to those with more attempts? We will take a Bayesian approach, using a beta conjugate, to consider the success rate of these players relative to what we believe the average three point success rate is for an NBA shooter (our prior), which we will determine from observing 3 point shooting over previous 3 seasons.<\/p>\n<p><strong>NOTE:<\/strong> On <span style=\"color: #0000ff;\"><strong><a style=\"color: #0000ff;\" href=\"https:\/\/www.basketball-reference.com\/leagues\/NBA_2022_totals.html\">basketball-reference.com<\/a><\/strong><\/span>, they have a nice check box that automatically will filter out players that are non-qualifiers for rate stats. After playing around with this, it appears that 200 attempts is their cut off. So, I will keep that and filter the data down to only those with 200 or more 3pt attempts.<\/p>\n<p>All of the code, web scrapping, and csv files of the data (if you are looking to run it prior to when I scrapped it) are available on my <span style=\"color: #0000ff;\"><strong><a style=\"color: #0000ff;\" href=\"https:\/\/github.com\/pw2\/bases_adjusted_3pt_pct\">GITHUB PAGE<\/a><\/strong><\/span>.<\/p>\n<p><strong>Exploratory Data Analysis<\/strong><\/p>\n<p>First, let&#8217;s view the top 10 three point shooters this season (size of the dot represents the number of three point attempts taken).<\/p>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.17.16-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2315\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.17.16-PM-1024x894.png\" alt=\"\" width=\"625\" height=\"546\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.17.16-PM-1024x894.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.17.16-PM-300x262.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.17.16-PM-768x671.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.17.16-PM-624x545.png 624w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.17.16-PM.png 1560w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>Visualize the distribution of three point attempts and three point% for the 2022 season, so far.<\/p>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.18.51-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2316\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.18.51-PM-1024x889.png\" alt=\"\" width=\"625\" height=\"543\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.18.51-PM-1024x889.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.18.51-PM-300x260.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.18.51-PM-768x667.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.18.51-PM-624x542.png 624w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.18.51-PM.png 1518w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p><strong>Establishing Our Prior<\/strong><\/p>\n<p>Since we are dealing with a binary outcome of successes (made the shot) and failures (missed the shot) we will use the beta distribution, which is the conjugate prior for the binomial distribution.<\/p>\n<p>The beta distribution has two parameters, alpha and beta. To determine what these parameters should be, we will use the method of moments with the data from the previous three seasons.<\/p>\n<p>To do this, we need to first find the mean and variance for the previous three seasons.<\/p>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.26.47-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2318\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.26.47-PM.png\" alt=\"\" width=\"441\" height=\"203\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.26.47-PM.png 808w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.26.47-PM-300x138.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.26.47-PM-768x354.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.26.47-PM-624x287.png 624w\" sizes=\"auto, (max-width: 441px) 100vw, 441px\" \/><\/a><\/p>\n<p>Next, we create a function that calculates alpha and beta based on the mean and variance from our observed data.<\/p>\n<pre class=\"brush: r; title: ; notranslate\" title=\"\">\r\n# function for calculating alpha and beta\r\nbeta_parameters &lt;- function(dist_avg, dist_var){\r\n  alpha &lt;- dist_avg * (dist_avg * (1 - dist_avg)\/dist_var - 1)\r\n  beta &lt;- alpha * (1 - dist_avg)\/dist_avg\r\n  list(alpha = alpha,\r\n       beta = beta)\r\n}\r\n<\/pre>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.25.25-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2317\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.25.25-PM-1024x237.png\" alt=\"\" width=\"586\" height=\"136\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.25.25-PM-1024x237.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.25.25-PM-300x69.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.25.25-PM-768x177.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.25.25-PM-624x144.png 624w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.25.25-PM.png 1108w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/a><br \/>\nThe function works to produce the two parameters we need. The data is returned in list format, so we will call each element of the list and store the respective values in their own variable.<\/p>\n<p>The function works to produce the two parameters we need. The data is returned in list format, so we will call each element of the list and store the respective values in their own variable.<\/p>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.27.55-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2319\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.27.55-PM-1024x292.png\" alt=\"\" width=\"625\" height=\"178\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.27.55-PM-1024x292.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.27.55-PM-300x86.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.27.55-PM-768x219.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.27.55-PM-624x178.png 624w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.27.55-PM.png 1310w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><br \/>\nThe alpha and beta parameters derived from our method of moments function appear to produce the mean and standard deviation correctly. We can plot this distribution to see what it looks like.<a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.29.31-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2320\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.29.31-PM-1024x873.png\" alt=\"\" width=\"458\" height=\"391\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.29.31-PM-1024x873.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.29.31-PM-300x256.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.29.31-PM-768x655.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.29.31-PM-624x532.png 624w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.29.31-PM.png 1520w\" sizes=\"auto, (max-width: 458px) 100vw, 458px\" \/><\/a><\/p>\n<p><strong>Update the 3pt% of the players in the 2022 season with our meta prior<\/strong><\/p>\n<p>We calculate our Bayes adjusted three point percentage for the players by adding their successes to `alpha` and their failures to `beta` and then calculating the new posterior percentage as<\/p>\n<p><em><strong>alpha \/ (alpha + beta)<\/strong><\/em><\/p>\n<p>and the posterior standard deviation as<\/p>\n<p><em><strong>sqrt((alpha * beta) \/ ((alpha + beta)^2 * (alpha + beta + 1)))<\/strong><\/em><\/p>\n<pre class=\"brush: r; title: ; notranslate\" title=\"\">\r\ntbl2022 &lt;- tbl2022 %&gt;%\r\n  mutate(three_pt_missed = three_pt_att - three_pt_made,\r\n         posterior_alpha = three_pt_made + alpha,\r\n         posterior_beta = three_pt_missed + beta,\r\n         posterior_three_pt_pct = posterior_alpha \/ (posterior_alpha + posterior_beta),\r\n         posterior_three_pt_sd = sqrt((posterior_alpha * posterior_beta) \/ ((posterior_alpha + posterior_beta)^2 * (posterior_alpha + posterior_beta + 1))))\r\n<\/pre>\n<p>Have any of the players in the top 10 changes following in the adjustment?<a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.35.37-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2325\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.35.37-PM-1024x295.png\" alt=\"\" width=\"625\" height=\"180\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.35.37-PM-1024x295.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.35.37-PM-300x86.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.35.37-PM-768x221.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.35.37-PM-624x180.png 624w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.35.37-PM.png 1446w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<ul>\n<li>We see that Desmond Bane has jumped Kyrie, who only had 214 attempts. Kyrie dropped from 3rd to 6th.<\/li>\n<li>Tyrese Maxey moves up one spot to 4.<\/li>\n<li>Grant Williams drops out of the top 10 while Tyrese Haliburton moves up into the top 10<\/li>\n<\/ul>\n<p>We can plot the results of these top 10 players showing the posterior Bayes three point% relative to their observed three point%.<\/p>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.38.41-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2326\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.38.41-PM-1024x831.png\" alt=\"\" width=\"520\" height=\"422\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.38.41-PM-1024x831.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.38.41-PM-300x244.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.38.41-PM-768x624.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.38.41-PM-624x507.png 624w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.38.41-PM.png 1754w\" sizes=\"auto, (max-width: 520px) 100vw, 520px\" \/><\/a><\/p>\n<p><strong>Show the uncertainty in Tyrese Maxies Performance versus Luke Kennard, who has 409 attempts<\/strong><\/p>\n<pre class=\"brush: r; title: ; notranslate\" title=\"\">\r\nkennard &lt;- tbl2022 %&gt;%\r\n  filter(player == &quot;Luke Kennard&quot;)\r\n\r\nmaxey &lt;- tbl2022 %&gt;%\r\n  filter(player == &quot;Tyrese Maxey&quot;)\r\n\r\nplot(density(rbeta(n = 1e6, shape1 = maxey$posterior_alpha, shape2 = maxey$posterior_beta)),\r\n     col = &quot;blue&quot;,\r\n     lwd = 4,\r\n     ylim = c(0, 20),\r\n     xlab = &quot;3pt %&quot;,\r\n     main = &quot;Bayes Adjusted 3pt%\\nBlue = Tyrese Maxey | Red = Luke Kennard&quot;)\r\nlines(density(rbeta(n = 1e6, shape1 = kennard$posterior_alpha, shape2 = kennard$posterior_beta)),\r\n      col = &quot;red&quot;,\r\n      lwd = 4)\r\n<\/pre>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.40.43-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2327\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.40.43-PM-1024x839.png\" alt=\"\" width=\"481\" height=\"394\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.40.43-PM-1024x839.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.40.43-PM-300x246.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.40.43-PM-768x629.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.40.43-PM-624x511.png 624w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.40.43-PM.png 1650w\" sizes=\"auto, (max-width: 481px) 100vw, 481px\" \/><\/a><\/p>\n<p><strong>If we sample from the posterior for both players, how much better is Kennard?<\/strong><\/p>\n<pre class=\"brush: r; title: ; notranslate\" title=\"\">\r\nmaxey_sim &lt;- rbeta(n = 1e6, shape1 = maxey$posterior_alpha, shape2 = maxey$posterior_beta)\r\n\r\nkennard_sim &lt;- rbeta(n = 1e6, shape1 = kennard$posterior_alpha, shape2 = kennard$posterior_beta)\r\n\r\nplot(density(kennard_sim - maxey_sim),\r\n     lwd = 4,\r\n     col = &quot;black&quot;,\r\n     main = &quot;Kennard Posterior Sim - Maxie Posterior Sim&quot;,\r\n     xlab = &quot;Difference between Kennard &amp; Maxie&quot;)\r\nabline(v = 0,\r\n       lwd = 4,\r\n       lty = 2,\r\n       col = &quot;red&quot;)\r\n<\/pre>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.42.22-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2328\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.42.22-PM-1024x842.png\" alt=\"\" width=\"499\" height=\"410\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.42.22-PM-1024x842.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.42.22-PM-300x247.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.42.22-PM-768x632.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.42.22-PM-624x513.png 624w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.42.22-PM.png 1624w\" sizes=\"auto, (max-width: 499px) 100vw, 499px\" \/><\/a><\/p>\n<p>On average, Kennard was better in ~74% of the 1,000,000 simulations.<\/p>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.43.38-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2329\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.43.38-PM.png\" alt=\"\" width=\"500\" height=\"168\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.43.38-PM.png 1016w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.43.38-PM-300x101.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.43.38-PM-768x259.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-06-at-10.43.38-PM-624x210.png 624w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>Long story short, Tyrese Maxey has been a solid 3pt shooter, he just happens to play on a team where James Harden takes many of the shots (maybe he should distribute the ball more?).<\/p>\n<p><strong>One last thing&#8230;..Shrinkage<\/strong><\/p>\n<p>So, what happened? Basically, the Bayesian adjustment created <em>&#8220;shrinkage&#8221;<\/em> whereby the players that are above average are pulled down slightly towards the population average and the players below average are pulled up slightly towards the population average. The amount of shrinkage depends on the number of attempts the player has had (the size of their sample). More attempts leads to less shrinkage (more certainty about their performance) and smaller attempts leads to more shrinkage (more certainty about their). Basically, if we haven&#8217;t seen you shoot very much then our best guess is that you are probably closer to average until we are provided more evidence to believe otherwise.<\/p>\n<p>Since we were originally dealing with only players that have had 200 or more three point attempts, let&#8217;s scrape all players from the 2022 season and apply the same approach to see what shrinkage looks like.<\/p>\n<pre class=\"brush: r; title: ; notranslate\" title=\"\">\r\nurl2022 &lt;- read_html(&quot;https:\/\/www.basketball-reference.com\/leagues\/NBA_2022_totals.html&quot;)\r\n\r\ntbl2022a &lt;- html_nodes(url2022, 'table') %&gt;%\r\n  html_table(fill = TRUE) %&gt;%\r\n  pluck(1) %&gt;%\r\n  janitor::clean_names() %&gt;%\r\n  select(&quot;player&quot;, three_pt_att = &quot;x3pa&quot;, three_pt_made = &quot;x3p&quot;, three_pt_pct = &quot;x3p_percent&quot;) %&gt;%\r\n  filter(player != &quot;Player&quot;) %&gt;%\r\n  mutate(across(.cols = three_pt_att:three_pt_pct,\r\n                ~as.numeric(.x))) %&gt;%\r\n  filter(!is.na(three_pt_pct)) %&gt;%\r\n  arrange(desc(three_pt_pct)) %&gt;%\r\n  mutate(three_pt_missed = three_pt_att - three_pt_made,\r\n         posterior_alpha = three_pt_made + alpha,\r\n         posterior_beta = three_pt_missed + beta,\r\n         posterior_three_pt_pct = posterior_alpha \/ (posterior_alpha + posterior_beta),\r\n         posterior_three_pt_sd = sqrt((posterior_alpha * posterior_beta) \/ ((posterior_alpha + posterior_beta)^2 * (posterior_alpha + posterior_beta + 1))))\r\n\r\n\r\ntbl2022a %&gt;%\r\n  mutate(pop_avg = alpha \/ (alpha + beta)) %&gt;%\r\n  ggplot(aes(x = three_pt_pct, y = posterior_three_pt_pct, size = three_pt_att)) +\r\n  geom_point(color = &quot;black&quot;,\r\n             alpha = 0.8) +\r\n  geom_hline(aes(yintercept = pop_avg),\r\n             color = &quot;green&quot;,\r\n             size = 1.2,\r\n             linetype = &quot;dashed&quot;) +\r\n  geom_abline(intercept = 0,\r\n              slope = 1,\r\n              size = 1.2,\r\n              color = &quot;green&quot;) +\r\n  labs(x = &quot;Observed 3pt%&quot;,\r\n       y = &quot;Bayesian Adjusted 3pt%&quot;,\r\n       size = &quot;Attempts&quot;,\r\n       title = &quot;Shirnkage of 3pt% using Beta-Conjugate&quot;,\r\n       caption = &quot;Data Source: https:\/\/www.basketball-reference.com\/leagues\/NBA_2022_totals.html&quot;)\r\n<\/pre>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-07-at-7.02.54-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2332\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-07-at-7.02.54-AM.png\" alt=\"\" width=\"549\" height=\"538\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-07-at-7.02.54-AM.png 798w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-07-at-7.02.54-AM-300x294.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-07-at-7.02.54-AM-768x752.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-07-at-7.02.54-AM-624x611.png 624w\" sizes=\"auto, (max-width: 549px) 100vw, 549px\" \/><\/a><\/p>\n<p>What does this tell us?<\/p>\n<ul>\n<li>Points closest to the diagonal line (the line of equality &#8212; points on this line represent 0 difference between Bayes adjusted and Observed 3pt%) see much almost no shrinkage towards the observed 3pt%.<\/li>\n<li>Notice that the points nearest the line also have tend to be larger, meaning we have more observations are more certainty of that player&#8217;s true skill.<\/li>\n<li>The horizontal dashed line represents the population average (determined from the alpha and beta parameters obtained from previous 3 seasons).<\/li>\n<li>Notice that the smaller points (less observations) get shrunk towards this line given we haven&#8217;t seen enough from that player to believe differently. For example, the tiny dot to the far right indicates the player has an observed 3pt% of 100%, which we wouldn&#8217;t really believe to be sustainable for the full season (maybe the player took one or two shots and got lucky?). So that point is pulled downwards towards the dashed line as our best estimate is that the player ie closer to an average shooter.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some friends were discussing Philadelphia 76er&#8217;s point guard, Tyrese Maxey&#8217;s, three point% today. They were discussing how well he has performed over 72 games with a success rate of 43% behind the arc (at the time this data was scraped, 4\/6\/2022). While his percentage from 3pt range is very impressive I did notice that he [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49,45,43],"tags":[],"class_list":["post-2314","post","type-post","status-publish","format-standard","hentry","category-bayesian-model-building","category-r-tips-tricks","category-sports-analytics"],"_links":{"self":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/2314","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=2314"}],"version-history":[{"count":5,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/2314\/revisions"}],"predecessor-version":[{"id":2324,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/2314\/revisions\/2324"}],"wp:attachment":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/media?parent=2314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/categories?post=2314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/tags?post=2314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}