<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>Matt Waite</title>
<link>https://www.mattwaite.com/posts/</link>
<atom:link href="https://www.mattwaite.com/posts/index.xml" rel="self" type="application/rss+xml"/>
<description>Archive of posts on journalism, data, code, and technology.</description>
<generator>quarto-1.9.36</generator>
<lastBuildDate>Tue, 16 Jun 2026 05:00:00 GMT</lastBuildDate>
<item>
  <title>A rant about teaching journalism in 2026</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/2026-06-16-a-rant-about-teaching-in-2026/</link>
  <description><![CDATA[ 





<p>I need to get this out of my head.</p>
<p>Trying to figure out what to teach in a journalism class in 2026 feels like being torn apart from the insides. And I can already feel the people thinking It’s Not That Hard, Just Teach The Basics blah blah blah sure. Easy for you to say. You’re either not teaching journalism in 2026 or you’re willfully blind as to what is going on right now.</p>
<p>Faculty are under enormous pressure from university leadership and voices in industry that students <em>must</em> have AI skills when they leave. When asked what those are – what do they mean by AI skills? – the answer we get is Yes. AI skills. The kids need the AI skills. AI. Skills. Yes.</p>
<p>They don’t know.</p>
<p>And they’re quick to tell you that you’re a useless dinosaur if you don’t teach them these magical skills that they can’t describe.</p>
<p>Worse, the journalism world is being fractured into two warring tribes that are disingenuously arguing right past each other. Everyone is screaming, no one is listening, and everyone is full of shit in their own way. Trying to engage with everyone’s arguments on their merits is enough to drive you crazy.</p>
<p>Oversimplifying and being as disingenuous to all as they are to each others arguments, here are the two tribes fighting with each other: The Stochastic Parrot/Plagiarism Machine is Evil And I Will Never Touch It Group vs the Make The Meat Bags Talk To Other Meat Bags And AI Will Lead Us To Glory Group. There’s a third group – the Supernerds Making Micro Tools Only 3 People Need/Understand That Can’t Be Trusted Without Massive Human Oversight Group but they’re not fighting this fight.</p>
<p>Just by writing this, I’m going to get shit from all of them. Oh, you’re <em>actually</em> using AI in your class? Poison! Heretic! Earth/Job killer! Oh, you’re <em>not</em> allowing your students to use AI? Lol dinosaur so out of step and irrelevant! Just quit already! Oh, you’re worried that if you let students use AI you’ll actually make them dumber? Or you’ll be the one that puts them on a path to a delusional spiral? Doomer.</p>
<p>Further frustrating me is that every argument contains danger. Every suggestion carries a risk of actually harming students. Go one way too far and you <a href="https://www.anthropic.com/research/AI-assistance-coding-skills">make them two letter grades dumber than you got them</a> – which, to be clear, is not the gig. Go too far the other way and you hurt their chances of finding a place in a new world that includes an alien brain on call 24/7 that isn’t going to magically go away.</p>
<p>No one knows where the lines are. There is no manual for this. No one knows that you can do This, but Not This. The best we’ve got is Try Some Stuff, See What Happens.</p>
<p>And to be clear, I do think there are useful things that AI can do for journalism. And I’m quite sure there are things that will absolutely harm the profession. More on those in future posts, but I’m struggling to find why we shouldn’t use the thing that enables things we couldn’t do before if it serves the mission.</p>
<p>But here is the problem that keeps me awake at night: How do you teach someone how to do something with AI when they don’t know what success looks like in the first place? Someone who struggles with critical reading. Someone so riven with anxiety about failure they’ll accept anything that appears to help.</p>
<p>My spiral with all of this started with a February column by Chris Quinn, editor at the Cleveland Plain Dealer where he bagged on a recent grad for rejecting their job offer after the kid learned that they’ll be the one feeding AI so it can write stories. The headline: <a href="https://www.cleveland.com/news/2026/02/journalism-schools-are-teaching-fear-of-the-future-letter-from-the-editor.html">Journalism schools are teaching fear of the future</a>. The kid wanted more out of a journalism career than feeding an AI quotes. Good for them. Not a reason to write a letter from the editor crapping on the kid and every j-school without knowing anything about what we do.</p>
<p>That sparked a lot of conversation online and in company Slacks, and that created even more journalism about journalism.</p>
<p>“It’s bots vs reporters at the AP” <a href="https://www.semafor.com/article/03/03/2026/its-bots-vs-reporters-at-the-ap">according to Semafor</a>. This quote from the story sets the whole thing up:</p>
<blockquote class="blockquote">
<p>“Because local newsrooms are so strapped, they are turning for assistance on the news making process in every direction. Advance Publications got there first, others will follow,” AP Senior Product Manager for AI Aimee Rinehart wrote in internal company Slack messages first shared with Semafor, referring to the Plain Dealer’s parent company. “Resistance is futile.”</p>
</blockquote>
<p>The thing being “resisted”: the idea that people would go do the reporting and AI would write the story. Or at the very least, write the first version of the story.</p>
<p>Here is where this gets into a giant no-one-is-listening mess for me:</p>
<ol type="1">
<li>If you’re in the no, never let AI write a story camp, you’re wrong. There are all kinds of stories that this could totally work for. They are not the stories you are thinking of. The stories you aspire to write? AI is bad at them. The stories you don’t want to write, or don’t have to think very much while writing them? They’re not bad at those. Notice I didn’t say good. I said not bad. And they’re really, really fast at them, which has it’s own value.</li>
<li>If you’re in the absolutely yes, we’ll barely have to write anything again camp, you’re wrong. The set of stories this will work on is small, formulaic and low value. I’ve written <em>hundreds</em> of these stories in my career because I was cheap and it needed to be done. The city council will consider an ordinance that does xyz at its Tuesday meeting. Food trucks and puppies in costumes will star in this weekend’s local festival. The Department of Transportation said Jones Street will be closed for the next week as crews work on the sewer. That’s the level we’re talking here.</li>
<li>If you’re in the why are we even thinking about this, we’ve <em>never</em> done something like this before camp, you’re wrong. I’m sure even older examples exist, but earlier this year my former employer, the Tampa Bay Times, <a href="https://www.cltampa.com/news/the-tampa-bay-times-is-now-publishing-ai-generated-stories/">took some flak for publishing AI generated real estate stories</a>. Online commenters lamented in all the ways they lament. But I automated Tampa Bay real estate stories … in 2008 … no AI required. <a href="http://www.mattwaite.com/posts/2008/aug/24/new-app-neighborhood-watch/">It was just a templated thing using public data</a>. No one lamented then. No one feared I was taking a reporter’s job then. <a href="https://web.archive.org/web/20080906044028/http://watch.tampabay.com/homes/pasco/">See for yourself what it did</a> and ask yourself: would you get enough value out of that if you made a person do it? And yet thousands of people used it regularly.</li>
</ol>
<p>A long time ago, I once complained to an older reporter working on a Big Story that I wanted to be working on a Big Story and all I was doing were stories that ended sentences with police said. And he told me that to build the Taj Mahal, you’ve got to build a lot of shacks. You don’t go from shack to mansion in one step. And I hated that answer at 22. But he was right.</p>
<p>What AI presents is the industrialization of my metaphorical shack. Push some buttons, poof, shack. Need more shacks? Push more buttons. Dozens of shacks. More content! Just what everyone wants! But if AI could write Pulitzer winners or stories that grab attention in an attention starved world by pushing a few more buttons, Anthropic/OpenAI/Google wouldn’t have free accounts marketed to college kids. The marketing – and pricing – would be <em>very</em> different. The marketing now? Automated volume. More Stuff for the Thing! Volume as a value in and of itself.</p>
<p>The student journalist of 2026 did not grow up reading a print newspaper at home like generations of students before them. That student who walks into my classroom in 2026 often has very little to zero experience with a news product. Journalism faculty at other institutions that I’ve talked to all report the same thing: We have journalism majors who have not and do not <em>read</em> news. Or watch it. There is nothing for them to emulate.</p>
<p>So please, tell me: how am I supposed to prepare a student for a future where AI can write a simple story for them if they just tell it to do that <em>when they do not know what that story looks like.</em> I do. And the reason I can tap a few words into a chat window and get a reasonable facsimile of what I used to do on the night cops desk in the 90s is because I did that. I know in my bones exactly what that looks like and what it takes to get it. An 18-year old kid doesn’t.</p>
<p>Add in that they <em>know</em> they don’t know, and this tool will do something that looks like a story, so the temptation to use it is enormous, and so is the chance of a generation of student journalists learning how to write <em>like AI</em> because of their reliance on it. A bonus dollop? They are, as a group, unable or unwilling to read. Close, careful, critical reading? Exceptionally bad at it, generally speaking. The bulk of them are the worst human for the human in the loop.</p>
<p>How do you make that student labor to build shacks now, knowing a machine will do it for them today and maybe after graduation, without them ever having set foot in a shack? How can I get them to understand the value of shackbuilding – and to not fear but embrace all the mistakes that come with that – all so they might have a chance to build mansions one day?</p>



 ]]></description>
  <category>journalism</category>
  <category>education</category>
  <category>AI</category>
  <guid>https://www.mattwaite.com/posts/2026-06-16-a-rant-about-teaching-in-2026/</guid>
  <pubDate>Tue, 16 Jun 2026 05:00:00 GMT</pubDate>
  <media:content url="https://www.mattwaite.com/posts/2026-06-16-a-rant-about-teaching-in-2026/image.png" medium="image" type="image/png"/>
</item>
<item>
  <title>Teaching a one-hour throwaway news apps class</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/2026-04-30-teaching-a-one-hour-throwaway-news-apps-class/</link>
  <description><![CDATA[ 





<p>What you will need: * A <a href="https://github.com">Github</a> Account (if you don’t already have one) * <a href="https://antigravity.google/">Google Antigravity</a> * Some data in csv format.</p>
<section id="step-1-setup" class="level3">
<h3 class="anchored" data-anchor-id="step-1-setup">Step 1: Setup</h3>
<p>On the first page you see, you should see a big blue Open Folder button. Click that.</p>
<ul>
<li>For most of you, you’re going to need to create a new folder and that new folder <em>must</em> be named [githubusername].github.io where githubusername is your github username that you just created. It must match it exactly. So, for example, my github user name is mattwaite, so my folder is called mattwaite.github.io. It has to match your username and watch the spelling of github. A common mistake is to misspell github in the name.</li>
<li>If you already have a Github Pages repository, go find that folder (that’s your username.github.io folder).</li>
</ul>
</section>
<section id="step-2-if-you-dont-have-one-make-a-homepage" class="level3">
<h3 class="anchored" data-anchor-id="step-2-if-you-dont-have-one-make-a-homepage">Step 2: If you don’t have one, make a homepage</h3>
<p>For people who don’t already have a Github Pages account and have nothing in here, go over to the agent window and write “Make me a nice looking homepage that says Coming Soon. This will be hosted on github pages.”</p>
</section>
<section id="step-3-make-a-folder-for-your-throwaway-web-app" class="level3">
<h3 class="anchored" data-anchor-id="step-3-make-a-folder-for-your-throwaway-web-app">Step 3: Make a folder for your throwaway web app</h3>
<p>Inside of your username.github.io folder, create a folder using Antigravity.</p>
<p><img src="https://www.mattwaite.com/posts/2026-04-30-teaching-a-one-hour-throwaway-news-apps-class/image.png" class="img-fluid"></p>
<p>You should name this folder dataname-search where dataname is a one word description of your data. If your data is election data, make it election-search. If it’s Groundhog Day predictions, make it predictions-search. The reason you use lowercase letters and dashes for spaces is because this folder name will be part of the url.</p>
<p>Click and highlight your folder after you have created it.</p>
</section>
<section id="step-4-put-your-data-into-the-dataname-search-folder" class="level3">
<h3 class="anchored" data-anchor-id="step-4-put-your-data-into-the-dataname-search-folder">Step 4: Put your data into the dataname-search folder</h3>
<p>That’s it. Just move it into that folder. You can drag the file from your file explorer (Finder on Mac, File Explorer on Windows) into the folder in Antigravity and it will move it.</p>
</section>
<section id="step-5-time-to-prompt" class="level3">
<h3 class="anchored" data-anchor-id="step-5-time-to-prompt">Step 5: Time to prompt</h3>
<p>With your folder created and your csv inside of the folder, it’s time to tell Antigravity what you want. Your prompt should: * Say that you are creating a web search of this data in your dataname-search folder. * That the page is hosted on Github Pages so it must be static files. * That you intend to iframe the page into a Content Management System elsewhere. * What columns you want people to be able to search. * How you want the data to be displayed, correcting any column names that won’t make sense to the general public. For example, if your column is called Jurisdiction_Name, you should tell Gemini you just want that to be Name. ### Step 6: Review and revise</p>
<p>What do you think? Don’t like something? Tell Gemini to change it.</p>
</section>
<section id="step-7-commit-and-push-to-github" class="level3">
<h3 class="anchored" data-anchor-id="step-7-commit-and-push-to-github">Step 7: Commit and push to Github</h3>
<p>Click the Source Control button. In the box that says Messages, say what you are committing. In this case, it’s likely something like Adding dataname search. It does not need to be verbose. It’s a note to yourself what this is so that you can know at a glance later what it is if you were to go diving through your own git commits. When done click commit.</p>


</section>

 ]]></description>
  <category>code</category>
  <category>webdev</category>
  <category>AI</category>
  <guid>https://www.mattwaite.com/posts/2026-04-30-teaching-a-one-hour-throwaway-news-apps-class/</guid>
  <pubDate>Thu, 30 Apr 2026 05:00:00 GMT</pubDate>
  <media:content url="https://www.mattwaite.com/posts/2026-04-30-teaching-a-one-hour-throwaway-news-apps-class/image.png" medium="image" type="image/png" height="59" width="144"/>
</item>
<item>
  <title>Parsing PDFs with Antigravity</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/2025-11-24-parsing-pdfs-with-antigravity/</link>
  <description><![CDATA[ 





<p>Among the wisest things I’ve ever seen written about AI is <a href="https://x.com/AuthorJMac/status/1773679197631701238?lang=en">“I want AI to do my laundry and dishes so that I can do art and writing, not for AI to do my art and writing so that I can do my laundry and dishes.”</a></p>
<p>The same can be said for journalism. I want AI to do the chores so I can do the journalism. Time I’m not manually pulling apart PDFs is time I can spend talking to people.</p>
<p>Last week, Google launched their much anticipated Gemini 3 model, and much is being said and written about it. One very interesting thing they did was launch a Visual Studio Code version of their own called <a href="https://antigravity.google/">Antigravity</a>. It’s a development environment with an “agentic coding surface” added as one of the primary interfaces to it.</p>
<p>I’ll be honest, when I first read about it, I was pretty meh. So it’s Claude Code (which you can plug into Visual Studio Code!) or Open AI’s Codex, but for Google this time. Okay. Fine. But I started seeing some overreaction to it online, and it made me curious.</p>
<p>I’m ready to say we may be looking at a truly impactful data journalism tool here. I don’t want to fall into the same trap and overreact by saying it’s as big as the spreadsheet or the search engine, but I’m also not saying it isn’t.</p>
<p>In short, it has astonishing potential as a data journalism tool.</p>
<p>What has me so excited? <a href="https://nebraska.edu/offices-policies/business-finance/budget-and-planning">My employer’s salary “database”</a> which is a 1,957 page PDF. A PDF formatted in such a way as to make parsing it a practical impossibility. And before you ask: state law says if they “publish” data in this form, then they don’t have to give it to you in a different form. Many of us have asked.</p>
<p>What makes it so hard are people who get paid out of multiple budget pots. Take, for example, me. I have one job according to the university: professor of practice. I get paid out of one account. My entry in the pdf is one line. Easy. Colleagues of mine might have multiple jobs. Some administrators in my college are half administrators (pot one), half professors (pot two). But they also have endowed positions, so they get paid from a third pot. In the PDF, they’re on four lines. Pots one, two and three and a fourth that is the total. But only the first line gets all of the data. The rest? Blank.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/2025-11-24-parsing-pdfs-with-antigravity/screenshot1.png" class="img-fluid figure-img" alt="A screenshot of the PDF provided by the University of Nebraska to report public salaries."></p>
<figcaption>Three people. Three salaries. Eight lines of data.</figcaption>
</figure>
</div>
<p>Notice also that names and where they get paid from blur together. Notice how the length of the alternate funds also overlap the name and position columns. There is no reason this data needs to look like this, but the university considers this as being responsive to a public records request. Want to analyze this data? Want to compare it across time? Compare administrators to faculty? Good luck.</p>
<p>That is, until Gemini 3 and Antigravity came along.</p>
<p>After an afternoon of messing around with Antigravity to fiddle with the design of this website, I decided to just try something. I had been messing with DeepseekOCR, an open weights model that you can run on your own hardware that is <em>very good</em> at finding tables in PDFs and converting those to markdown tables. I was very impressed. But I wondered how well Antigravity/Gemini 3 would do with this pdf.</p>
<p>Answer: Gobsmacked. Gob. Smacked.</p>
<p>I put the PDF and a screenshot of the first page in a folder, connected that folder to Antigravity, and wrote this half-assed prompt from the couch.</p>
<blockquote class="blockquote">
<p>I am attempting to extract structured data from a frustratingly formatted PDF. What I need at the end is a csv file that has the data contained in the screenshot. I can handle the intricacies of the data after I get the structured version. Can you take a look at the screenshot first to see if you can extract the tabular structure?</p>
</blockquote>
<p>I didn’t even ask it to do the whole PDF. I just wanted the screenshot of the first page. That’s it. What it did was devise an implementation plan, wrote a walkthrough of what it did as it was doing it, then wrote a Python script using <code>pdfplumber</code> that extracted the data out of all 1,957 pages, and then wrote a cleaner script to fix some formatting weirdness. It took my prompt, worked for about 10 minutes and spit out a csv file that was orders of magnitude better than anything I had managed myself in <em>years</em> of on-and-off messing with this file.</p>
<p>All I did was stare at it as it kept trying things and checking them, improving the code using random selections of data to check if it was all working. And then, it finished. I couldn’t believe it worked, so I opened it and was blown away with what it did.</p>
<p>It wasn’t perfect, however. In fact, it assumed that those extra rows where people got paid from other pots were a mistake and it filtered them out.</p>
<p>So I went back to the prompt:</p>
<blockquote class="blockquote">
<p>I’ve been doing some of my own spot checking and there is a basic assumption at the beginning that is not correct. That assumption is lines 34-38 of the clean_salary_data.py. Specifically:</p>
<p># Basic check: First column should be Cost Element (6 digits) # OR sometimes it’s empty if it’s a continuation? No, looking at the data, most data rows have it. # Let’s look at row 26: 512100,“Batman, Renee”,F,…</p>
<p>first_col = row[0].strip()</p>
<p>There are entries where the next line, which does not contain a cost object *is* a continuation. This data is university salary data, and how they show professors with endowed chairs, for example, is to put their faculty job on one line with a cost object, then the next line without one is their endowed chair line and at the bottom is a total line for that person. Not capturing the next few lines is causing some issues with accuracy. Can we capture those? For the vast majority of data, your method works extraordinarily well. It’s just not working for the few who have multiple salary inputs.</p>
</blockquote>
<p>About 8 minutes later, I had an astonishingly good – much better though still not perfect - version of this data.</p>
<p>What’s wrong with it?</p>
<p>It didn’t want to make assumptions about spacing, so it left odd spacing that is an artifact of the PDF. So some people are Ma tt Waite or Profe ssor. The overlapping columns are an issue I’m likely going to have to contend with manually. I’m going to have to fill in blank columns and total up people to get to one row one person.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/2025-11-24-parsing-pdfs-with-antigravity/screenshot2.png" class="img-fluid figure-img" alt="A table of university employees as part of the output from Google's Antigravity."></p>
<figcaption>The output from Antigravity.</figcaption>
</figure>
</div>
<p>But I can’t stress this enough: this is light years beyond any tool I’ve been able to throw at this in <em>years</em> of trying. Every NICAR, I throw some new tool at it and leave disappointed. This is the first time my gob has been smacked by something an AI is doing.</p>
<p>Could I have written this code? Sure. I’ve even tried using <code>pdfplumber</code> to do it and didn’t have the same results. It would have taken me much longer, and frankly that’s probably enough to get me to go away. I’ve got papers to grade and students upset with me about how long it’s taking.</p>
<p>Can’t say this enough: astonished at what this might mean for freeing journalists up to do journalism instead of un-screwing up government PDFs.</p>
<p>Want to see all of the output? <a href="https://github.com/mattwaite/SalaryExtract">It’s on GitHub</a>.</p>



 ]]></description>
  <category>code</category>
  <category>analysis</category>
  <category>AI</category>
  <guid>https://www.mattwaite.com/posts/2025-11-24-parsing-pdfs-with-antigravity/</guid>
  <pubDate>Mon, 24 Nov 2025 06:00:00 GMT</pubDate>
  <media:content url="https://www.mattwaite.com/posts/2025-11-24-parsing-pdfs-with-antigravity/image.png" medium="image" type="image/png" height="84" width="144"/>
</item>
<item>
  <title>An R + LLM starter kit</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/r-llm-starter-pack/</link>
  <description><![CDATA[ 





<p>I’ve written before, I am at best an enthusiastic amateur when it comes to AI, LLMs and R. But I’m braver/dumber than most, so for a talk I’m giving to NE-RUG – the Nebraska R Users Group – and to the NICAR data journalism conference, I’ve got some resources and some code to share.</p>
<section id="r-libraries" class="level3">
<h3 class="anchored" data-anchor-id="r-libraries">R libraries</h3>
<p><a href="https://ellmer.tidyverse.org/index.html"><code>ellmer</code></a>: From the folks who brought you the <code>tidyverse</code> comes <code>ellmer</code>, a library that supports talking to a large number of LLMs. To talk to the big commercial LLMs, you’ll need API keys, and that usually means having an API budget. But what I like about ellmer is that it also talks to locally hosted models as well. More about that later.</p>
<p><a href="https://simonpcouch.github.io/chores/index.html"><code>chores</code></a>: Built on top of <code>ellmer</code>, <code>chores</code> is a neat way to make tools inside of R Studio that leverage LLMs to accomplish tasks. Examples are to help with certain kinds of code tasks, or help with explanations of what an error message means.</p>
</section>
<section id="external-resources" class="level3">
<h3 class="anchored" data-anchor-id="external-resources">External resources</h3>
<p><a href="https://ollama.com/">Ollama</a>: A cross-platform system of downloading, managing and running open-source LLMs on your local machine. With Ollama, you can run Meta’s Llama3 or DeepSeek’s R1 locally, using them to accomplish tasks without incurring costs. A rough rule of thumb is that you can run models slightly smaller than the amount of RAM you have. For example, my computer has 16GB of RAM, so I can run 14 billion parameter models (albeit somewhat slowly).</p>
</section>
<section id="basics-of-ellmer" class="level3">
<h3 class="anchored" data-anchor-id="basics-of-ellmer">Basics of ellmer</h3>
<p><code>ellmer</code> at first is very simple. You can just start a chat and … chat.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(ellmer)</span>
<span id="cb1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(glue)</span>
<span id="cb1-4"></span>
<span id="cb1-5">chat <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">chat_gemini</span>()</span>
<span id="cb1-6"></span>
<span id="cb1-7">chat<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">chat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Tell me three jokes about journalists"</span>)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Here are three jokes about journalists:

1.  What's a journalist's favorite kind of fish?
    A **red herring**!

2.  Why did the journalist break up with the thesaurus?
    It kept giving him too many synonyms for "scoop"!

3.  A journalist dies and goes to heaven. St. Peter meets him at the gates. 
"Welcome!" says St. Peter. "Before you come in, I just have one question for 
you."
    The journalist immediately pulls out his notebook and pen, eyes gleaming. 
"Fantastic!" he replies. "My first question for *you* is..."</code></pre>
</div>
</div>
</section>
<section id="structured-data-output" class="level3">
<h3 class="anchored" data-anchor-id="structured-data-output">Structured data output</h3>
<p>Most models can be used to extract structure from sentences.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1">chat <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">chat_gemini</span>()</span>
<span id="cb3-2"></span>
<span id="cb3-3">data <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> chat<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">extract_data</span>(</span>
<span id="cb3-4">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"My name is Matt and I'm a 49 year old Journalism major"</span>,</span>
<span id="cb3-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">type_object</span>(</span>
<span id="cb3-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">age =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">type_number</span>(),</span>
<span id="cb3-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">name =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">type_string</span>(),</span>
<span id="cb3-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">major =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">type_string</span>()</span>
<span id="cb3-9">  )</span>
<span id="cb3-10">)</span>
<span id="cb3-11"></span>
<span id="cb3-12"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.data.frame</span>(data)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  age name      major
1  49 Matt Journalism</code></pre>
</div>
</div>
</section>
<section id="something-more-like-data-journalism" class="level3">
<h3 class="anchored" data-anchor-id="something-more-like-data-journalism">Something more like data journalism</h3>
<p>What if we wanted to normalize some messy, messy data. In Nebraska, the Department of Corrections publishes a live dataset of incarcerated people that you can download. You can ask and answer all kinds of questions from it – demographics, etc. But what you can’t do is figure out what is holding the most people, or how many people are there at least in part because of drug charges. Why? Because the charges they are serving time for are not normalized. Here’s an example of what they look like:</p>
<p>POS CNTRL SUB-METHAMPHETAMINE<br>
MURDER 1ST DEGREE<br>
POSSESSION OF METHAMPHETAMINE<br>
POS CNTRL SUB (METH)<br>
POSSESS CONTR SUBSTANCE-METH<br>
DELIVERY OF METHAMPHETAMINE<br>
POSS W/ INTENT DIST METH</p>
<p>Can an LLM help us with this? Yes!*</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1">chat <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">chat_gemini</span>()</span>
<span id="cb5-2"></span>
<span id="cb5-3">chat<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">extract_data</span>(</span>
<span id="cb5-4">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"POSS W/ INTENT DIST METH"</span>,</span>
<span id="cb5-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">type_object</span>(</span>
<span id="cb5-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">methamphetamine_related =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">type_boolean</span>(),</span>
<span id="cb5-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">drug_possession_related =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">type_boolean</span>(),</span>
<span id="cb5-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">drug_distribution_related =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">type_boolean</span>(),</span>
<span id="cb5-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fully_spelled_out_no_abbreviations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">type_string</span>()</span>
<span id="cb5-10">  )</span>
<span id="cb5-11">)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$methamphetamine_related
[1] TRUE

$drug_possession_related
[1] TRUE

$drug_distribution_related
[1] TRUE

$fully_spelled_out_no_abbreviations
[1] "Possession with intent to distribute methamphetamine"</code></pre>
</div>
</div>
<p>* you have to ruthlessly check this. It’s good, but it is not perfect.</p>
<p>Why am I only doing one here? Because the free tier of Gemini limits you to about 5 queries a minute. But it wouldn’t be that hard to write a function that runs through your list of charges and inserts a pause after each one to ensure you stay in the free tier.</p>
<p>What else can be done?</p>
</section>
<section id="nuclear-powered-population-maps" class="level3">
<h3 class="anchored" data-anchor-id="nuclear-powered-population-maps">Nuclear powered population maps</h3>
<p>Here is a basic population map of Nebraska with one-year change values in it. We’ve all made this chart before. It’s simple, but it gets the job done.</p>
<iframe title="Nebraska population changes uneven in latest estimates" aria-label="Map" id="datawrapper-chart-Kpgli" src="https://datawrapper.dwcdn.net/Kpgli/1/" scrolling="no" frameborder="0" style="width: 0; min-width: 100% !important; border: none;" height="450" data-external="1">
</iframe>
<p>I’ve written a lot more about this process <a href="https://mattwaite.github.io/posts/a-simple-example-ai-agents-doing-journalism/">here</a> but what if we could take the basic data from our population data and create narratives out of it. Instead of the boring tabular way of giving them the information, they get a human narrative of a few sentences.</p>
<p>First, let’s create the base narrative. That is the words we will feed to Gemini.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1">countypopchange <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">read_csv</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"https://the-art-of-data-journalism.github.io/tutorial-data/census-estimates/nebraska.csv"</span>)</span>
<span id="cb7-2"></span>
<span id="cb7-3">statenarrative <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> countypopchange <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb7-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(COUNTY, STATE, CTYNAME, STNAME, POPESTIMATE2023, POPESTIMATE2022, NPOPCHG2023, NATURALCHG2023, NETMIG2023) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb7-5">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">POPPERCENTCHANGE =</span> ((POPESTIMATE2023<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>POPESTIMATE2022)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>POPESTIMATE2022)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb7-6">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">GEOID =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste0</span>(COUNTY, STATE)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb7-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">desc</span>(POPPERCENTCHANGE)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb7-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">PCTCHANGERANK =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">row_number</span>()) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb7-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_narrative =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">glue</span>(</span>
<span id="cb7-10">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"County: {CTYNAME}, Population in 2023: {POPESTIMATE2023}, Population in 2022: {POPESTIMATE2022}, Population change: {NPOPCHG2023}, Percent change: {POPPERCENTCHANGE}, Percent change rank in {STNAME}: {PCTCHANGERANK}, Natural change (births vs deaths): {NATURALCHG2023}, Net migration: {NETMIG2023}"</span>)) </span>
<span id="cb7-11"></span>
<span id="cb7-12">statenarrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>base_narrative[[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]]</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>County: Banner County, Population in 2023: 674, Population in 2022: 657, Population change: 17, Percent change: 2.58751902587519, Percent change rank in Nebraska: 1, Natural change (births vs deaths): 0, Net migration: 17</code></pre>
</div>
</div>
<p>Now, we’re going to add a system prompt to our chat to give Gemini some guidance. It’s not hard to do and you should do it.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1">chat <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">chat_gemini</span>(</span>
<span id="cb9-2">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">system_prompt =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"You are a demographics journalist from Nebraska. Your job today is to write short -- 2-3 sentence -- summaries of population estimates from the Census Bureau for each county in the state. I will provide you the name of the county and a series of population numbers for the county. Your job is to turn it into a concise but approachable summary of what happened in that county. Here is the data you have to work with: "</span></span>
<span id="cb9-3">)</span>
<span id="cb9-4"></span>
<span id="cb9-5">chat<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">chat</span>(statenarrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>base_narrative[[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]])</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Banner County saw its population rise to 674 residents in 2023, adding 17 
people since 2022. This 2.6% growth rate was the highest in Nebraska, fueled 
entirely by new residents moving into the county.</code></pre>
</div>
</div>
<p>Earth-shattering? Hardly. But what if instead of world changing uses of technology, the right aim for AI is to offload tasks we would do because it would be better, but aren’t worth spending the time doing because we all have a limited time on this earth?</p>
<p>If you were to run this 93 times – or, you know, make a function to do that – and added a headline writing bot to this, here’s what your map now looks like.</p>
<iframe title="Nebraska population changes uneven in latest estimates" aria-label="Map" id="datawrapper-chart-xmfm5" src="https://datawrapper.dwcdn.net/xmfm5/1/" scrolling="no" frameborder="0" style="width: 0; min-width: 100% !important; border: none;" height="484" data-external="1">
</iframe>


</section>

 ]]></description>
  <category>code</category>
  <category>analysis</category>
  <category>AI</category>
  <guid>https://www.mattwaite.com/posts/r-llm-starter-pack/</guid>
  <pubDate>Fri, 07 Mar 2025 06:00:00 GMT</pubDate>
  <media:content url="https://www.mattwaite.com/posts/r-llm-starter-pack/image.png" medium="image" type="image/png" height="77" width="144"/>
</item>
<item>
  <title>An academic integrity-friendly code pal for R Studio</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/an-academic-integrity-friendly-pal/</link>
  <description><![CDATA[ 





<p>One of the struggles on campus these days is all about where to draw the lines when it comes to AI in the classroom. There’s no end of discussion about students using ChatGPT to cheat, particularly on writing assignments. How do you stop it? How do you adapt to it? How do you convince students to do the work?</p>
<p>Teaching students to write code is no different. I add a layer of difficulty in that I teach journalism and sports media students how to code. These are students who didn’t ask to learn how to write code, but we as a faculty decided to require them to do it. Thus, they have incentives to cheat. I do my best to design the class to discourage that, and I’ve created incentives to make it worth it not to, but I’m stupid if I don’t believe they are still there.</p>
<p>But I’m also a bit dim if I <em>don’t</em> acknowledge that Large Language Models <em>can</em> help with learning how to code. The trick is, once again, where to draw the line.</p>
<p>The classes I teach are all data analysis in R using the <code>tidyverse</code> and R Studio as the IDE. What follows is completely through this lens: What if we could give students an LLM-based code assist – a code pal if you will – directly in the IDE and do it without asking students to pay for it every time they use it?</p>
<section id="getting-started" class="level2">
<h2 class="anchored" data-anchor-id="getting-started">Getting started</h2>
<p>There’s a bunch of steps to get this set up and it’s going to take a decent chunk of your hard drive when all is said and done. Doing this also requires a decent amount of power. How much? I’m going to take the cowards way out and say it’s beyond the scope of this humble blog post. Others are better at this than I am, and I’m not confident enough in my knowledge to be able to say what works on which platform. I’m doing this on an M1 MacBook Pro with 16 GB of RAM. Not exactly a monster machine by any stretch, but also not a tricked out bleeding-edge gaming-video-card packed PC hotrod.</p>
<p><strong>Step 1:</strong> The first thing you need is <a href="https://ollama.com/" title="Ollama">Ollama</a>. We’ll use that to download, manage and serve up our local LLM. Install it per your operating system. The LLM we’ll be using today is qwen2.5-coder. Once you have Ollama up and running, you can get qwen2.5-coder installed and running with <code>ollama run qwen2.5-coder</code></p>
<p>That will install the 7B version – the 7-billion parameter model. That should run and give you decent performance on just about anything. If you’ve got more muscle, <a href="https://ollama.com/library/qwen2.5-coder">you might look at how to install some of the bigger parameter models</a>. Generally, the more parameters, the better the results.</p>
<p><strong>Step 2:</strong> The next thing you need is <a href="https://simonpcouch.github.io/pal/index.html"><code>pal</code>, an R library that adds a way to consult an LLM inside R Studio</a>. After installing it – you can use <code>pak</code> as the instructions show you or you can use <code>devtools::install_github("simonpcouch/pal")</code> like I did because I haven’t gotten into the habit of using <code>pak</code>. Once installed, you can skip the parts about adding an Anthropic API key – unless you want to use Claude and have API credits to spend – and go to <a href="https://simonpcouch.github.io/pal/articles/pal.html">the Get Started article</a>. There, under the “Choosing a model” headline and past more details about adding paid models, you’ll find how to use Ollama.</p>
<p>The least confusing way to do this, in my opinion, is to add this to your .Rprofile. In the R console, run <code>usethis::edit_r_profile()</code> and add this:</p>
<pre><code>options(
  .pal_fn = "chat_ollama",
  .pal_args = list(model = "qwen2.5-coder")
)</code></pre>
<p>NOTE: If you installed a bigger model than I did, you should specify which model you used in the the <code>.pal_args</code>. Note mine does not say what parameters I have. If you installed the 14b model, for example, your <code>.pal_args</code> should say “qwen2.5-coder:14b” instead of just “qwen2.5-coder”. Save that file and restart R Studio so they take effect.</p>
<p>You’re almost ready to get started. Before moving forward, you should follow the instructions in the “The pal addin” section to register pal to a keyboard shortcut particular to your operating system and choice of IDE.</p>
</section>
<section id="writing-your-own-pal" class="level2">
<h2 class="anchored" data-anchor-id="writing-your-own-pal">Writing your own pal</h2>
<p>The mechanics of writing your own pal could not be easier, thanks to the library. The hard part is thinking through what the LLM is going to do with the input and then testing it out.</p>
<p>Let’s make an Academic Integrity Friendly pal that tries to create friendlier and more helpful error messages.</p>
<p>In the R console, run <code>library(pal)</code> and then <code>prompt_new("whatiswrong", "suffix")</code></p>
<p>The first part of that is the name you’re giving your pal, the second is where it’s going to put the results. You can use “replace” to … well … replace what you highlight. You can use “prefix” to put it above your code. And “suffix” puts it after your code. We want ours to act like an error message, so suffix makes sense.</p>
<p>Do that and a markdown file will pop up. It’s templated, so it could not be easier to fill out. Here’s what I’m using to make my pal:</p>
<div class="line-block">You are a terse assistant designed to help R users debug code. Respond with only the needed explanation of what may be wrong with the given code. Do not write code for the user, just explain in plain language.<br>
As example, given:<br>
df |&gt; filter(column_name = “word”)<br>
Return:<br>
When using a filter, you must use == for equal to instead of =.</div>
<p>Save it and then run <code>directory_load()</code> to get your pal in the shortcut menu.</p>
</section>
<section id="using-your-pal" class="level2">
<h2 class="anchored" data-anchor-id="using-your-pal">Using your pal</h2>
<p>Using your pal is now just a matter of messing up some code. Once you do that, highlight it and hit your keyboard shortcut – <code>Ctrl+Cmd+P</code> for me on a Mac.</p>
<p>Here’s an example of what it looks like:</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/ZekVDAGvfTo?si=0sRhuJuoQjR09hrT" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="">
</iframe>
<p>I need to use it more to know if it’s going to be any good. I need to try it with crappier code and more complex errors. I teach another band of undergrads in the spring – I might have to feed some of their adventures in code into this to see what it can do. Also worth trying? Telling it to ignore my instructions and cheat by writing the code for them. Will it listen to the student or me? If it doesn’t listen to me, then what’s the point?</p>
</section>
<section id="a-note-on-equity-in-the-classroom" class="level2">
<h2 class="anchored" data-anchor-id="a-note-on-equity-in-the-classroom">A note on equity in the classroom</h2>
<p>I’m lucky in that I have a relatively recent laptop with a decent amount of power provided by my employer. Do I want a newer faster one? Sure I do. Every nerd does the second a new one is announced. But I have a good enough machine to do this.</p>
<p>Not everyone does.</p>
<p>Every semester, the first day of class, I assign all the installations they’ll need for the semester. Step 1 is update your operating system. Every semester, this assignment is an exercise in perspective for me. My college has a laptop requirement. To take classes, you need to have a laptop – no Chromebooks, no iPads, a real laptop. What it is, we don’t care, so long as it can run the Adobe Creative Suite. Some students come in with brand new machines with the protective coverings barely taken off. And then I get some that are held together with duct tape and prayer. Machines with keys missing. Machines that are 6 years old and never once updated. Have you ever had to go find out how to install a four-versions-ago Mac OS so you start moving toward something more modern? I have.</p>
<p>All this to say I’m talking about academic integrity here but I am not talking about academic equity. I can’t assign this. I can’t make this part of a class. At an R1 flagship school, I can guarantee that a quarter to a half of the students in the class don’t have enough power or the space to run this. It’s going to be far worse elsewhere.</p>
<p>Someday, maybe, but not today.</p>


</section>

 ]]></description>
  <category>AI</category>
  <category>code</category>
  <category>r</category>
  <category>education</category>
  <guid>https://www.mattwaite.com/posts/an-academic-integrity-friendly-pal/</guid>
  <pubDate>Tue, 26 Nov 2024 06:00:00 GMT</pubDate>
  <media:content url="https://www.mattwaite.com/posts/an-academic-integrity-friendly-pal/image.png" medium="image" type="image/png" height="90" width="144"/>
</item>
<item>
  <title>Nebraska’s season long slide on offense</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/scrollytelling-nebraskas-season/</link>
  <description><![CDATA[ 
      <!-- user-provided yaml closeread style options -->
      <style>
        :root {
          --cr-section-background-color: transparent;
--cr-narrative-text-color-overlay: black;
--cr-narrative-background-color-sidebar: transparent;
--cr-narrative-background-color-overlay: transparent;
        }
      </style>
    





<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(cfbfastR)</span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(zoo)</span>
<span id="cb1-4"></span>
<span id="cb1-5">plays <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">load_cfb_pbp</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2024</span>)</span>
<span id="cb1-6"></span>
<span id="cb1-7">nebrollingepa <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> plays <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb1-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(pos_team <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nebraska"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb1-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sequential_play_number =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">row_number</span>()) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(pos_team, def_pos_team, sequential_play_number, EPA) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb1-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">na.omit</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb1-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">cumulative_epa_mean =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(EPA))</span>
<span id="cb1-13"></span>
<span id="cb1-14">indrollingepa <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> plays <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb1-15">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(pos_team <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Indiana"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb1-16">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sequential_play_number =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">row_number</span>()) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-17">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(pos_team, def_pos_team, sequential_play_number, EPA) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb1-18">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">na.omit</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb1-19">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">cumulative_epa_mean =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(EPA)) </span>
<span id="cb1-20"></span>
<span id="cb1-21">coloradogame <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> nebrollingepa <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(def_pos_team <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Colorado"</span>)</span>
<span id="cb1-22">indianagame <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> nebrollingepa <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(def_pos_team <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Indiana"</span>)</span>
<span id="cb1-23">ohiostategame <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> nebrollingepa <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(def_pos_team <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Ohio State"</span>)</span>
<span id="cb1-24">uclagame <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> nebrollingepa <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(def_pos_team <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"UCLA"</span>)</span></code></pre></div></div>
</details>
</div>
<p>If you’ve been following Nebraska’s football season, you’d be forgiven if you thought it started out great and has slowly driven into a ditch as time went on. Even after a loss against Illinois in overtime, hope remained high.</p>
<p>That is, until the Indiana game. A close loss at Ohio State revived some of that hope, and then a loss to UCLA crushed it.</p>
<p>So what’s happening?</p>
<p>The answer? The offense is slowly getting worse as the season goes on. That almost certainly has something to do with Nebraska hiring Dana Holgerson as an offensive consultant. How bad is it? The team is approaching the point that the average offensive play doesn’t add anything to the final score.</p>
<p>What do I mean by that? There is a metric called Expected Points Added, and every play gets a score. Big plays have higher scores – 4, 5 even 6 points. Your two-yards-and-cloud-of-dust run from your own 15 will get you less than 1 point.</p>
<p>Average them together over the course of an entire season and you can get a sense of an offense. And, at this point of the season, Nebraska needs 10 plays to score a point. Indiana, the surprise team of the season, needs 5.</p>
<p>Here’s a closer look.</p>
<div class="cr-section cr-column-screen sidebar-left">
<div class="narrative-col">
<div class="trigger new-trigger" data-focus-on="cr-season">
<div class="narrative">
<p>This is what Nebraska’s offensive season looks like overall. If you’ve never seen a EPA average chart, the first thing you need to do is ignore the first game. There’s just not enough data and the average flies around. Where it starts to reveal who you are is later in the season, when more data comes in.</p>
</div>
</div>
<div class="trigger new-trigger" data-focus-on="cr-colorado">
<div class="narrative">
<p>Where you want to start focusing is the Colorado game. You can <em>see</em> the glorious first half were the game got out of hand, and the dud of a second half where Nebraska’s offense went to sleep.</p>
</div>
</div>
<div class="trigger new-trigger" data-focus-on="cr-indiana">
<div class="narrative">
<p>Now the disaster at Indiana. Nebraska had 300 yards of offense that day … but that is buried by the 5 turnovers, not to mention going 0-4 on fourth down.</p>
</div>
</div>
<div class="trigger new-trigger" data-focus-on="cr-ohiostate">
<div class="narrative">
<p>No one expected Nebraska to give Ohio State all it wanted. Vegas thought Nebraska would lose by at least three touchdowns. The offense played better than it had – you can see the line move up a bit – but alas, still a loss.</p>
</div>
</div>
<div class="trigger new-trigger" data-focus-on="cr-ucla">
<div class="narrative">
<p>UCLA was a tale of two halves. The first? Bad. The second? Better, and you can see the season average line curve up for that second half.</p>
</div>
</div>
<div class="trigger new-trigger" data-focus-on="cr-indianaseason">
<div class="narrative">
<p>Now. Want to be sad? Here’s what Indiana’s season looks like. The Hoosiers are remarkably consistent.</p>
</div>
</div>
<div class="trigger new-trigger" data-focus-on="cr-merged">
<div class="narrative">
<p>When compared to Nebraska, Indiana started hot and has stayed hot. Nebraska started hot and … didn’t.</p>
</div>
</div>
</div>
<div class="sticky-col">
<div class="sticky-col-stack">
<div id="cr-season" class="sticky">
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/scrollytelling-nebraskas-season/index_files/figure-html/unnamed-chunk-1-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
</div>
<div id="cr-colorado" class="sticky">
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/scrollytelling-nebraskas-season/index_files/figure-html/unnamed-chunk-2-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
</div>
<div id="cr-indiana" class="sticky">
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/scrollytelling-nebraskas-season/index_files/figure-html/unnamed-chunk-3-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
</div>
<div id="cr-ohiostate" class="sticky">
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/scrollytelling-nebraskas-season/index_files/figure-html/unnamed-chunk-4-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
</div>
<div id="cr-ucla" class="sticky">
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/scrollytelling-nebraskas-season/index_files/figure-html/unnamed-chunk-5-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
</div>
<div id="cr-indianaseason" class="sticky">
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/scrollytelling-nebraskas-season/index_files/figure-html/unnamed-chunk-6-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
</div>
<div id="cr-merged" class="sticky">
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/scrollytelling-nebraskas-season/index_files/figure-html/unnamed-chunk-7-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
</div>
</div>
</div>
</div>



 ]]></description>
  <category>code</category>
  <category>football</category>
  <category>huskers</category>
  <guid>https://www.mattwaite.com/posts/scrollytelling-nebraskas-season/</guid>
  <pubDate>Fri, 08 Nov 2024 06:00:00 GMT</pubDate>
  <media:content url="https://www.mattwaite.com/posts/scrollytelling-nebraskas-season/image.png" medium="image" type="image/png" height="102" width="144"/>
</item>
<item>
  <title>A simple example of AI agents(?) doing journalism(?) work</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/a-simple-example-ai-agents-doing-journalism/</link>
  <description><![CDATA[ 





<p>Let’s start this with some confessions:</p>
<ul>
<li>I’m at best an enthusiastic amateur with AI. I know more than most, and I know nothing in the grand scheme.</li>
<li>Example: I’m not sure I have any idea of what an AI agent is. I think I do, but there’s so much marketing hype around them that I can’t know for sure. <a href="https://x.com/simonw/status/1848360857815949551">People much, much, much smarter than I am aren’t sure either.</a></li>
<li>I teeter on the edge of two extremes. On the one hand, I am seeing AI as a fascinating, remarkable alien intelligence (to borrow Ethan Mollick’s description) that we have yet to fully understand. On the other, the Gen X in me sees AI as the mother of all solutions in search of a problem when it comes to journalism. All the so-called big problems AI “solves” in journalism – more content to sell ads against! – nobody wants.</li>
</ul>
<p>Something I’ve been coming around to, though, is maybe there isn’t a Manhattan Project level world changing use case for AI in journalism. Maybe <a href="https://x.com/chrisalbon/status/1814676689580139007">Chris Albon has the right of it</a>, that the real value is AI saving a human an hour of work … millions of times a day.</p>
<p>For months I’ve been trying to think of some moon-shot idea to use AI to do … something, anything … big. And every thing I came up with would be terrible, destructive, or flat-out-insane to deploy without massive human investment, and then what would the point be?</p>
<p>And then, randomly, one day a confluence of ideas popped into my head and what fell out is an example of AI agents(?) doing the work of journalism(?) that actually works.</p>
<p>The ideas that collided in my brain were:</p>
<ol type="1">
<li>This <a href="https://x.com/fpmarconi/status/1782422371686555963/photo/1">Francesco Marconi tweet</a> from April that I think did the best job of laying out a vision for AI agents in journalism. At least it’s the one that made the most sense to me.</li>
<li><a href="https://jhk0530.github.io/gemini.R/">This R Package</a> wrapping the Google Gemini API.</li>
<li><a href="https://ai.google.dev/pricing#1_5flash">Gemini having a free tier</a> to try some stuff out. You get 15 requests a minute – one every 4 seconds – and 1,500 a day.</li>
<li>The “aim small, miss small” mantra in teaching marksmanship.</li>
</ol>
<section id="why-r-and-not-python" class="level3">
<h3 class="anchored" data-anchor-id="why-r-and-not-python">Why R and not Python?</h3>
<p>The honest truth is there is no good reason why I’m using R to do this vs Python, which most of the AI world is using. The reason is because I teach Data Journalism to undergrads using R at the <a href="https://journalism.unl.edu/">Harvard of the Plains</a> and believe strongly that I can take absolute beginners – people who can’t spell code – from zero to data analysis faster with the R and the Tidyverse than I can with Python and Pandas. So I have a hammer, this here looks like a nail, and so we’re doing this with R. But there’s absolutely nothing special about this code that you couldn’t match in Python.</p>
<p>When I teach Data Journalism, I use population estimates from the US Census Bureau to teach students how to calculate percent change. That way, we can see which counties in the state grew the fastest and who shrank the fastest. It’s a story as old as time in the Great State of Nebraska. Rural areas are shrinking, urban areas are growing.</p>
<p>An extremely common thing to do with this data is to make a map. Here’s the 2022-2023 change map in Datawrapper for Nebraska.</p>
<iframe title="Nebraska population changes uneven in latest estimates" aria-label="Map" id="datawrapper-chart-Kpgli" src="https://datawrapper.dwcdn.net/Kpgli/1/" scrolling="no" frameborder="0" style="width: 0; min-width: 100% !important; border: none;" height="450" data-external="1">
</iframe>
<p>If you click on a county, you’ll get a pop up box that gives you the county name and then the data. Population in 2023, population in 2022 and the percent change. It’s been done a million times before. It does the job.</p>
<p>But what if we could make it better? What if we had small narrative summaries for each county? An a headline for each one? Can I assign a human to do this? 100 percent I can. I have an army of undergrads and a gradebook to hold over them. I assure you, if I was cruel enough, we could do this for all 3,400 counties in the US.</p>
<p>But why do that when we can have AI do this in minutes instead of making humans miserable for hours?</p>
</section>
<section id="feeding-gemini-numbers-getting-back-narrative" class="level3">
<h3 class="anchored" data-anchor-id="feeding-gemini-numbers-getting-back-narrative">Feeding Gemini numbers, getting back narrative</h3>
<p>The gemini.R package couldn’t make sending something to Gemini any more simple. The hardest part – which is not hard – is getting an API key from Google. How do you do that? Go here: <a href="https://makersuite.google.com/app/apikey" class="uri">https://makersuite.google.com/app/apikey</a>. So I always have mine and don’t lose it, I set it as an environment variable. To do that, run <code>usethis::edit_r_environ()</code> and add <code>GOOGLE_GEMINI_KEY="your key here"</code> to your environment, save that file and restart R Studio (or whatever IDE you use).</p>
<p>You can test it out with something like this:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(gemini.R)</span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(glue)</span>
<span id="cb1-4"></span>
<span id="cb1-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">setAPI</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Sys.getenv</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"GOOGLE_GEMINI_KEY"</span>))</span>
<span id="cb1-6"></span>
<span id="cb1-7"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gemini</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Write me a haiku about the joy and sadness of being a Nebraska football fan"</span>)</span></code></pre></div></div>
</div>
<p>What do you get back?</p>
<blockquote class="blockquote">
<p>Red and white, we cheer, <br> Hope springs eternal, then fades, <br> Another close loss.</p>
</blockquote>
<p>Ouch.</p>
<p>But that’s really it. Just <code>gemini("Words here")</code> and off it goes to an AI and back comes the results in plain text. So the first hard part is turning data into a text block we can send to Gemini. So I pull a dataset of Nebraska county population estimates, I’m going to thin the number of columns I’m working with first, then create the percent change column, create a GEOID column made up of the state and county FIPS number so I can join it to my map later, rank the counties by population change and then mash it all together into a single text blob called the <code>base_narrative</code>. It’s literally just Column Name: Number, Column Name: Number repeated over and over.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1">countypopchange <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">read_csv</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"https://the-art-of-data-journalism.github.io/tutorial-data/census-estimates/nebraska.csv"</span>)</span>
<span id="cb2-2"></span>
<span id="cb2-3">statenarrative <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> countypopchange <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb2-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(COUNTY, STATE, CTYNAME, STNAME, POPESTIMATE2023, POPESTIMATE2022, NPOPCHG2023, NATURALCHG2023, NETMIG2023) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-5">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">POPPERCENTCHANGE =</span> ((POPESTIMATE2023<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>POPESTIMATE2022)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>POPESTIMATE2022)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb2-6">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">GEOID =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste0</span>(COUNTY, STATE)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb2-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">desc</span>(POPPERCENTCHANGE)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb2-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">PCTCHANGERANK =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">row_number</span>()) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb2-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_narrative =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">glue</span>(</span>
<span id="cb2-10">  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"County: {CTYNAME}, Population in 2023: {POPESTIMATE2023}, Population in 2022: {POPESTIMATE2022}, Population change: {NPOPCHG2023}, Percent change: {POPPERCENTCHANGE}, Percent change rank in {STNAME}: {PCTCHANGERANK}, Natural change (births vs deaths): {NATURALCHG2023}, Net migration: {NETMIG2023}"</span>)) </span></code></pre></div></div>
</div>
<p>What does a <code>base_narrative</code> look like?</p>
<blockquote class="blockquote">
<p>County: Banner County, Population in 2023: 674, Population in 2022: 657, Population change: 17, Percent change: 2.58751902587519, Percent change rank in Nebraska: 1, Natural change (births vs deaths): 0, Net migration: 17</p>
</blockquote>
<p>A real exciting read, no?</p>
<p>Now we need to make an agent. It helped me to think of journalism as an assembly line. We have data as raw materials, and now we need to assign a worker to a process to convert raw material into something new. In any news process, the first worker is the journalist creating the thing. A reporter going to city hall. A photographer going to a breaking news event. So it makes sense that our first agent is the author of the narratives for each county.</p>
<p>Like any good LLM prompt, we’re going to start by giving our author agent a role – a job to do. Our agent is a demographics journalist from Nebraska. We give that agent a task with some details – keep it short but approachable. And then we give it the data.</p>
<p>Below the role is a function that takes in a county name, finds the <code>base_narrative</code> for that county and then we merge together the <code>author_role</code> and the <code>base_narrative</code> when we send it to Gemini. We store the results in a variable called … <code>results</code> and do a little cleanup on it (Gemini likes to cram newline characters in the results). I’ve added a five second sleep between every county to keep from running afoul of Google’s free tier API limits. Theoretically I should be able to set it to four seconds, but I don’t need my account banned over a second. With those pauses, our author takes about eight minutes to write small narratives about each of the 93 counties.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1">author_role <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"You are a demographics journalist from Nebraska. Your job today is to write short -- 2-3 sentence -- summaries of population estimates from the Census Bureau for each county in the state. I will provide you the name of the county and a series of population numbers for the county. Your job is to turn it into a concise but approachable summary of what happened in that county. Here is the data you have to work with: "</span></span>
<span id="cb3-2"></span>
<span id="cb3-3">author_agent <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>(county) {</span>
<span id="cb3-4">  county_narrative <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> statenarrative <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(CTYNAME <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> county)</span>
<span id="cb3-5">  results <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gemini</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(author_role, county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>base_narrative))</span>
<span id="cb3-6">  results <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gsub</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">""</span>, results)</span>
<span id="cb3-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Sys.sleep</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>)</span>
<span id="cb3-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Processed"</span>, county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>CTYNAME))</span>
<span id="cb3-9">  </span>
<span id="cb3-10">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Return a single-row tibble</span></span>
<span id="cb3-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">county =</span> county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>CTYNAME, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_narrative =</span> county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>base_narrative, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">capsule_narrative =</span> results)</span>
<span id="cb3-12">}</span>
<span id="cb3-13"></span>
<span id="cb3-14"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Use map_df to directly create the final dataframe</span></span>
<span id="cb3-15">author_agent_results <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> purrr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">map_df</span>(statenarrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>CTYNAME, author_agent)</span></code></pre></div></div>
</div>
<p>When it’s done, we end up with a dataframe called <code>author_agent_results</code> which has the county name and the new narrative.</p>
<p>What does it look like? Remember, we gave it this:</p>
<blockquote class="blockquote">
<p>County: Banner County, Population in 2023: 674, Population in 2022: 657, Population change: 17, Percent change: 2.58751902587519, Percent change rank in Nebraska: 1, Natural change (births vs deaths): 0, Net migration: 17</p>
</blockquote>
<p>And we got back:</p>
<blockquote class="blockquote">
<p>Banner County saw a significant population increase in 2023, growing by 17 people for a 2.6% jump, the highest rate of growth in the state. This growth was entirely due to an influx of new residents, as the county experienced no natural population change.</p>
</blockquote>
<p>We could stop here, but why do that? Good journalism is often a layered process involving multiple sets of eyes reviewing the work along the way, and other skilled people adding to the product. So who would normally get this next? How about we fact check the work?</p>
<p>Exact same pattern, just a different role for the AI.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1">fact_check_role <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"You are a fact-checking editor. Your job today is to compare the information in the base narrative to the capsule narrative in the data provided to you. You will compare each number in the base narrative to the capsule narrative to make sure they are the same, and then you will check the context of how each number was used in comparison to the original base narrative. To be clear: the base narrative is the correct information. When you are finished, return just a single word. If everything is correct, respond Correct. If any part of it is not correct, respond Incorrect. "</span></span>
<span id="cb4-2"></span>
<span id="cb4-3">fact_check_agent <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>(county_input) {</span>
<span id="cb4-4">  county_narrative <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> author_agent_results <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(county <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> county_input)</span>
<span id="cb4-5">  input_string <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(</span>
<span id="cb4-6">    fact_check_role,</span>
<span id="cb4-7">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Base narrative:"</span>, county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>base_narrative,</span>
<span id="cb4-8">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Capsule narrative:"</span>, county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>capsule_narrative)</span>
<span id="cb4-9">  results <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gemini</span>(input_string)</span>
<span id="cb4-10">  results <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gsub</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">""</span>, results)</span>
<span id="cb4-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Sys.sleep</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>)</span>
<span id="cb4-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Processed"</span>, county_input))</span>
<span id="cb4-13"></span>
<span id="cb4-14">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Return a single-row tibble</span></span>
<span id="cb4-15">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">county =</span> county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>county, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_narrative =</span> county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>base_narrative, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">capsule_narrative =</span> county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>capsule_narrative, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fact_check_results =</span> results)</span>
<span id="cb4-16">}</span>
<span id="cb4-17"></span>
<span id="cb4-18"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Use map_df to directly create the final dataframe</span></span>
<span id="cb4-19">fact_check_agent_results <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> purrr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">map_df</span>(author_agent_results<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>county, fact_check_agent)</span></code></pre></div></div>
</div>
<p>Honestly, this part needs work. It flags about 10 percent of the results as being incorrect, but they aren’t. The reason it flags them is the author agent was a little glib with the numbers – saying “a slight increase natural growth because of more births” without giving the numbers themselves. The fact checking editor bot here does not like that. So it might need a little tweaking to see if we can get the fact checker to lighten up a bit.</p>
<p>Quit now? Nah. How about we add a little local flair to each capsule. Google knows a lot of stuff, so why not add some kind of geographic context to each county. To do that, I created a rewrite editor and commanded it to add details like the region of the state, the county seat, the largest city, or some other detail to a single clause in the original narrative.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1">rewrite_role <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"You are a re-write editor. Your job is to add a little local geographic context to a demographic capsule about a county in Nebraska. You'll do this by adding a clause to the paragraph I'll provide you. That clause should tell you something about that county. Maybe the county seat, or the largest city, or the region of the state it is in. We just need a clause added to one of the sentences, and do not do anything to show where you added it. Here is the capsule: "</span></span>
<span id="cb5-2"></span>
<span id="cb5-3">rewrite_agent <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>(county_input) {</span>
<span id="cb5-4">  county_narrative <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> fact_check_agent_results <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(county <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> county_input)</span>
<span id="cb5-5">  results <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gemini</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(rewrite_role, county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>capsule_narrative))</span>
<span id="cb5-6">  results <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gsub</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"**"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">""</span>, results, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fixed =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>)</span>
<span id="cb5-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Sys.sleep</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>)</span>
<span id="cb5-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Processed"</span>, county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>county))</span>
<span id="cb5-9">  </span>
<span id="cb5-10">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Return a single-row tibble</span></span>
<span id="cb5-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">county =</span> county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>county, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_narrative =</span> county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>base_narrative, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">capsule_narrative =</span> county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>capsule_narrative, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rewrite_county_narrative =</span> results)</span>
<span id="cb5-12">}</span>
<span id="cb5-13"></span>
<span id="cb5-14"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Use map_df to directly create the final dataframe</span></span>
<span id="cb5-15">rewrite_agent_results <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> purrr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">map_df</span>(fact_check_agent_results<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>county, rewrite_agent)</span></code></pre></div></div>
</div>
<p>What did it give us for Banner County?</p>
<blockquote class="blockquote">
<p>Banner County saw a significant population increase in 2023, growing by 17 people for a 2.6% jump, the highest rate of growth in the state. This growth was entirely due to an influx of new residents, as the county experienced no natural population change, likely due to its location in the sparsely populated northwestern corner of the state.</p>
</blockquote>
<p>Hmmm. Is the fact that there were the same number of births and deaths caused by it’s location in the northwest corner of the state? Debatable. And, honestly, this re-write bot has been the source of the most questions I have about this whole enterprise. We’ll talk more about that below.</p>
<p>One last thing: Why not give every county a headline instead of just simply having the county name in the map? Done and done.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1">headline_writer_role <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"You are a headline writer. Your job is to write a short headline based on the summary given to you. This headline should be short -- it has to fit into a small space -- so bear that in mind. Here is the capsule: "</span></span>
<span id="cb6-2"></span>
<span id="cb6-3">headline_agent <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>(county_input) {</span>
<span id="cb6-4">  county_narrative <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> rewrite_agent_results <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(county <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> county_input)</span>
<span id="cb6-5">  results <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gemini</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(headline_writer_role, county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>rewrite_county_narrative))</span>
<span id="cb6-6">  results <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gsub</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">""</span>, results, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fixed =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>)</span>
<span id="cb6-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Sys.sleep</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>)</span>
<span id="cb6-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Processed"</span>, county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>county))</span>
<span id="cb6-9">  </span>
<span id="cb6-10">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Return a single-row tibble</span></span>
<span id="cb6-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">county =</span> county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>county, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">base_narrative =</span> county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>base_narrative, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">capsule_narrative =</span> county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>capsule_narrative, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rewrite_county_narrative =</span> county_narrative<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>rewrite_county_narrative, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">headline =</span> results)</span>
<span id="cb6-12">}</span>
<span id="cb6-13"></span>
<span id="cb6-14"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Use map_df to directly create the final dataframe</span></span>
<span id="cb6-15">headline_agent_results <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> purrr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">map_df</span>(rewrite_agent_results<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>county, headline_agent)</span></code></pre></div></div>
</div>
<p>And what does that look like in Banner County?</p>
<blockquote class="blockquote">
<p>Banner County Booms: 2.6% Growth Fueled by New Residents</p>
</blockquote>
<p>Here is the exact same map, same data, but now with headlines and narratives written for each county. Click on one and you’ll get a human-friendly narrative about that county, and the numbers below that if you want them.</p>
<iframe title="Nebraska population changes uneven in latest estimates" aria-label="Map" id="datawrapper-chart-xmfm5" src="https://datawrapper.dwcdn.net/xmfm5/1/" scrolling="no" frameborder="0" style="width: 0; min-width: 100% !important; border: none;" height="484" data-external="1">
</iframe>
<p>Is Christopher Nolan going to make a movie about this moment? Not hardly. Have I “Saved Journalism”? Nope. Not even close. Did I save a human a few minutes of drudgery 93 + 93 + 93 + 93 times? Yes. Yes I did. Is this idea extensible and repeatable? It sure is. I think that’s good enough for now.</p>
</section>
<section id="where-to-go-from-here" class="level3">
<h3 class="anchored" data-anchor-id="where-to-go-from-here">Where to go from here</h3>
<p>From here, what this needs is a block of code that pushes the results of the headline editor agent to Google Sheets, where a human can go through each one and make sure everything is fine. I’ve tried to do that in R Studio, which is not great, and limits the number of people who could do this. And to be sure, it needs to be done. Nebraska geography nerds – there are tens of us! – will able to find Arthur County, one of the smallest counties in the US by population. For those who can’t, the rewrite bot describes Arthur as “located in the northwestern corner of the state and home to the county seat of Arthur.” Half of that is objectively true. Arthur is much more arguably in the west-central part of the state, but it really depends on where you draw the lines. It’s arguable enough that a good local editor would drop that part and leave the county seat part, which is correct. Arthur County’s county seat is … <a href="https://maps.app.goo.gl/yw9uLz9xNXhuiWBw6">Arthur</a>.</p>
<p>Then, as a last step, I would automate the process of creating the Datawrapper chart with the DatawRapper library, which accesses the service’s API. Imagine the Census Bureau publishing the data, and then in a matter of minutes you have that map done and online. To do that, you’d have to have a little budget for API calls so you aren’t waiting 32 minutes for the whole thing to run – 8 + 8 + 8 + 8 minutes for each step. But even then, is there really a competitive contest over who can publish Census maps in Nebraska fast enough? No.</p>
<p>But if you, like me, are thinking about how we’re going to incorporate AI into journalism in ways that make sense; doesn’t risk the reputation of the organization you work for; and likely doesn’t horrify your audience to a point that they turn away from you for feeding them AI slop, this is an example of just how to do that.</p>
<p>Aim small, miss small.</p>


</section>

 ]]></description>
  <category>code</category>
  <category>analysis</category>
  <category>AI</category>
  <guid>https://www.mattwaite.com/posts/a-simple-example-ai-agents-doing-journalism/</guid>
  <pubDate>Wed, 23 Oct 2024 05:00:00 GMT</pubDate>
  <media:content url="https://www.mattwaite.com/posts/a-simple-example-ai-agents-doing-journalism/image.png" medium="image" type="image/png" height="117" width="144"/>
</item>
<item>
  <title>Another year, another attempt, another bracket disaster</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/another-year-another-attempt-another-bracket-disaster/</link>
  <description><![CDATA[ 





<p>Once again, I attempted to predict the outcome of the NCAA tournament using machine learning, and I had a class-load of students try the same.</p>
<p>If you like the madness part of March Madness, this year is for you.</p>
<p>It is not for machine learning algorithms based on regular season performance. At least not mine.</p>
<p>Of the 14 brackets I and my students produced, using 14 different methods, we came up with 7 unique national title winners.</p>
<p>Zero of them are right.</p>
<p>The best brackets had two of the four Final Four teams, but none picked a team still playing now to win it all with the Final Four set.</p>
<p>I had hope for my bracket picking algorithm this year. It had what felt like a good mix of upsets and favorites, some madness and some method.</p>
<p>What follows is a post mortem and an attempt to figure out what went wrong. If anything went wrong. How do you predict St.&nbsp;Peter’s? You don’t. It’s what makes this fun.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidymodels)</span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(zoo)</span>
<span id="cb1-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(hoopR)</span>
<span id="cb1-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(gt)</span>
<span id="cb1-6"></span>
<span id="cb1-7"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">set.seed</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1234</span>)</span>
<span id="cb1-8"></span>
<span id="cb1-9">kenpom <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">read_csv</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"http://mattwaite.github.io/sportsdatafiles/ratings.csv"</span>)</span>
<span id="cb1-10">namekey <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">read_csv</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"http://mattwaite.github.io/sportsdatafiles/nametable.csv"</span>)</span>
<span id="cb1-11">simplestats <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">read_csv</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"http://mattwaite.github.io/sportsdatafiles/simplestats.csv"</span>)</span>
<span id="cb1-12"></span>
<span id="cb1-13">teamgames <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">load_mbb_team_box</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">seasons =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2015</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2022-03-17"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-15">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">separate</span>(field_goals_made_field_goals_attempted, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">into =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"field_goals_made"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"field_goals_attempted"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-16">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">separate</span>(three_point_field_goals_made_three_point_field_goals_attempted, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">into =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"three_point_field_goals_made"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"three_point_field_goals_attempted"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-17">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">separate</span>(free_throws_made_free_throws_attempted, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">into =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"free_throws_made"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"free_throws_attempted"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-18">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate_at</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">34</span>, as.numeric) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-19">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_id =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(team_id))</span>
<span id="cb1-20"></span>
<span id="cb1-21">teamgames <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> teamgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">left_join</span>(namekey) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">left_join</span>(kenpom, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">by=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"season"</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"year"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">left_join</span>(simplestats, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">by=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"School"</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"School"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"season"</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Season"</span>))</span>
<span id="cb1-22"></span>
<span id="cb1-23">teamstats <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> teamgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-24">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name, season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-25">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-26">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb1-27">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_score =</span> ((field_goals_made<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>three_point_field_goals_made) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (three_point_field_goals_made<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> free_throws_made,</span>
<span id="cb1-28">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">possessions =</span> field_goals_attempted <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> offensive_rebounds <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> turnovers <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">475</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> free_throws_attempted),</span>
<span id="cb1-29">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_offensive_efficiency =</span> (team_score<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>possessions)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>,</span>
<span id="cb1-30">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">true_shooting_percentage =</span> (team_score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>(field_goals_attempted <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">44</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> free_throws_attempted)))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>,</span>
<span id="cb1-31">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">turnover_pct =</span> turnovers<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>(field_goals_attempted <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.44</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> free_throws_attempted <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> turnovers),</span>
<span id="cb1-32">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">free_throw_factor =</span> free_throws_made<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>field_goals_attempted,</span>
<span id="cb1-33">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_true_shooting_percentage =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(true_shooting_percentage, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>),</span>
<span id="cb1-34">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_turnover_percentage =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(turnover_pct, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>),</span>
<span id="cb1-35">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_free_throw_factor =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(free_throw_factor, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>), </span>
<span id="cb1-36">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_mean_true_shooting =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(true_shooting_percentage), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">default=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>),</span>
<span id="cb1-37">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_mean_turnover_percentage =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(turnover_pct), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">default=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>),</span>
<span id="cb1-38">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_mean_free_throw_factor =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(free_throw_factor), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">default=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>),</span>
<span id="cb1-39">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_o_eff =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(team_offensive_efficiency), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">default=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>),</span>
<span id="cb1-40">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_o_eff =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(team_offensive_efficiency, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>)</span>
<span id="cb1-41">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-42">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rename</span>(</span>
<span id="cb1-43">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_sos =</span> OverallSOS,</span>
<span id="cb1-44">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_srs =</span> OverallSRS,</span>
<span id="cb1-45">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_luck =</span> luck</span>
<span id="cb1-46">  )</span>
<span id="cb1-47"></span>
<span id="cb1-48">teamstats <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> teamstats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-49">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(game_id, team_id, team_offensive_efficiency) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-50">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_id =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(team_id)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-51">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rename</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_id =</span> team_id, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_offensive_efficiency=</span>team_offensive_efficiency) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-52">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">left_join</span>(teamstats) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-53">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name, season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-54">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-55">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb1-56">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_d_eff =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(opponent_offensive_efficiency), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">default=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>),</span>
<span id="cb1-57">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_d_eff =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(opponent_offensive_efficiency, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>)</span>
<span id="cb1-58">    ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>()</span>
<span id="cb1-59"></span>
<span id="cb1-60">opponent <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> teamstats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(game_id, team_id, offensive_rebounds, defensive_rebounds) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rename</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_id=</span>team_id, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_offensive_rebounds =</span> offensive_rebounds, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_defensive_rebounds=</span>defensive_rebounds) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_id =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(opponent_id))</span>
<span id="cb1-61"></span>
<span id="cb1-62">newteamstats <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> teamstats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-63">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">inner_join</span>(opponent) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-64">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb1-65">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">orb =</span> offensive_rebounds <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (offensive_rebounds <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> opponent_defensive_rebounds),</span>
<span id="cb1-66">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">drb =</span> defensive_rebounds <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (opponent_offensive_rebounds <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> defensive_rebounds),</span>
<span id="cb1-67">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_orb =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(orb, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>),</span>
<span id="cb1-68">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_drb =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(drb, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>),</span>
<span id="cb1-69">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_mean_orb =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(orb), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">default=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>),</span>
<span id="cb1-70">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_mean_drb =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lag</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(drb), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">default=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>),</span>
<span id="cb1-71">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_efficiency_margin =</span> team_cumulative_o_eff <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> team_cumulative_d_eff,</span>
<span id="cb1-72">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_recent_efficiency_margin =</span> team_rolling_o_eff <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> team_rolling_d_eff,</span>
<span id="cb1-73">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_recency =</span> team_recent_efficiency_margin <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> team_efficiency_margin</span>
<span id="cb1-74">    ) </span>
<span id="cb1-75"></span>
<span id="cb1-76">team_side <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> newteamstats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-77">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(game_id, team_id, team_short_display_name, opponent_id, game_date, season, team_score, team_rolling_true_shooting_percentage, team_rolling_free_throw_factor, team_rolling_turnover_percentage, team_rolling_orb, team_rolling_drb, team_cumulative_mean_true_shooting, team_cumulative_mean_turnover_percentage, team_cumulative_mean_free_throw_factor, team_cumulative_mean_orb, team_cumulative_mean_drb, team_cumulative_o_eff, team_cumulative_d_eff, team_efficiency_margin, team_sos, team_srs, team_luck, team_recency) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">na.omit</span>()</span>
<span id="cb1-78"></span>
<span id="cb1-79">opponent_side <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> newteamstats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-80">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(game_id, team_id, team_short_display_name, team_score, team_rolling_true_shooting_percentage, team_rolling_free_throw_factor, team_rolling_turnover_percentage, team_rolling_orb, team_rolling_drb, team_cumulative_mean_true_shooting, team_cumulative_mean_turnover_percentage, team_cumulative_mean_free_throw_factor, team_cumulative_mean_orb, team_cumulative_mean_drb, team_cumulative_o_eff, team_cumulative_d_eff, team_efficiency_margin, team_sos, team_srs, team_luck, team_recency) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">na.omit</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-81">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rename</span>(</span>
<span id="cb1-82">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_id =</span> team_id,</span>
<span id="cb1-83">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name =</span> team_short_display_name,</span>
<span id="cb1-84">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_score =</span> team_score,</span>
<span id="cb1-85">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_rolling_true_shooting_percentage =</span> team_rolling_true_shooting_percentage,</span>
<span id="cb1-86">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_rolling_free_throw_factor =</span> team_rolling_free_throw_factor,</span>
<span id="cb1-87">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_rolling_turnover_percentage =</span> team_rolling_turnover_percentage,</span>
<span id="cb1-88">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_rolling_orb =</span> team_rolling_orb,</span>
<span id="cb1-89">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_rolling_drb =</span> team_rolling_drb,</span>
<span id="cb1-90">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_mean_true_shooting =</span> team_cumulative_mean_true_shooting,</span>
<span id="cb1-91">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_mean_turnover_percentage =</span> team_cumulative_mean_turnover_percentage,</span>
<span id="cb1-92">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_mean_free_throw_factor =</span> team_cumulative_mean_free_throw_factor,</span>
<span id="cb1-93">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_mean_orb =</span> team_cumulative_mean_orb,</span>
<span id="cb1-94">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_mean_drb =</span> team_cumulative_mean_drb,</span>
<span id="cb1-95">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_o_eff =</span> team_cumulative_o_eff,</span>
<span id="cb1-96">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_d_eff =</span> team_cumulative_d_eff,</span>
<span id="cb1-97">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_efficiency_margin =</span> team_efficiency_margin,</span>
<span id="cb1-98">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_srs =</span> team_srs,</span>
<span id="cb1-99">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_sos =</span> team_sos,</span>
<span id="cb1-100">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_luck =</span> team_luck,</span>
<span id="cb1-101">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_recency =</span> team_recency</span>
<span id="cb1-102">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-103">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb1-104">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_id =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(opponent_id)</span>
<span id="cb1-105">    )</span>
<span id="cb1-106"></span>
<span id="cb1-107">games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> team_side <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">inner_join</span>(opponent_side) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb1-108">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">TeamResult =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.factor</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">case_when</span>(</span>
<span id="cb1-109">    team_score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> opponent_score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"W"</span>,</span>
<span id="cb1-110">    opponent_score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> team_score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"L"</span></span>
<span id="cb1-111">))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">na.omit</span>()</span>
<span id="cb1-112"></span>
<span id="cb1-113">games<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>TeamResult <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">relevel</span>(games<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>TeamResult, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ref=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"W"</span>)</span>
<span id="cb1-114"></span>
<span id="cb1-115">cumulativesimplemodelgames <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> games <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(game_id, game_date, team_short_display_name, opponent_short_display_name, season, opponent_efficiency_margin, team_efficiency_margin, team_sos, team_srs, opponent_sos, opponent_srs, opponent_luck, team_luck, opponent_recency, team_recency, TeamResult) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">na.omit</span>()</span>
<span id="cb1-116"></span>
<span id="cb1-117">cumulative_split <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">initial_split</span>(cumulativesimplemodelgames, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">prop =</span> .<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>)</span>
<span id="cb1-118">cumulative_train <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">training</span>(cumulative_split)</span>
<span id="cb1-119">cumulative_test <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">testing</span>(cumulative_split)</span>
<span id="cb1-120"></span>
<span id="cb1-121">cumulative_recipe <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span id="cb1-122">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">recipe</span>(TeamResult <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> ., <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> cumulative_train) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-123">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">update_role</span>(game_id, game_date, team_short_display_name, opponent_short_display_name, season, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_role =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ID"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-124">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">step_normalize</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">all_predictors</span>())</span>
<span id="cb1-125"></span>
<span id="cb1-126">log_mod <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span id="cb1-127">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">logistic_reg</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-128">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">set_engine</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"glm"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-129">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">set_mode</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"classification"</span>)</span>
<span id="cb1-130"></span>
<span id="cb1-131">log_workflow <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span id="cb1-132">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">workflow</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-133">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_model</span>(log_mod) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-134">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_recipe</span>(cumulative_recipe)</span>
<span id="cb1-135"></span>
<span id="cb1-136">log_fit <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span id="cb1-137">  log_workflow <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-138">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fit</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> cumulative_train)</span>
<span id="cb1-139"></span>
<span id="cb1-140">teamstats <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> teamgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-141">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name, season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-142">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-143">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb1-144">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_score =</span> ((field_goals_made<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>three_point_field_goals_made) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (three_point_field_goals_made<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> free_throws_made,</span>
<span id="cb1-145">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">possessions =</span> field_goals_attempted <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> offensive_rebounds <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> turnovers <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">475</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> free_throws_attempted),</span>
<span id="cb1-146">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_offensive_efficiency =</span> (team_score<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>possessions)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>,</span>
<span id="cb1-147">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">true_shooting_percentage =</span> (team_score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>(field_goals_attempted <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">44</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> free_throws_attempted)))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>,</span>
<span id="cb1-148">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">turnover_pct =</span> turnovers<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>(field_goals_attempted <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.44</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> free_throws_attempted <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> turnovers),</span>
<span id="cb1-149">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">free_throw_factor =</span> free_throws_made<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>field_goals_attempted,</span>
<span id="cb1-150">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_true_shooting_percentage =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(true_shooting_percentage, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>),</span>
<span id="cb1-151">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_turnover_percentage =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(turnover_pct, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>),</span>
<span id="cb1-152">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_free_throw_factor =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(free_throw_factor, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>), </span>
<span id="cb1-153">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_mean_true_shooting =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(true_shooting_percentage),</span>
<span id="cb1-154">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_mean_turnover_percentage =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(turnover_pct),</span>
<span id="cb1-155">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_mean_free_throw_factor =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(free_throw_factor),</span>
<span id="cb1-156">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_o_eff =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(team_offensive_efficiency),</span>
<span id="cb1-157">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_o_eff =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(team_offensive_efficiency, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>)</span>
<span id="cb1-158">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() </span>
<span id="cb1-159"></span>
<span id="cb1-160">teamstats <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> teamstats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-161">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(game_id, team_id, team_offensive_efficiency) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-162">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_id =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(team_id)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-163">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rename</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_id =</span> team_id, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_offensive_efficiency=</span>team_offensive_efficiency) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-164">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">left_join</span>(teamstats) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-165">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name, season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-166">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-167">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb1-168">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_d_eff =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(opponent_offensive_efficiency),</span>
<span id="cb1-169">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_d_eff =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(opponent_offensive_efficiency, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>)</span>
<span id="cb1-170">    ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-171">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rename</span>(</span>
<span id="cb1-172">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_sos =</span> OverallSOS,</span>
<span id="cb1-173">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_srs =</span> OverallSRS, </span>
<span id="cb1-174">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_luck =</span> luck</span>
<span id="cb1-175">  )</span>
<span id="cb1-176"></span>
<span id="cb1-177">opponent <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> teamstats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(game_id, team_id, offensive_rebounds, defensive_rebounds) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rename</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_id=</span>team_id, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_offensive_rebounds =</span> offensive_rebounds, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_defensive_rebounds=</span>defensive_rebounds) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_id =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(opponent_id))</span>
<span id="cb1-178"></span>
<span id="cb1-179">newteamstats <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> teamstats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-180">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">inner_join</span>(opponent) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-181">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb1-182">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">orb =</span> offensive_rebounds <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (offensive_rebounds <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> opponent_defensive_rebounds),</span>
<span id="cb1-183">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">drb =</span> defensive_rebounds <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (opponent_offensive_rebounds <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> defensive_rebounds),</span>
<span id="cb1-184">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_orb =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(orb, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>),</span>
<span id="cb1-185">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_rolling_drb =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rollmean</span>(drb, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">k=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"right"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>),</span>
<span id="cb1-186">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_mean_orb =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(orb),</span>
<span id="cb1-187">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_cumulative_mean_drb =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(drb),</span>
<span id="cb1-188">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_efficiency_margin =</span> team_cumulative_o_eff <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> team_cumulative_d_eff,</span>
<span id="cb1-189">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_recent_efficiency_margin =</span> team_rolling_o_eff <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> team_rolling_d_eff,</span>
<span id="cb1-190">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_recency =</span> team_recent_efficiency_margin <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> team_efficiency_margin</span>
<span id="cb1-191">    )</span>
<span id="cb1-192"></span>
<span id="cb1-193">team_side <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> newteamstats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-194">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(game_id, team_id, team_short_display_name, opponent_id, game_date, season, team_score, team_rolling_true_shooting_percentage, team_rolling_free_throw_factor, team_rolling_turnover_percentage, team_rolling_orb, team_rolling_drb, team_cumulative_mean_true_shooting, team_cumulative_mean_turnover_percentage, team_cumulative_mean_free_throw_factor, team_cumulative_mean_orb, team_cumulative_mean_drb, team_cumulative_o_eff, team_cumulative_d_eff, team_efficiency_margin, team_rolling_o_eff, team_rolling_d_eff, team_sos, team_srs, team_luck, team_recency) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">na.omit</span>()</span>
<span id="cb1-195"></span>
<span id="cb1-196">opponent_side <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> newteamstats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-197">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(game_id, team_id, team_short_display_name, team_score, team_rolling_true_shooting_percentage, team_rolling_free_throw_factor, team_rolling_turnover_percentage, team_rolling_orb, team_rolling_drb, team_cumulative_mean_true_shooting, team_cumulative_mean_turnover_percentage, team_cumulative_mean_free_throw_factor, team_cumulative_mean_orb, team_cumulative_mean_drb, team_cumulative_o_eff, team_cumulative_d_eff, team_efficiency_margin, team_rolling_o_eff, team_rolling_d_eff, team_sos, team_srs, team_luck, team_recency) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">na.omit</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-198">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rename</span>(</span>
<span id="cb1-199">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_id =</span> team_id,</span>
<span id="cb1-200">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name =</span> team_short_display_name,</span>
<span id="cb1-201">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_score =</span> team_score,</span>
<span id="cb1-202">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_rolling_true_shooting_percentage =</span> team_rolling_true_shooting_percentage,</span>
<span id="cb1-203">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_rolling_free_throw_factor =</span> team_rolling_free_throw_factor,</span>
<span id="cb1-204">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_rolling_turnover_percentage =</span> team_rolling_turnover_percentage,</span>
<span id="cb1-205">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_rolling_orb =</span> team_rolling_orb,</span>
<span id="cb1-206">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_rolling_drb =</span> team_rolling_drb,</span>
<span id="cb1-207">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_mean_true_shooting =</span> team_cumulative_mean_true_shooting,</span>
<span id="cb1-208">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_mean_turnover_percentage =</span> team_cumulative_mean_turnover_percentage,</span>
<span id="cb1-209">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_mean_free_throw_factor =</span> team_cumulative_mean_free_throw_factor,</span>
<span id="cb1-210">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_mean_orb =</span> team_cumulative_mean_orb,</span>
<span id="cb1-211">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_mean_drb =</span> team_cumulative_mean_drb,</span>
<span id="cb1-212">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_o_eff =</span> team_cumulative_o_eff,</span>
<span id="cb1-213">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_cumulative_d_eff =</span> team_cumulative_d_eff,</span>
<span id="cb1-214">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_efficiency_margin =</span> team_efficiency_margin,</span>
<span id="cb1-215">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_rolling_o_eff =</span> team_rolling_o_eff, </span>
<span id="cb1-216">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_rolling_d_eff =</span> team_rolling_d_eff,</span>
<span id="cb1-217">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_srs =</span> team_srs,</span>
<span id="cb1-218">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_sos =</span> team_sos,</span>
<span id="cb1-219">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_luck =</span> team_luck,</span>
<span id="cb1-220">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_recency =</span> team_recency</span>
<span id="cb1-221">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-222">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb1-223">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_id =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(opponent_id)</span>
<span id="cb1-224">    )</span>
<span id="cb1-225"></span>
<span id="cb1-226">games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> team_side <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">inner_join</span>(opponent_side) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb1-227">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">TeamResult =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.factor</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">case_when</span>(</span>
<span id="cb1-228">    team_score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> opponent_score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"W"</span>,</span>
<span id="cb1-229">    opponent_score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> team_score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"L"</span></span>
<span id="cb1-230">))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">na.omit</span>()</span>
<span id="cb1-231"></span>
<span id="cb1-232">games<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>TeamResult <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">relevel</span>(games<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>TeamResult, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ref=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"W"</span>)</span>
<span id="cb1-233"></span>
<span id="cb1-234">cumulativesimplemodelgames <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> games <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(game_id, game_date, team_short_display_name, opponent_short_display_name, season, opponent_efficiency_margin, team_efficiency_margin, team_sos, team_srs, opponent_sos, opponent_srs, team_luck, opponent_luck, team_recency, opponent_recency, TeamResult) </span>
<span id="cb1-235"></span>
<span id="cb1-236">westround1games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-237">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gonzaga"</span>,</span>
<span id="cb1-238">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Georgia State"</span></span>
<span id="cb1-239">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-240">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Boise State"</span>,</span>
<span id="cb1-241">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Memphis"</span></span>
<span id="cb1-242">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-243">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"UConn"</span>,</span>
<span id="cb1-244">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"New Mexico St"</span></span>
<span id="cb1-245">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-246">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Arkansas"</span>,</span>
<span id="cb1-247">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Vermont"</span></span>
<span id="cb1-248">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-249">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Alabama"</span>,</span>
<span id="cb1-250">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Notre Dame"</span></span>
<span id="cb1-251">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-252">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Texas Tech"</span>,</span>
<span id="cb1-253">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Montana State"</span></span>
<span id="cb1-254">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-255">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Michigan State"</span>,</span>
<span id="cb1-256">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Davidson"</span></span>
<span id="cb1-257">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-258">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Duke"</span>,</span>
<span id="cb1-259">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"CSU Fullerton"</span></span>
<span id="cb1-260">)</span>
<span id="cb1-261"></span>
<span id="cb1-262">westround1games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(westround1games)</span>
<span id="cb1-263"></span>
<span id="cb1-264">westround1games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(westround1games) </span>
<span id="cb1-265"></span>
<span id="cb1-266">westround1log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> westround1games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-267">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(westround1games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-268"></span>
<span id="cb1-269">westround1log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> westround1log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-270">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(westround1log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-271"></span>
<span id="cb1-272">westround2games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-273">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gonzaga"</span>,</span>
<span id="cb1-274">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Memphis"</span></span>
<span id="cb1-275">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-276">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"UConn"</span>,</span>
<span id="cb1-277">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Arkansas"</span></span>
<span id="cb1-278">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-279">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Alabama"</span>,</span>
<span id="cb1-280">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Texas Tech"</span></span>
<span id="cb1-281">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-282">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Michigan State"</span>,</span>
<span id="cb1-283">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Duke"</span></span>
<span id="cb1-284">)</span>
<span id="cb1-285"></span>
<span id="cb1-286">westround2games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(westround2games)</span>
<span id="cb1-287"></span>
<span id="cb1-288">westround2games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(westround2games) </span>
<span id="cb1-289"></span>
<span id="cb1-290">westround2log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> westround2games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-291">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(westround2games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-292"></span>
<span id="cb1-293">westround2log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> westround2log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-294">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(westround2log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-295"></span>
<span id="cb1-296">westround3games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-297">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gonzaga"</span>,</span>
<span id="cb1-298">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Arkansas"</span></span>
<span id="cb1-299">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-300">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Alabama"</span>,</span>
<span id="cb1-301">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Duke"</span></span>
<span id="cb1-302">) </span>
<span id="cb1-303"></span>
<span id="cb1-304">westround3games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(westround3games)</span>
<span id="cb1-305"></span>
<span id="cb1-306">westround3games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(westround3games) </span>
<span id="cb1-307"></span>
<span id="cb1-308">westround3log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> westround3games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-309">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(westround3games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-310"></span>
<span id="cb1-311">westround3log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> westround3log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-312">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(westround3log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-313"></span>
<span id="cb1-314">westround4games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-315">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gonzaga"</span>,</span>
<span id="cb1-316">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Alabama"</span></span>
<span id="cb1-317">) </span>
<span id="cb1-318"></span>
<span id="cb1-319">westround4games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(westround4games)</span>
<span id="cb1-320"></span>
<span id="cb1-321">westround4games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(westround4games) </span>
<span id="cb1-322"></span>
<span id="cb1-323">westround4log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> westround4games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-324">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(westround4games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-325"></span>
<span id="cb1-326">westround4log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> westround4log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-327">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(westround4log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-328"></span>
<span id="cb1-329">eastround1games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-330">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Baylor"</span>,</span>
<span id="cb1-331">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Norfolk State"</span></span>
<span id="cb1-332">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-333">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"North Carolina"</span>,</span>
<span id="cb1-334">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Marquette"</span></span>
<span id="cb1-335">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-336">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Saint Mary's"</span>,</span>
<span id="cb1-337">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Indiana"</span></span>
<span id="cb1-338">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-339">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"UCLA"</span>,</span>
<span id="cb1-340">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Akron"</span></span>
<span id="cb1-341">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-342">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Texas"</span>,</span>
<span id="cb1-343">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Virginia Tech"</span></span>
<span id="cb1-344">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-345">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Purdue"</span>,</span>
<span id="cb1-346">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yale"</span></span>
<span id="cb1-347">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-348">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Murray State"</span>,</span>
<span id="cb1-349">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"San Francisco"</span></span>
<span id="cb1-350">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-351">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Kentucky"</span>,</span>
<span id="cb1-352">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Saint Peter's"</span></span>
<span id="cb1-353">)</span>
<span id="cb1-354"></span>
<span id="cb1-355">eastround1games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(eastround1games)</span>
<span id="cb1-356"></span>
<span id="cb1-357">eastround1games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(eastround1games) </span>
<span id="cb1-358"></span>
<span id="cb1-359">eastround1log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> eastround1games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-360">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(eastround1games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-361"></span>
<span id="cb1-362">eastround1log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> eastround1log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-363">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(eastround1log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-364"></span>
<span id="cb1-365">eastround2games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-366">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Baylor"</span>,</span>
<span id="cb1-367">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"North Carolina"</span></span>
<span id="cb1-368">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-369">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Indiana"</span>,</span>
<span id="cb1-370">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"UCLA"</span></span>
<span id="cb1-371">)  <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-372">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Texas"</span>,</span>
<span id="cb1-373">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Purdue"</span></span>
<span id="cb1-374">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-375">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"San Francisco"</span>,</span>
<span id="cb1-376">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Kentucky"</span></span>
<span id="cb1-377">) </span>
<span id="cb1-378"></span>
<span id="cb1-379">eastround2games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(eastround2games)</span>
<span id="cb1-380"></span>
<span id="cb1-381">eastround2games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(eastround2games) </span>
<span id="cb1-382"></span>
<span id="cb1-383">eastround2log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> eastround2games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-384">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(eastround2games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-385"></span>
<span id="cb1-386">eastround2log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> eastround2log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-387">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(eastround2log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-388"></span>
<span id="cb1-389">eastround3games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-390">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Baylor"</span>,</span>
<span id="cb1-391">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"UCLA"</span></span>
<span id="cb1-392">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-393">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Purdue"</span>,</span>
<span id="cb1-394">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Kentucky"</span></span>
<span id="cb1-395">) </span>
<span id="cb1-396"></span>
<span id="cb1-397">eastround3games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(eastround3games)</span>
<span id="cb1-398"></span>
<span id="cb1-399">eastround3games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(eastround3games) </span>
<span id="cb1-400"></span>
<span id="cb1-401">eastround3log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> eastround3games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-402">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(eastround3games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-403"></span>
<span id="cb1-404">eastround3log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> eastround3log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-405">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(eastround3log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-406"></span>
<span id="cb1-407">eastround4games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-408">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Baylor"</span>,</span>
<span id="cb1-409">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Purdue"</span></span>
<span id="cb1-410">) </span>
<span id="cb1-411"></span>
<span id="cb1-412">eastround4games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(eastround4games)</span>
<span id="cb1-413"></span>
<span id="cb1-414">eastround4games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(eastround4games) </span>
<span id="cb1-415"></span>
<span id="cb1-416">eastround4log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> eastround4games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-417">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(eastround4games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-418"></span>
<span id="cb1-419">eastround4log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> eastround4log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-420">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(eastround4log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-421"></span>
<span id="cb1-422">southround1games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-423">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Arizona"</span>,</span>
<span id="cb1-424">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Wright State"</span></span>
<span id="cb1-425">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-426">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Seton Hall"</span>,</span>
<span id="cb1-427">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"TCU"</span></span>
<span id="cb1-428">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-429">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Houston"</span>,</span>
<span id="cb1-430">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"UAB"</span></span>
<span id="cb1-431">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-432">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Illinois"</span>,</span>
<span id="cb1-433">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Chattanooga"</span></span>
<span id="cb1-434">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-435">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Colorado State"</span>,</span>
<span id="cb1-436">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Michigan"</span></span>
<span id="cb1-437">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-438">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Tennessee"</span>,</span>
<span id="cb1-439">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Longwood"</span></span>
<span id="cb1-440">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-441">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Ohio State"</span>,</span>
<span id="cb1-442">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Loyola Chicago"</span></span>
<span id="cb1-443">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-444">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Villanova"</span>,</span>
<span id="cb1-445">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Delaware"</span></span>
<span id="cb1-446">)</span>
<span id="cb1-447"></span>
<span id="cb1-448">southround1games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(southround1games)</span>
<span id="cb1-449"></span>
<span id="cb1-450">southround1games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(southround1games) </span>
<span id="cb1-451"></span>
<span id="cb1-452">southround1log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> southround1games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-453">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(southround1games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-454"></span>
<span id="cb1-455">southround1log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> southround1log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-456">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(southround1log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-457"></span>
<span id="cb1-458">southround2games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-459">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Arizona"</span>,</span>
<span id="cb1-460">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Seton Hall"</span></span>
<span id="cb1-461">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-462">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Houston"</span>,</span>
<span id="cb1-463">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Illinois"</span></span>
<span id="cb1-464">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-465">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Michigan"</span>,</span>
<span id="cb1-466">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Tennessee"</span></span>
<span id="cb1-467">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-468">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Ohio State"</span>,</span>
<span id="cb1-469">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Villanova"</span></span>
<span id="cb1-470">)</span>
<span id="cb1-471"></span>
<span id="cb1-472">southround2games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(southround2games)</span>
<span id="cb1-473"></span>
<span id="cb1-474">southround2games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(southround2games) </span>
<span id="cb1-475"></span>
<span id="cb1-476">southround2log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> southround2games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-477">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(southround2games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-478"></span>
<span id="cb1-479">southround2log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> southround2log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-480">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(southround2log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-481"></span>
<span id="cb1-482">southround3games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-483">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Arizona"</span>,</span>
<span id="cb1-484">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Illinois"</span></span>
<span id="cb1-485">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-486">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Michigan"</span>,</span>
<span id="cb1-487">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Villanova"</span></span>
<span id="cb1-488">)</span>
<span id="cb1-489"></span>
<span id="cb1-490">southround3games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(southround3games)</span>
<span id="cb1-491"></span>
<span id="cb1-492">southround3games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(southround3games) </span>
<span id="cb1-493"></span>
<span id="cb1-494">southround3log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> southround3games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-495">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(southround3games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-496"></span>
<span id="cb1-497">southround3log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> southround3log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-498">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(southround3log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-499"></span>
<span id="cb1-500">southround4games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-501">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Michigan"</span>,</span>
<span id="cb1-502">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Illinois"</span></span>
<span id="cb1-503">) </span>
<span id="cb1-504"></span>
<span id="cb1-505">southround4games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(southround4games)</span>
<span id="cb1-506"></span>
<span id="cb1-507">southround4games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(southround4games) </span>
<span id="cb1-508"></span>
<span id="cb1-509">southround4log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> southround4games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-510">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(southround4games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-511"></span>
<span id="cb1-512">southround4log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> southround4log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-513">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(southround4log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-514"></span>
<span id="cb1-515">midwestround1games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-516">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Kansas"</span>,</span>
<span id="cb1-517">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Texas Southern"</span></span>
<span id="cb1-518">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-519">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"San Diego State"</span>,</span>
<span id="cb1-520">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Creighton"</span></span>
<span id="cb1-521">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-522">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Iowa"</span>,</span>
<span id="cb1-523">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Richmond"</span></span>
<span id="cb1-524">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-525">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Providence"</span>,</span>
<span id="cb1-526">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"S Dakota St"</span></span>
<span id="cb1-527">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-528">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"LSU"</span>,</span>
<span id="cb1-529">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Iowa State"</span></span>
<span id="cb1-530">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-531">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Wisconsin"</span>,</span>
<span id="cb1-532">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Colgate"</span></span>
<span id="cb1-533">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-534">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"USC"</span>,</span>
<span id="cb1-535">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Miami"</span></span>
<span id="cb1-536">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-537">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Auburn"</span>,</span>
<span id="cb1-538">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"J'Ville St"</span></span>
<span id="cb1-539">)</span>
<span id="cb1-540"></span>
<span id="cb1-541">midwestround1games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(midwestround1games)</span>
<span id="cb1-542"></span>
<span id="cb1-543">midwestround1games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(midwestround1games) </span>
<span id="cb1-544"></span>
<span id="cb1-545">midwestround1log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> midwestround1games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-546">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(midwestround1games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-547"></span>
<span id="cb1-548">midwestround1log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> midwestround1log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-549">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(midwestround1log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-550"></span>
<span id="cb1-551">midwestround2games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-552">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Kansas"</span>,</span>
<span id="cb1-553">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Creighton"</span></span>
<span id="cb1-554">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-555">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Iowa"</span>,</span>
<span id="cb1-556">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Providence"</span></span>
<span id="cb1-557">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-558">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"LSU"</span>,</span>
<span id="cb1-559">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Wisconsin"</span></span>
<span id="cb1-560">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-561">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"USC"</span>,</span>
<span id="cb1-562">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Auburn"</span></span>
<span id="cb1-563">) </span>
<span id="cb1-564"></span>
<span id="cb1-565">midwestround2games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(midwestround2games)</span>
<span id="cb1-566"></span>
<span id="cb1-567">midwestround2games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(midwestround2games) </span>
<span id="cb1-568"></span>
<span id="cb1-569">midwestround2log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> midwestround2games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-570">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(midwestround2games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-571"></span>
<span id="cb1-572">midwestround2log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> midwestround2log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-573">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(midwestround2log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-574"></span>
<span id="cb1-575">midwestround3games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-576">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Creighton"</span>,</span>
<span id="cb1-577">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Iowa"</span></span>
<span id="cb1-578">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-579">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Wisconsin"</span>,</span>
<span id="cb1-580">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"USC"</span></span>
<span id="cb1-581">)</span>
<span id="cb1-582"></span>
<span id="cb1-583">midwestround3games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(midwestround3games)</span>
<span id="cb1-584"></span>
<span id="cb1-585">midwestround3games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(midwestround3games) </span>
<span id="cb1-586"></span>
<span id="cb1-587">midwestround3log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> midwestround3games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-588">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(midwestround3games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-589"></span>
<span id="cb1-590">midwestround3log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> midwestround3log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-591">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(midwestround3log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-592"></span>
<span id="cb1-593">midwestround4games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-594">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Creighton"</span>,</span>
<span id="cb1-595">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"USC"</span></span>
<span id="cb1-596">)</span>
<span id="cb1-597"></span>
<span id="cb1-598">midwestround4games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(midwestround4games)</span>
<span id="cb1-599"></span>
<span id="cb1-600">midwestround4games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(midwestround4games) </span>
<span id="cb1-601"></span>
<span id="cb1-602">midwestround4log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> midwestround4games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-603">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(midwestround4games) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-604"></span>
<span id="cb1-605">midwestround4log <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> midwestround4log, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-606">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(midwestround4log) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-607"></span>
<span id="cb1-608">finalfourgames <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-609">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gonzaga"</span>,</span>
<span id="cb1-610">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Baylor"</span></span>
<span id="cb1-611">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb1-612">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Illinois"</span>,</span>
<span id="cb1-613">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"USC"</span>  </span>
<span id="cb1-614">)</span>
<span id="cb1-615"></span>
<span id="cb1-616">finalfourgames <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(finalfourgames)</span>
<span id="cb1-617"></span>
<span id="cb1-618">finalfourgames <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(finalfourgames) </span>
<span id="cb1-619"></span>
<span id="cb1-620">finalfourlog <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> finalfourgames) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-621">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(finalfourgames) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-622"></span>
<span id="cb1-623">finalfourlog <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> finalfourlog, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-624">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(finalfourlog) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-625"></span>
<span id="cb1-626">champs <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb1-627">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Baylor"</span>,</span>
<span id="cb1-628">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Illinois"</span></span>
<span id="cb1-629">) </span>
<span id="cb1-630"></span>
<span id="cb1-631">champs <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(team_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(champs)</span>
<span id="cb1-632"></span>
<span id="cb1-633">champs <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> cumulativesimplemodelgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(game_date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(game_date) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2022</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>TeamResult, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">starts_with</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"team"</span>), <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_id, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>game_date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(champs) </span>
<span id="cb1-634"></span>
<span id="cb1-635">champslog <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> champs) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-636">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(champs) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-637"></span>
<span id="cb1-638">champslog <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> log_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> champslog, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-639">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(champslog) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.pred_class, .pred_W, .pred_L, team_short_display_name, opponent_short_display_name, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span></code></pre></div></div>
</details>
</div>
<p>To make my predictors, I borrowed simple ratings and strength of schedule from Sports Reference, I calculated season long unweighted offensive and defensive efficiency margins, threw in KenPom’s luck metric and, at the last minute, decided to create a recency bias metric. What I did was compare the season-long efficiency margin of teams to the same metric from their last 10 games. If they were overplaying their season numbers, that gave them a positive measure. I was trying to capture teams who came into the tournament hot, or who were limping into the tournament based on their regular season resume but missing stars or just playing terrible.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(cumulative_recipe) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb2-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(variable, role) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb2-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(role <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ID"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb2-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gt</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb2-5">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_header</span>(</span>
<span id="cb2-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The predictors"</span>,</span>
<span id="cb2-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A mix of efficiencies, ratings and recency bias."</span></span>
<span id="cb2-8">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span>  </span>
<span id="cb2-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_source_note</span>(</span>
<span id="cb2-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">source_note =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">md</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"**By:** Matt Waite"</span>)</span>
<span id="cb2-11">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb2-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb2-13">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"left"</span>),</span>
<span id="cb2-14">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_title</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"title"</span>)</span>
<span id="cb2-15">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb2-16">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb2-17">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"left"</span>),</span>
<span id="cb2-18">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_title</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"subtitle"</span>)</span>
<span id="cb2-19">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb2-20">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb2-21">     <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_column_labels</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>()),</span>
<span id="cb2-22">     <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">list</span>(</span>
<span id="cb2-23">       <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_borders</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sides =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bottom"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">px</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>)),</span>
<span id="cb2-24">       <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>)</span>
<span id="cb2-25">     )</span>
<span id="cb2-26">   ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb2-27">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">opt_row_striping</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb2-28">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">opt_table_lines</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>)</span></code></pre></div></div>
</details>
</div>
<p>In the run up to the tournament, I used both a logistic regression and support vector machine algorithm, but got very similar results, so I stuck with the more simple logistic regression.</p>
<p>In testing, my model was calling college basketball games correctly about 74 percent of the time, so I knew I was going to need to get lucky on a few games. But isn’t that filling out a bracket?</p>
<p>Result? I did not get lucky.</p>
<p>Particularly in the Midwest Regional. My models labored to produce a Creighton vs USC Elite Eight match-up that sent USC to the Final Four. While Creighton nearly upset Kansas with half a lineup, USC bombed out in the first round. The team that beat them ended up going to the Elite Eight – Miami – taking out other teams I had predicted to win along the way.</p>
<p>Here’s what my model predicted in the Midwest Regional:</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1">midwestround1log <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb3-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(team_short_display_name, .pred_class, .pred_W, opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb3-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gt</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb3-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cols_label</span>(</span>
<span id="cb3-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Team"</span>,</span>
<span id="cb3-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">.pred_class =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Prediction"</span>,</span>
<span id="cb3-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">.pred_W =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Win Confidence"</span>,</span>
<span id="cb3-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Opponent"</span></span>
<span id="cb3-9">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb3-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_header</span>(</span>
<span id="cb3-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Midwest Regional: Round 1"</span>,</span>
<span id="cb3-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"I was sure Iowa State would lose and USC was Final Four bound."</span></span>
<span id="cb3-13">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span>  </span>
<span id="cb3-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_source_note</span>(</span>
<span id="cb3-15">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">source_note =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">md</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"**By:** Matt Waite"</span>)</span>
<span id="cb3-16">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb3-17">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb3-18">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"left"</span>),</span>
<span id="cb3-19">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_title</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"title"</span>)</span>
<span id="cb3-20">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb3-21">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb3-22">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"left"</span>),</span>
<span id="cb3-23">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_title</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"subtitle"</span>)</span>
<span id="cb3-24">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb3-25">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb3-26">     <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_column_labels</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>()),</span>
<span id="cb3-27">     <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">list</span>(</span>
<span id="cb3-28">       <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_borders</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sides =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bottom"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">px</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>)),</span>
<span id="cb3-29">       <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>)</span>
<span id="cb3-30">     )</span>
<span id="cb3-31">   ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb3-32">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">opt_row_striping</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb3-33">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">opt_table_lines</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb3-34">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fmt_percent</span>(</span>
<span id="cb3-35">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(.pred_W),</span>
<span id="cb3-36">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">decimals =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="cb3-37">  )</span></code></pre></div></div>
</details>
</div>
<p>Normally I could survive an Iowa State and Miami win here … except I had both of their opponents moving on fairly deep.</p>
<p>Round two was a complete disaster.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1">midwestround2log <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb4-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(team_short_display_name, .pred_class, .pred_W, opponent_short_display_name) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb4-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gt</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb4-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cols_label</span>(</span>
<span id="cb4-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">team_short_display_name =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Team"</span>,</span>
<span id="cb4-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">.pred_class =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Prediction"</span>,</span>
<span id="cb4-7">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">.pred_W =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Win Confidence"</span>,</span>
<span id="cb4-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">opponent_short_display_name =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Opponent"</span></span>
<span id="cb4-9">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb4-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_header</span>(</span>
<span id="cb4-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Midwest Regional: Round 2"</span>,</span>
<span id="cb4-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Not one of these predictions were correct."</span></span>
<span id="cb4-13">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span>  </span>
<span id="cb4-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_source_note</span>(</span>
<span id="cb4-15">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">source_note =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">md</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"**By:** Matt Waite"</span>)</span>
<span id="cb4-16">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb4-17">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb4-18">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"left"</span>),</span>
<span id="cb4-19">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_title</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"title"</span>)</span>
<span id="cb4-20">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb4-21">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb4-22">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"left"</span>),</span>
<span id="cb4-23">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_title</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"subtitle"</span>)</span>
<span id="cb4-24">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb4-25">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb4-26">     <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_column_labels</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>()),</span>
<span id="cb4-27">     <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">list</span>(</span>
<span id="cb4-28">       <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_borders</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sides =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bottom"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">px</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>)),</span>
<span id="cb4-29">       <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>)</span>
<span id="cb4-30">     )</span>
<span id="cb4-31">   ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb4-32">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">opt_row_striping</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb4-33">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">opt_table_lines</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb4-34">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fmt_percent</span>(</span>
<span id="cb4-35">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(.pred_W),</span>
<span id="cb4-36">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">decimals =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="cb4-37">  )</span></code></pre></div></div>
</details>
</div>
<p>My models ended up with a Gonzaga v Baylor and Illinois v USC final four. That 0-4 on those. None of them made it. The Baylor repeat that I predicted died in the second round at the hands of North Carolina, the highest seeded team to make the Final Four.</p>
<p>Going into the Final Four, I’m in the 16th percentile of ESPN brackets, good enough for 14.6 millionth place. Last year, I was in the 38th percentile.</p>
<p>The best bracket in my class is in the 88th percentile, with another in the 86th. Only two students did worse than I did.</p>
<p>We are what they grow beyond.</p>
<p>Thinking about this bracket, I wanted to try rolling with something that didn’t just bite KenPom and make models out of his data. I wanted to see if I could get to a similar place without re-walking the same ground. I’ve got a year to work in this, but my energy is going to be focused on weighting competition and opponents throughout the season. If of two minds about this: As a Big Ten denizen, I have to wonder if beating up on each other for a whole season is why the Big Ten fades in the tournament. So I’m curious about a Fatigue Factor of some variety. At the same time, how does that explain St.&nbsp;Peter’s? Not sure it does, but I’m not sure there’s a model anywhere that’s going to.</p>
<p>The code I wrote to make this relied heavily on <a href="https://hoopr.sportsdataverse.org/">hoopR</a> and <a href="https://www.tidymodels.org/">tidymodels</a>.</p>



 ]]></description>
  <category>code</category>
  <category>analysis</category>
  <guid>https://www.mattwaite.com/posts/another-year-another-attempt-another-bracket-disaster/</guid>
  <pubDate>Mon, 28 Mar 2022 05:00:00 GMT</pubDate>
  <media:content url="https://www.mattwaite.com/posts/another-year-another-attempt-another-bracket-disaster/image.png" medium="image" type="image/png" height="103" width="144"/>
</item>
<item>
  <title>Nebraska is not the best worst team in basketball again. They’re third best worst.</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/nebraska-is-the-third-best-worst-basketball-team/</link>
  <description><![CDATA[ 





<p>Last year, <a href="http://mattwaite.github.io/2021/03/28/is-nebraska-the-best-worst-team-in-college-basketball/">this post</a> <em>may</em> have suggested that Nebraska would be better this year than last year. That Nebraska was the best worst team in college basketball, and with major recruits coming in and the Big Ten expected to take a step back, all looked up.</p>
<p>Oops.</p>
<p>It didn’t work out as expected – in spite of a late season surge. But let’s return to the question: Is Nebraska the best worst team in college basketball?</p>
<p>Spoiler alert: Not this season.</p>
<p>Returning to <a href="https://www.sports-reference.com/cbb/seasons/2022-school-stats.html">Sports Reference’s college basketball site</a>, we find our friends the Simple Rating System and Strength of Schedule. The SRS is a mix of average point differential and strength of schedule. Given that, a team with a losing record could have a positive rating if they lose games close but play good teams.</p>
<p>Like, say, Nebraska.</p>
<p>To find the worst teams, we’ll use the last place team in each conference by conference wins again.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(ggalt)</span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(gt)</span>
<span id="cb1-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(ggbeeswarm)</span>
<span id="cb1-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(ggrepel)</span>
<span id="cb1-6"></span>
<span id="cb1-7">stats <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">read_csv</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"http://mattwaite.github.io/sportsdatafiles/stats22.csv"</span>)</span>
<span id="cb1-8">games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">read_csv</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"http://mattwaite.github.io/sportsdatafiles/logs22.csv"</span>)</span>
<span id="cb1-9"></span>
<span id="cb1-10">stats <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> games <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(Team, Conference) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">distinct</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-13">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(stats, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">by=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Team"</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"School"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(Games <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>)</span>
<span id="cb1-15"></span>
<span id="cb1-16">lastplace <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> stats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-17">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(Conference) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-18">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">desc</span>(ConferenceWins)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-19">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">n</span>()) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-20">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(Games <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-21">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-22">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">desc</span>(OverallSRS))</span>
<span id="cb1-23"></span>
<span id="cb1-24">nu <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> lastplace <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(Team <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nebraska"</span>)</span>
<span id="cb1-25"></span>
<span id="cb1-26">lastplace <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-27">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(Team, Conference, OverallWins, OverallLosses, OverallSRS, OverallSOS) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-28">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rename</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">W =</span> OverallWins, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">L=</span>OverallLosses, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Simple Rating</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> OverallSRS, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Sched. Strength</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> OverallSOS) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-29">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">top_n</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">wt=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Simple Rating</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-30">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gt</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-31">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_header</span>(</span>
<span id="cb1-32">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The Huskers didn't repeat as best of the worst"</span>,</span>
<span id="cb1-33">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Notable: NC State - 3OT winner against Nebraska - finished just a hair ahead."</span></span>
<span id="cb1-34">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-35">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"left"</span>),</span>
<span id="cb1-36">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_title</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"title"</span>)</span>
<span id="cb1-37">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-38">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"left"</span>),</span>
<span id="cb1-39">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_title</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"subtitle"</span>)</span>
<span id="cb1-40">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-41">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_source_note</span>(</span>
<span id="cb1-42">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">source_note =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"By Matt Waite"</span></span>
<span id="cb1-43">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-44">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_source_note</span>(</span>
<span id="cb1-45">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">source_note =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">md</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Source: [Sports Reference](https://www.sports-reference.com/cbb/seasons/2022-school-stats.html)"</span>)</span>
<span id="cb1-46">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-47">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>),</span>
<span id="cb1-48">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_body</span>(</span>
<span id="cb1-49">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(Team)</span>
<span id="cb1-50">    )</span>
<span id="cb1-51">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-52">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-53">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>),</span>
<span id="cb1-54">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_body</span>(</span>
<span id="cb1-55">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Sched. Strength</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span>),</span>
<span id="cb1-56">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rows =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Sched. Strength</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb1-57">    )</span>
<span id="cb1-58">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-59">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-60">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"green"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"normal"</span>),</span>
<span id="cb1-61">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_body</span>(</span>
<span id="cb1-62">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Sched. Strength</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span>),</span>
<span id="cb1-63">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rows =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Sched. Strength</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb1-64">    )</span>
<span id="cb1-65">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-66">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-67">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>),</span>
<span id="cb1-68">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_body</span>(</span>
<span id="cb1-69">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Simple Rating</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span>),</span>
<span id="cb1-70">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rows =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Simple Rating</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb1-71">    )</span>
<span id="cb1-72">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-73">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-74">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"green"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"normal"</span>),</span>
<span id="cb1-75">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_body</span>(</span>
<span id="cb1-76">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Simple Rating</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span>),</span>
<span id="cb1-77">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rows =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Simple Rating</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb1-78">    )</span>
<span id="cb1-79">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-80">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">opt_row_striping</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-81">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">opt_table_lines</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-82">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-83">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_borders</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sides =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"top"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bottom"</span>), </span>
<span id="cb1-84">                         <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"grey"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">px</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)),</span>
<span id="cb1-85">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_column_labels</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-86">  )</span></code></pre></div></div>
</details>
<div class="cell-output-display">
<div id="jbbnpyacqr" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#jbbnpyacqr table {
  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#jbbnpyacqr thead, #jbbnpyacqr tbody, #jbbnpyacqr tfoot, #jbbnpyacqr tr, #jbbnpyacqr td, #jbbnpyacqr th {
  border-style: none;
}

#jbbnpyacqr p {
  margin: 0;
  padding: 0;
}

#jbbnpyacqr .gt_table {
  display: table;
  border-collapse: collapse;
  line-height: normal;
  margin-left: auto;
  margin-right: auto;
  color: #333333;
  font-size: 16px;
  font-weight: normal;
  font-style: normal;
  background-color: #FFFFFF;
  width: auto;
  border-top-style: none;
  border-top-width: 2px;
  border-top-color: #A8A8A8;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #A8A8A8;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
}

#jbbnpyacqr .gt_caption {
  padding-top: 4px;
  padding-bottom: 4px;
}

#jbbnpyacqr .gt_title {
  color: #333333;
  font-size: 125%;
  font-weight: initial;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-color: #FFFFFF;
  border-bottom-width: 0;
}

#jbbnpyacqr .gt_subtitle {
  color: #333333;
  font-size: 85%;
  font-weight: initial;
  padding-top: 3px;
  padding-bottom: 5px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-color: #FFFFFF;
  border-top-width: 0;
}

#jbbnpyacqr .gt_heading {
  background-color: #FFFFFF;
  text-align: center;
  border-bottom-color: #FFFFFF;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#jbbnpyacqr .gt_bottom_border {
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#jbbnpyacqr .gt_col_headings {
  border-top-style: none;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#jbbnpyacqr .gt_col_heading {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 6px;
  padding-left: 5px;
  padding-right: 5px;
  overflow-x: hidden;
}

#jbbnpyacqr .gt_column_spanner_outer {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 4px;
  padding-right: 4px;
}

#jbbnpyacqr .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#jbbnpyacqr .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#jbbnpyacqr .gt_column_spanner {
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 5px;
  overflow-x: hidden;
  display: inline-block;
  width: 100%;
}

#jbbnpyacqr .gt_spanner_row {
  border-bottom-style: hidden;
}

#jbbnpyacqr .gt_group_heading {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-top-style: none;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  text-align: left;
}

#jbbnpyacqr .gt_empty_group_heading {
  padding: 0.5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  border-top-style: none;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: middle;
}

#jbbnpyacqr .gt_from_md > :first-child {
  margin-top: 0;
}

#jbbnpyacqr .gt_from_md > :last-child {
  margin-bottom: 0;
}

#jbbnpyacqr .gt_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  margin: 10px;
  border-top-style: none;
  border-top-width: 1px;
  border-top-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  overflow-x: hidden;
}

#jbbnpyacqr .gt_stub {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
}

#jbbnpyacqr .gt_stub_row_group {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
  vertical-align: top;
}

#jbbnpyacqr .gt_row_group_first td {
  border-top-width: 2px;
}

#jbbnpyacqr .gt_row_group_first th {
  border-top-width: 2px;
}

#jbbnpyacqr .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#jbbnpyacqr .gt_first_summary_row {
  border-top-style: none;
  border-top-color: #D3D3D3;
}

#jbbnpyacqr .gt_first_summary_row.thick {
  border-top-width: 2px;
}

#jbbnpyacqr .gt_last_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#jbbnpyacqr .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#jbbnpyacqr .gt_first_grand_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-style: none;
  border-top-width: 6px;
  border-top-color: #D3D3D3;
}

#jbbnpyacqr .gt_last_grand_summary_row_top {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: none;
  border-bottom-width: 6px;
  border-bottom-color: #D3D3D3;
}

#jbbnpyacqr .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#jbbnpyacqr .gt_table_body {
  border-top-style: none;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#jbbnpyacqr .gt_footnotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#jbbnpyacqr .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#jbbnpyacqr .gt_sourcenotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#jbbnpyacqr .gt_sourcenote {
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#jbbnpyacqr .gt_left {
  text-align: left;
}

#jbbnpyacqr .gt_center {
  text-align: center;
}

#jbbnpyacqr .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#jbbnpyacqr .gt_font_normal {
  font-weight: normal;
}

#jbbnpyacqr .gt_font_bold {
  font-weight: bold;
}

#jbbnpyacqr .gt_font_italic {
  font-style: italic;
}

#jbbnpyacqr .gt_super {
  font-size: 65%;
}

#jbbnpyacqr .gt_footnote_marks {
  font-size: 75%;
  vertical-align: 0.4em;
  position: initial;
}

#jbbnpyacqr .gt_asterisk {
  font-size: 100%;
  vertical-align: 0;
}

#jbbnpyacqr .gt_indent_1 {
  text-indent: 5px;
}

#jbbnpyacqr .gt_indent_2 {
  text-indent: 10px;
}

#jbbnpyacqr .gt_indent_3 {
  text-indent: 15px;
}

#jbbnpyacqr .gt_indent_4 {
  text-indent: 20px;
}

#jbbnpyacqr .gt_indent_5 {
  text-indent: 25px;
}

#jbbnpyacqr .katex-display {
  display: inline-flex !important;
  margin-bottom: 0.75em !important;
}

#jbbnpyacqr div.Reactable > div.rt-table > div.rt-thead > div.rt-tr.rt-tr-group-header > div.rt-th-group:after {
  height: 0px !important;
}
</style>

<table class="gt_table caption-top table table-sm table-striped small" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading header">
<td colspan="6" class="gt_heading gt_title gt_font_normal" style="text-align: left; color: #000000; font-weight: bold;">The Huskers didn't repeat as best of the worst</td>
</tr>
<tr class="gt_heading even">
<td colspan="6" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border" style="text-align: left; color: #000000;">Notable: NC State - 3OT winner against Nebraska - finished just a hair ahead.</td>
</tr>
<tr class="gt_col_headings header">
<th id="Team" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" style="border-top-width: 1px; border-top-style: solid; border-top-color: grey; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: grey" scope="col">Team</th>
<th id="Conference" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" style="border-top-width: 1px; border-top-style: solid; border-top-color: grey; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: grey" scope="col">Conference</th>
<th id="W" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" style="border-top-width: 1px; border-top-style: solid; border-top-color: grey; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: grey" scope="col">W</th>
<th id="L" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" style="border-top-width: 1px; border-top-style: solid; border-top-color: grey; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: grey" scope="col">L</th>
<th id="Simple-Rating" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" style="border-top-width: 1px; border-top-style: solid; border-top-color: grey; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: grey" scope="col">Simple Rating</th>
<th id="Sched.-Strength" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" style="border-top-width: 1px; border-top-style: solid; border-top-color: grey; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: grey" scope="col">Sched. Strength</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr class="odd">
<td class="gt_row gt_left" headers="Team" style="color: #000000; font-weight: bold">West Virginia</td>
<td class="gt_row gt_left" headers="Conference">Big 12</td>
<td class="gt_row gt_right" headers="W">15</td>
<td class="gt_row gt_right" headers="L">16</td>
<td class="gt_row gt_right" headers="Simple Rating" style="color: #00FF00; font-weight: normal">10.65</td>
<td class="gt_row gt_right" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">10.61</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="Team" style="color: #000000; font-weight: bold">NC State</td>
<td class="gt_row gt_left gt_striped" headers="Conference">ACC</td>
<td class="gt_row gt_right gt_striped" headers="W">11</td>
<td class="gt_row gt_right gt_striped" headers="L">20</td>
<td class="gt_row gt_right gt_striped" headers="Simple Rating" style="color: #00FF00; font-weight: normal">3.59</td>
<td class="gt_row gt_right gt_striped" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">6.08</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="Team" style="color: #000000; font-weight: bold">Nebraska</td>
<td class="gt_row gt_left" headers="Conference">Big Ten</td>
<td class="gt_row gt_right" headers="W">10</td>
<td class="gt_row gt_right" headers="L">21</td>
<td class="gt_row gt_right" headers="Simple Rating" style="color: #00FF00; font-weight: normal">3.54</td>
<td class="gt_row gt_right" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">8.89</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="Team" style="color: #000000; font-weight: bold">Georgetown</td>
<td class="gt_row gt_left gt_striped" headers="Conference">Big East</td>
<td class="gt_row gt_right gt_striped" headers="W">6</td>
<td class="gt_row gt_right gt_striped" headers="L">24</td>
<td class="gt_row gt_right gt_striped" headers="Simple Rating" style="color: #00FF00; font-weight: normal">1.91</td>
<td class="gt_row gt_right gt_striped" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">8.31</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="Team" style="color: #000000; font-weight: bold">Georgia</td>
<td class="gt_row gt_left" headers="Conference">SEC</td>
<td class="gt_row gt_right" headers="W">6</td>
<td class="gt_row gt_right" headers="L">25</td>
<td class="gt_row gt_right" headers="Simple Rating" style="color: #00FF00; font-weight: normal">0.64</td>
<td class="gt_row gt_right" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">8.48</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="Team" style="color: #000000; font-weight: bold">Oregon State</td>
<td class="gt_row gt_left gt_striped" headers="Conference">Pac-12</td>
<td class="gt_row gt_right gt_striped" headers="W">3</td>
<td class="gt_row gt_right gt_striped" headers="L">27</td>
<td class="gt_row gt_right gt_striped" headers="Simple Rating" style="color: #FF0000; font-weight: bold">-0.76</td>
<td class="gt_row gt_right gt_striped" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">8.95</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="Team" style="color: #000000; font-weight: bold">South Florida</td>
<td class="gt_row gt_left" headers="Conference">AAC</td>
<td class="gt_row gt_right" headers="W">8</td>
<td class="gt_row gt_right" headers="L">22</td>
<td class="gt_row gt_right" headers="Simple Rating" style="color: #FF0000; font-weight: bold">-2.86</td>
<td class="gt_row gt_right" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">4.77</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="Team" style="color: #000000; font-weight: bold">Northeastern</td>
<td class="gt_row gt_left gt_striped" headers="Conference">CAA</td>
<td class="gt_row gt_right gt_striped" headers="W">9</td>
<td class="gt_row gt_right gt_striped" headers="L">22</td>
<td class="gt_row gt_right gt_striped" headers="Simple Rating" style="color: #FF0000; font-weight: bold">-6.01</td>
<td class="gt_row gt_right gt_striped" headers="Sched. Strength" style="color: #FF0000; font-weight: bold">-1.20</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="Team" style="color: #000000; font-weight: bold">Duquesne</td>
<td class="gt_row gt_left" headers="Conference">A-10</td>
<td class="gt_row gt_right" headers="W">6</td>
<td class="gt_row gt_right" headers="L">23</td>
<td class="gt_row gt_right" headers="Simple Rating" style="color: #FF0000; font-weight: bold">-6.39</td>
<td class="gt_row gt_right" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">2.02</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="Team" style="color: #000000; font-weight: bold">Pepperdine</td>
<td class="gt_row gt_left gt_striped" headers="Conference">WCC</td>
<td class="gt_row gt_right gt_striped" headers="W">7</td>
<td class="gt_row gt_right gt_striped" headers="L">25</td>
<td class="gt_row gt_right gt_striped" headers="Simple Rating" style="color: #FF0000; font-weight: bold">-6.48</td>
<td class="gt_row gt_right gt_striped" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">3.97</td>
</tr>
</tbody><tfoot>
<tr class="gt_sourcenotes odd">
<td colspan="6" class="gt_sourcenote">By Matt Waite</td>
</tr>
<tr class="gt_sourcenotes even">
<td colspan="6" class="gt_sourcenote">Source: <a href="https://www.sports-reference.com/cbb/seasons/2022-school-stats.html">Sports Reference</a></td>
</tr>
</tfoot>

</table>

</div>
</div>
</div>
<p>This season, West Virginia takes the best worst crown. They played the toughest schedule and won 15 games, five more than Nebraska, and ended with a far higher simple rating. A familiar name on the list will be NC State, which won an three overtime thriller against Nebraska. They had one more win than the Huskers, and finished just a tiny bit ahead.</p>
<p>But what about all teams in college basketball? Where does Nebraska rank out against other teams and other conferences?</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_vline</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">xintercept =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.54</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb2-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_beeswarm</span>(</span>
<span id="cb2-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data=</span>stats, </span>
<span id="cb2-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">groupOnX=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span>, </span>
<span id="cb2-6">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>OverallSRS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>Conference), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"grey"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb2-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_beeswarm</span>(</span>
<span id="cb2-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data=</span>lastplace, </span>
<span id="cb2-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">groupOnX=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>, </span>
<span id="cb2-10">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>OverallSRS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>Conference), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"blue"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb2-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_beeswarm</span>(</span>
<span id="cb2-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data=</span>nu, </span>
<span id="cb2-13">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">groupOnX=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>, </span>
<span id="cb2-14">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>OverallSRS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>Conference), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-15">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text</span>(</span>
<span id="cb2-16">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Big Ten"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nebraska"</span>)</span>
<span id="cb2-17">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-18"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Simple Rating"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">""</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nebraska's simple rating is better than 5 conferences"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The Husker's finished dead last in the Big Ten, but wouldn't have nearly everywhere else."</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">caption=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Source: Sports Reference | By Matt Waite"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb2-19">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_minimal</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb2-20">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="cb2-21">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">face =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>),</span>
<span id="cb2-22">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>), </span>
<span id="cb2-23">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.subtitle =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>), </span>
<span id="cb2-24">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">panel.grid.minor =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb2-25">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title.position =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"plot"</span></span>
<span id="cb2-26">    )</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: The `groupOnX` argument of `geom_beeswarm()` is deprecated as of ggbeeswarm
0.7.1.
ℹ ggplot2 now handles this case automatically.</code></pre>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/nebraska-is-the-third-best-worst-basketball-team/index_files/figure-html/unnamed-chunk-2-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>Last year, Nebraska wins nine conferences. Now it’s five. None of them are powerhouse conferences.</p>
<p>What about the Power Five?</p>
<p>To put West Virginia in perspective, there’s 28 Power Five teams with a simple rating worse than they had. Nebraska finishes 22nd among that group. Among that group: Miami, which beat second-seed Auburn in the NCAA Tournament and, as of this writing, is still playing basketball.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1">powerfive <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Big Ten"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Big 12"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Pac-12"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"SEC"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ACC"</span>)</span>
<span id="cb4-2"></span>
<span id="cb4-3">betterpowerfive <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> stats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(Conference <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%in%</span> powerfive) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(OverallSRS <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.65</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">desc</span>(OverallSRS))</span>
<span id="cb4-4"></span>
<span id="cb4-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb4-6">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_point</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data=</span>betterpowerfive, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>OverallSRS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>OverallSOS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size=</span>OverallWins)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb4-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_point</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data=</span>nu, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>OverallSRS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>OverallSOS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size=</span>OverallWins), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb4-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text_repel</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data=</span>betterpowerfive, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>OverallSRS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>OverallSOS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label=</span>Team), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">point.padding =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb4-9"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Simple Rating"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Schedule strength"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nebraska had a harder schedule than multiple tournament teams"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nebraska isn't the best of the worst again, but teams in their ranking neighborhood had better fortunes."</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">caption=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Source: Sports Reference | By Matt Waite"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb4-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_minimal</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb4-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="cb4-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">face =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>),</span>
<span id="cb4-13">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>), </span>
<span id="cb4-14">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.subtitle =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>), </span>
<span id="cb4-15">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">panel.grid.minor =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb4-16">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title.position =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"plot"</span></span>
<span id="cb4-17">    )</span></code></pre></div></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/nebraska-is-the-third-best-worst-basketball-team/index_files/figure-html/unnamed-chunk-3-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>The road forward for Nebraska is even murkier than last year. There’s coaching vacancies and roster turnover ahead, and after last year, no prediction here.</p>



 ]]></description>
  <category>huskers</category>
  <category>code</category>
  <category>analysis</category>
  <guid>https://www.mattwaite.com/posts/nebraska-is-the-third-best-worst-basketball-team/</guid>
  <pubDate>Sun, 20 Mar 2022 05:00:00 GMT</pubDate>
  <media:content url="https://www.mattwaite.com/posts/nebraska-is-the-third-best-worst-basketball-team/image.png" medium="image" type="image/png" height="144" width="144"/>
</item>
<item>
  <title>Is Nebraska the best worst team in college basketball?</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/is-nebraska-the-best-worst-basketball-team/</link>
  <description><![CDATA[ 





<p>Nebraska fans haven’t had the best time watching basketball lately. The last two seasons have featured only seven wins in each season. This season they only won three games in the Big Ten, but that was an improvement over last season when they only won two.</p>
<p>But anyone watching Nebraska basketball this season could see there was a difference between last season’s squad and this one. And given that the Big Ten was rated as the best conference in college basketball during the season, it begs the question: Is Nebraska that bad?</p>
<p>In fact, are they the best worst team in college basketball?</p>
<p>Let’s take a look at some numbers.</p>
<p><a href="https://www.sports-reference.com/cbb/seasons/2021-school-stats.html">Sports Reference’s college basketball site</a> produces a Simple Rating System and Strength of Schedule number for each team. The SRS is a mix of average point differential and strength of schedule. Given that, a team with a losing record could have a positive rating if they lose games close but play good teams.</p>
<p>Like, say, Nebraska.</p>
<p>To find the worst teams, we’ll find the last place team in each conference by conference wins (minus the Ivy League, which didn’t play due to Covid).</p>
<p>The first question we’ll ask and answer is by rating, who is the best of the last place teams? Here’s the top 10 of the bottom.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(ggalt)</span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(gt)</span>
<span id="cb1-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(ggbeeswarm)</span>
<span id="cb1-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(ggrepel)</span>
<span id="cb1-6"></span>
<span id="cb1-7">stats <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">read_csv</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"http://mattwaite.github.io/sportsdatafiles/stats21.csv"</span>)</span>
<span id="cb1-8">games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">read_csv</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"http://mattwaite.github.io/sportsdatafiles/logs21.csv"</span>)</span>
<span id="cb1-9"></span>
<span id="cb1-10">stats <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> games <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(Team, Conference) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">distinct</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-13">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(stats, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">by=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Team"</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"School"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(Games <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>)</span>
<span id="cb1-15"></span>
<span id="cb1-16">lastplace <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> stats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-17">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(Conference) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-18">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">desc</span>(ConferenceWins)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-19">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">n</span>()) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-20">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(Games <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-21">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-22">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">desc</span>(OverallSRS))</span>
<span id="cb1-23"></span>
<span id="cb1-24">nu <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> lastplace <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(Team <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nebraska"</span>)</span>
<span id="cb1-25"></span>
<span id="cb1-26">lastplace <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-27">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(Team, Conference, OverallWins, OverallLosses, OverallSRS, OverallSOS) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-28">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rename</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">W =</span> OverallWins, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">L=</span>OverallLosses, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Simple Rating</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> OverallSRS, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Sched. Strength</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span> OverallSOS) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-29">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">top_n</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">wt=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Simple Rating</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-30">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gt</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-31">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_header</span>(</span>
<span id="cb1-32">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The Huskers are the top of the bottom"</span>,</span>
<span id="cb1-33">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"They only won 7 games but have the best simple rating and toughest schedule among the last place teams."</span></span>
<span id="cb1-34">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-35">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"left"</span>),</span>
<span id="cb1-36">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_title</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"title"</span>)</span>
<span id="cb1-37">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-38">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">align =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"left"</span>),</span>
<span id="cb1-39">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_title</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"subtitle"</span>)</span>
<span id="cb1-40">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-41">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_source_note</span>(</span>
<span id="cb1-42">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">source_note =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"By Matt Waite"</span></span>
<span id="cb1-43">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb1-44">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_source_note</span>(</span>
<span id="cb1-45">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">source_note =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">md</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Source: [Sports Reference](https://www.sports-reference.com/cbb/seasons/2021-school-stats.html)"</span>)</span>
<span id="cb1-46">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-47">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>),</span>
<span id="cb1-48">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_body</span>(</span>
<span id="cb1-49">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(Team)</span>
<span id="cb1-50">    )</span>
<span id="cb1-51">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-52">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-53">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>),</span>
<span id="cb1-54">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_body</span>(</span>
<span id="cb1-55">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Sched. Strength</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span>),</span>
<span id="cb1-56">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rows =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Sched. Strength</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb1-57">    )</span>
<span id="cb1-58">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-59">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-60">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"green"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"normal"</span>),</span>
<span id="cb1-61">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_body</span>(</span>
<span id="cb1-62">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Sched. Strength</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span>),</span>
<span id="cb1-63">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rows =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Sched. Strength</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb1-64">    )</span>
<span id="cb1-65">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-66">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-67">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>),</span>
<span id="cb1-68">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_body</span>(</span>
<span id="cb1-69">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Simple Rating</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span>),</span>
<span id="cb1-70">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rows =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Simple Rating</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb1-71">    )</span>
<span id="cb1-72">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-73">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-74">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"green"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"normal"</span>),</span>
<span id="cb1-75">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_body</span>(</span>
<span id="cb1-76">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">columns =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Simple Rating</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span>),</span>
<span id="cb1-77">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rows =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span><span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Simple Rating</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">`</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb1-78">    )</span>
<span id="cb1-79">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-80">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">opt_row_striping</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-81">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">opt_table_lines</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-82">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb1-83">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_borders</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sides =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"top"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bottom"</span>), </span>
<span id="cb1-84">                         <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"grey"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">px</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)),</span>
<span id="cb1-85">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_column_labels</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb1-86">  )</span></code></pre></div></div>
</details>
<div class="cell-output-display">
<div id="tdzvpxrecu" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#tdzvpxrecu table {
  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#tdzvpxrecu thead, #tdzvpxrecu tbody, #tdzvpxrecu tfoot, #tdzvpxrecu tr, #tdzvpxrecu td, #tdzvpxrecu th {
  border-style: none;
}

#tdzvpxrecu p {
  margin: 0;
  padding: 0;
}

#tdzvpxrecu .gt_table {
  display: table;
  border-collapse: collapse;
  line-height: normal;
  margin-left: auto;
  margin-right: auto;
  color: #333333;
  font-size: 16px;
  font-weight: normal;
  font-style: normal;
  background-color: #FFFFFF;
  width: auto;
  border-top-style: none;
  border-top-width: 2px;
  border-top-color: #A8A8A8;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #A8A8A8;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
}

#tdzvpxrecu .gt_caption {
  padding-top: 4px;
  padding-bottom: 4px;
}

#tdzvpxrecu .gt_title {
  color: #333333;
  font-size: 125%;
  font-weight: initial;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-color: #FFFFFF;
  border-bottom-width: 0;
}

#tdzvpxrecu .gt_subtitle {
  color: #333333;
  font-size: 85%;
  font-weight: initial;
  padding-top: 3px;
  padding-bottom: 5px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-color: #FFFFFF;
  border-top-width: 0;
}

#tdzvpxrecu .gt_heading {
  background-color: #FFFFFF;
  text-align: center;
  border-bottom-color: #FFFFFF;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#tdzvpxrecu .gt_bottom_border {
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#tdzvpxrecu .gt_col_headings {
  border-top-style: none;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#tdzvpxrecu .gt_col_heading {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 6px;
  padding-left: 5px;
  padding-right: 5px;
  overflow-x: hidden;
}

#tdzvpxrecu .gt_column_spanner_outer {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 4px;
  padding-right: 4px;
}

#tdzvpxrecu .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#tdzvpxrecu .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#tdzvpxrecu .gt_column_spanner {
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 5px;
  overflow-x: hidden;
  display: inline-block;
  width: 100%;
}

#tdzvpxrecu .gt_spanner_row {
  border-bottom-style: hidden;
}

#tdzvpxrecu .gt_group_heading {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-top-style: none;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  text-align: left;
}

#tdzvpxrecu .gt_empty_group_heading {
  padding: 0.5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  border-top-style: none;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: middle;
}

#tdzvpxrecu .gt_from_md > :first-child {
  margin-top: 0;
}

#tdzvpxrecu .gt_from_md > :last-child {
  margin-bottom: 0;
}

#tdzvpxrecu .gt_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  margin: 10px;
  border-top-style: none;
  border-top-width: 1px;
  border-top-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  overflow-x: hidden;
}

#tdzvpxrecu .gt_stub {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
}

#tdzvpxrecu .gt_stub_row_group {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
  vertical-align: top;
}

#tdzvpxrecu .gt_row_group_first td {
  border-top-width: 2px;
}

#tdzvpxrecu .gt_row_group_first th {
  border-top-width: 2px;
}

#tdzvpxrecu .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#tdzvpxrecu .gt_first_summary_row {
  border-top-style: none;
  border-top-color: #D3D3D3;
}

#tdzvpxrecu .gt_first_summary_row.thick {
  border-top-width: 2px;
}

#tdzvpxrecu .gt_last_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#tdzvpxrecu .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#tdzvpxrecu .gt_first_grand_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-style: none;
  border-top-width: 6px;
  border-top-color: #D3D3D3;
}

#tdzvpxrecu .gt_last_grand_summary_row_top {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: none;
  border-bottom-width: 6px;
  border-bottom-color: #D3D3D3;
}

#tdzvpxrecu .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#tdzvpxrecu .gt_table_body {
  border-top-style: none;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#tdzvpxrecu .gt_footnotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#tdzvpxrecu .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#tdzvpxrecu .gt_sourcenotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#tdzvpxrecu .gt_sourcenote {
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#tdzvpxrecu .gt_left {
  text-align: left;
}

#tdzvpxrecu .gt_center {
  text-align: center;
}

#tdzvpxrecu .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#tdzvpxrecu .gt_font_normal {
  font-weight: normal;
}

#tdzvpxrecu .gt_font_bold {
  font-weight: bold;
}

#tdzvpxrecu .gt_font_italic {
  font-style: italic;
}

#tdzvpxrecu .gt_super {
  font-size: 65%;
}

#tdzvpxrecu .gt_footnote_marks {
  font-size: 75%;
  vertical-align: 0.4em;
  position: initial;
}

#tdzvpxrecu .gt_asterisk {
  font-size: 100%;
  vertical-align: 0;
}

#tdzvpxrecu .gt_indent_1 {
  text-indent: 5px;
}

#tdzvpxrecu .gt_indent_2 {
  text-indent: 10px;
}

#tdzvpxrecu .gt_indent_3 {
  text-indent: 15px;
}

#tdzvpxrecu .gt_indent_4 {
  text-indent: 20px;
}

#tdzvpxrecu .gt_indent_5 {
  text-indent: 25px;
}

#tdzvpxrecu .katex-display {
  display: inline-flex !important;
  margin-bottom: 0.75em !important;
}

#tdzvpxrecu div.Reactable > div.rt-table > div.rt-thead > div.rt-tr.rt-tr-group-header > div.rt-th-group:after {
  height: 0px !important;
}
</style>

<table class="gt_table caption-top table table-sm table-striped small" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading header">
<td colspan="6" class="gt_heading gt_title gt_font_normal" style="text-align: left; color: #000000; font-weight: bold;">The Huskers are the top of the bottom</td>
</tr>
<tr class="gt_heading even">
<td colspan="6" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border" style="text-align: left; color: #000000;">They only won 7 games but have the best simple rating and toughest schedule among the last place teams.</td>
</tr>
<tr class="gt_col_headings header">
<th id="Team" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" style="border-top-width: 1px; border-top-style: solid; border-top-color: grey; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: grey" scope="col">Team</th>
<th id="Conference" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" style="border-top-width: 1px; border-top-style: solid; border-top-color: grey; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: grey" scope="col">Conference</th>
<th id="W" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" style="border-top-width: 1px; border-top-style: solid; border-top-color: grey; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: grey" scope="col">W</th>
<th id="L" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" style="border-top-width: 1px; border-top-style: solid; border-top-color: grey; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: grey" scope="col">L</th>
<th id="Simple-Rating" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" style="border-top-width: 1px; border-top-style: solid; border-top-color: grey; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: grey" scope="col">Simple Rating</th>
<th id="Sched.-Strength" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" style="border-top-width: 1px; border-top-style: solid; border-top-color: grey; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: grey" scope="col">Sched. Strength</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr class="odd">
<td class="gt_row gt_left" headers="Team" style="color: #000000; font-weight: bold">Nebraska</td>
<td class="gt_row gt_left" headers="Conference">Big Ten</td>
<td class="gt_row gt_right" headers="W">7</td>
<td class="gt_row gt_right" headers="L">20</td>
<td class="gt_row gt_right" headers="Simple Rating" style="color: #00FF00; font-weight: normal">6.08</td>
<td class="gt_row gt_right" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">12.28</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="Team" style="color: #000000; font-weight: bold">University of California</td>
<td class="gt_row gt_left gt_striped" headers="Conference">Pac-12</td>
<td class="gt_row gt_right gt_striped" headers="W">9</td>
<td class="gt_row gt_right gt_striped" headers="L">20</td>
<td class="gt_row gt_right gt_striped" headers="Simple Rating" style="color: #00FF00; font-weight: normal">4.89</td>
<td class="gt_row gt_right gt_striped" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">9.75</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="Team" style="color: #000000; font-weight: bold">DePaul</td>
<td class="gt_row gt_left" headers="Conference">Big East</td>
<td class="gt_row gt_right" headers="W">5</td>
<td class="gt_row gt_right" headers="L">14</td>
<td class="gt_row gt_right" headers="Simple Rating" style="color: #00FF00; font-weight: normal">2.67</td>
<td class="gt_row gt_right" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">8.83</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="Team" style="color: #000000; font-weight: bold">Texas A&amp;M</td>
<td class="gt_row gt_left gt_striped" headers="Conference">SEC</td>
<td class="gt_row gt_right gt_striped" headers="W">8</td>
<td class="gt_row gt_right gt_striped" headers="L">10</td>
<td class="gt_row gt_right gt_striped" headers="Simple Rating" style="color: #00FF00; font-weight: normal">2.20</td>
<td class="gt_row gt_right gt_striped" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">4.86</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="Team" style="color: #000000; font-weight: bold">East Carolina</td>
<td class="gt_row gt_left" headers="Conference">AAC</td>
<td class="gt_row gt_right" headers="W">8</td>
<td class="gt_row gt_right" headers="L">11</td>
<td class="gt_row gt_right" headers="Simple Rating" style="color: #00FF00; font-weight: normal">1.00</td>
<td class="gt_row gt_right" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">3.83</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="Team" style="color: #000000; font-weight: bold">Boston College</td>
<td class="gt_row gt_left gt_striped" headers="Conference">ACC</td>
<td class="gt_row gt_right gt_striped" headers="W">4</td>
<td class="gt_row gt_right gt_striped" headers="L">16</td>
<td class="gt_row gt_right gt_striped" headers="Simple Rating" style="color: #00FF00; font-weight: normal">0.82</td>
<td class="gt_row gt_right gt_striped" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">8.97</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="Team" style="color: #000000; font-weight: bold">Iowa State</td>
<td class="gt_row gt_left" headers="Conference">Big 12</td>
<td class="gt_row gt_right" headers="W">2</td>
<td class="gt_row gt_right" headers="L">22</td>
<td class="gt_row gt_right" headers="Simple Rating" style="color: #FF0000; font-weight: bold">-0.72</td>
<td class="gt_row gt_right" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">10.40</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="Team" style="color: #000000; font-weight: bold">Loyola (MD)</td>
<td class="gt_row gt_left gt_striped" headers="Conference">Patriot</td>
<td class="gt_row gt_right gt_striped" headers="W">6</td>
<td class="gt_row gt_right gt_striped" headers="L">11</td>
<td class="gt_row gt_right gt_striped" headers="Simple Rating" style="color: #FF0000; font-weight: bold">-2.29</td>
<td class="gt_row gt_right gt_striped" headers="Sched. Strength" style="color: #FF0000; font-weight: bold">-3.47</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="Team" style="color: #000000; font-weight: bold">Illinois State</td>
<td class="gt_row gt_left" headers="Conference">MVC</td>
<td class="gt_row gt_right" headers="W">7</td>
<td class="gt_row gt_right" headers="L">18</td>
<td class="gt_row gt_right" headers="Simple Rating" style="color: #FF0000; font-weight: bold">-5.45</td>
<td class="gt_row gt_right" headers="Sched. Strength" style="color: #00FF00; font-weight: normal">0.38</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="Team" style="color: #000000; font-weight: bold">North Carolina-Wilmington</td>
<td class="gt_row gt_left gt_striped" headers="Conference">CAA</td>
<td class="gt_row gt_right gt_striped" headers="W">7</td>
<td class="gt_row gt_right gt_striped" headers="L">10</td>
<td class="gt_row gt_right gt_striped" headers="Simple Rating" style="color: #FF0000; font-weight: bold">-6.84</td>
<td class="gt_row gt_right gt_striped" headers="Sched. Strength" style="color: #FF0000; font-weight: bold">-6.47</td>
</tr>
</tbody><tfoot>
<tr class="gt_sourcenotes odd">
<td colspan="6" class="gt_sourcenote">By Matt Waite</td>
</tr>
<tr class="gt_sourcenotes even">
<td colspan="6" class="gt_sourcenote">Source: <a href="https://www.sports-reference.com/cbb/seasons/2021-school-stats.html">Sports Reference</a></td>
</tr>
</tfoot>

</table>

</div>
</div>
</div>
<p>Nebraska has the best simple rating against the toughest competition of the top 10 of the bottom. Meaning they played better against tougher teams than any of these schools on here, including the Big East, the SEC and the Pac-12. The closest in competition to the Big Ten is the Big 12, and Nebraska is far better than Iowa State (which, this season, is a low bar).</p>
<p>But what about all teams in college basketball? Where does Nebraska rank out against other teams and other conferences?</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_vline</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">xintercept =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6.08</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb2-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_beeswarm</span>(</span>
<span id="cb2-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data=</span>stats, </span>
<span id="cb2-5">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">groupOnX=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span>, </span>
<span id="cb2-6">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>OverallSRS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>Conference), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"grey"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb2-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_beeswarm</span>(</span>
<span id="cb2-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data=</span>lastplace, </span>
<span id="cb2-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">groupOnX=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>, </span>
<span id="cb2-10">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>OverallSRS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>Conference), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"blue"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb2-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_beeswarm</span>(</span>
<span id="cb2-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data=</span>nu, </span>
<span id="cb2-13">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">groupOnX=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>, </span>
<span id="cb2-14">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>OverallSRS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>Conference), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-15">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text</span>(</span>
<span id="cb2-16">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Big Ten"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nebraska"</span>)</span>
<span id="cb2-17">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb2-18"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Simple Rating"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">""</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nebraska's simple rating is better than 9 conferences"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"The Husker's finished dead last in the Big Ten, but wouldn't anywhere else given their rating."</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">caption=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Source: Sports Reference | By Matt Waite"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb2-19">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_minimal</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb2-20">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="cb2-21">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">face =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>),</span>
<span id="cb2-22">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>), </span>
<span id="cb2-23">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.subtitle =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>), </span>
<span id="cb2-24">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">panel.grid.minor =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb2-25">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title.position =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"plot"</span></span>
<span id="cb2-26">    )</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: The `groupOnX` argument of `geom_beeswarm()` is deprecated as of ggbeeswarm
0.7.1.
ℹ ggplot2 now handles this case automatically.</code></pre>
</div>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/is-nebraska-the-best-worst-basketball-team/index_files/figure-html/unnamed-chunk-2-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>Admittedly, the nine conferences Nebraska wins aren’t exactly powerhouses. What about the Power Five?</p>
<p>By simple rating, Nebraska is better than 14 teams in the Power Five, including four SEC teams and three Big 12 teams. How much better? This bubble chart with the size of the dot scaled by number of wins shows that Nebraska is better than a lot of teams who won more games.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1">powerfive <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Big Ten"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Big 12"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Pac-12"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"SEC"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ACC"</span>)</span>
<span id="cb4-2"></span>
<span id="cb4-3">betterpowerfive <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> stats <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(Conference <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%in%</span> powerfive) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(OverallSRS <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.10</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">desc</span>(OverallSRS))</span>
<span id="cb4-4"></span>
<span id="cb4-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb4-6">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_point</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data=</span>betterpowerfive, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>OverallSRS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>OverallSOS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size=</span>OverallWins)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb4-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_point</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data=</span>nu, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>OverallSRS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>OverallSOS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size=</span>OverallWins), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"red"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb4-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_text_repel</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data=</span>betterpowerfive, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span>OverallSRS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span>OverallSOS, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">label=</span>Team), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">point.padding =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb4-9"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Simple Rating"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">""</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nebraska doesn't finish last anywhere else in the Power Five"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">subtitle=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"In the Big 12 or the SEC, Nebraska is closer to the middle of the pack than the bottom."</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">caption=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Source: Sports Reference | By Matt Waite"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb4-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_minimal</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb4-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(</span>
<span id="cb4-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">face =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bold"</span>),</span>
<span id="cb4-13">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.title =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>), </span>
<span id="cb4-14">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.subtitle =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>), </span>
<span id="cb4-15">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">panel.grid.minor =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_blank</span>(),</span>
<span id="cb4-16">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot.title.position =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"plot"</span></span>
<span id="cb4-17">    )</span></code></pre></div></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/is-nebraska-the-best-worst-basketball-team/index_files/figure-html/unnamed-chunk-3-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
<p>Nebraska has the core of its team coming back and the Big Ten is not going to be as good as it was this year going forward. There’s been turmoil in some programs, turnover in others, and the NBA draft is going to take some talented players out of the conference.</p>
<p>Where does Nebraska finish next year? Signs point to better than last.</p>



 ]]></description>
  <category>huskers</category>
  <category>code</category>
  <category>analysis</category>
  <guid>https://www.mattwaite.com/posts/is-nebraska-the-best-worst-basketball-team/</guid>
  <pubDate>Sun, 28 Mar 2021 05:00:00 GMT</pubDate>
  <media:content url="https://www.mattwaite.com/posts/is-nebraska-the-best-worst-basketball-team/image.png" medium="image" type="image/png" height="88" width="144"/>
</item>
<item>
  <title>How I (poorly) filled out my NCAA bracket with machine learning</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/ncaa-bracket-with-machine-learning-2021/</link>
  <description><![CDATA[ 





<p>I do not know a lot about college basketball. I follow the <a href="https://huskers.com/sports/mens-basketball">travails of my employer</a> and a little about the Big Ten Conference as a whole, but at best it’s surface knowledge. I kinda know who is good that we’re going to play and who isn’t. Beyond that, nada.</p>
<p>Which is bad when it comes to tournament time.</p>
<p>My typical pattern of filling out bracket is Have I Heard Of This Team, Do They Have a Legendary Coach or Do I Hate Them For Some Reason. Depending on the answers, I make my pick. It’s not rocket science, and it rarely works.</p>
<p>This season, along with my SPMC460 Advanced Sports Data Analysis class, I decided to try use machine learning to get me a better bracket. The class is about the use of machine learning in sports, and so we’re going to use classification algorithms to decide a simple W or L designation.</p>
<p>What follows is the logic and the code I used to fill out my bracket.</p>
<p>How did it go?</p>
<p>Not great. Could I have done better guessing? Doubtful.</p>
<section id="toolkit" class="level2">
<h2 class="anchored" data-anchor-id="toolkit">Toolkit</h2>
<p>What I’m using to make and feed the model is the Tidyverse and Tidymodels set of libraries, the <code>gt</code> library for presenting some tables later, and <code>doParallel</code> for parallel processing, because the xgboost model training takes a while.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidymodels)</span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(gt)</span>
<span id="cb1-4"></span>
<span id="cb1-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">set.seed</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1234</span>)</span>
<span id="cb1-6"></span>
<span id="cb1-7"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(doParallel)</span>
<span id="cb1-8">cores <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> parallel<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">detectCores</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">logical =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span>)</span></code></pre></div></div>
</details>
</div>
</section>
<section id="feature-engineering" class="level2">
<h2 class="anchored" data-anchor-id="feature-engineering">Feature engineering</h2>
<p>The data I’m using is scraped from Sports Reference and it’s the box scores of every Division I college basketball game since the start of the 2014-2015 season. The data is a little funny in that each game is in there twice – I’m scraping school pages, so the Team is always that school, and the Opponent is someone else. So a game between two Division I schools will appear twice – one for each Team.</p>
<p>My logic in picking predictors was that how efficient teams are with the ball is important, so I <a href="https://fansided.com/2015/12/21/nylon-calculus-101-possessions/">estimated the number of possessions</a> and then calculated offensive and defensive ratings (which is points per 100 possessions).</p>
<p>I then wanted some kind of a metric of how good of a win or how bad of a loss a particular game was. So I calculated the score margin and added it to the opponent’s simple rating from Sports Reference. So a team losing close to a good team isn’t a bad loss. A bad team beating a good team is a great win. And so on. So if you’re a team beating up on bad teams, you don’t get a lot of credit for that.</p>
<p>Then, I used the teams cumulative mean over the course of the season to estimate what they would have going into the game. Obviously, you can’t know how a team will play going into a game, but I figure that they’ll be somewhere around their cumulative mean, which should pick up if the team is playing better or worse over a few games.</p>
<p>Then, for tournament purposes, I cut that to the last 10 games of the season. You are who you are in your last 10 games before the end of the season.</p>
<p>At least, that was my thinking.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1">games <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">read_csv</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"http://mattwaite.github.io/sportsdatafiles/cbblogs1521.csv"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb2-2">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Possessions =</span> .<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>(TeamFGA <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> TeamOffRebounds <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> TeamTurnovers <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">475</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> TeamFTA)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> .<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>(OpponentFGA <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> OpponentOffRebounds <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> OpponentTurnovers <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (.<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">475</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> OpponentFTA)),</span>
<span id="cb2-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">OffensiveRating =</span> (TeamScore<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>Possessions)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, </span>
<span id="cb2-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">DefensiveRating =</span> (OpponentScore<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>Possessions)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>,</span>
<span id="cb2-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ScoreDifference =</span> TeamScore <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> OpponentScore,</span>
<span id="cb2-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">WinQuality =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">case_when</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">is.na</span>(OpponentSRS) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> ScoreDifference, <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> ScoreDifference <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> OpponentSRS)</span>
<span id="cb2-7">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb2-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(Team, Season) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb2-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb2-10">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Cumulative_Mean_Offensive =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(OffensiveRating),</span>
<span id="cb2-11">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Cumulative_Mean_Defensive =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(DefensiveRating),</span>
<span id="cb2-12">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Cumulative_Mean_WinQuality =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cummean</span>(WinQuality)</span>
<span id="cb2-13">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb2-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">between</span>(Game, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(Game)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(Game))) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb2-15">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb2-16">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(</span>
<span id="cb2-17"> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Outcome =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">case_when</span>(</span>
<span id="cb2-18">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grepl</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"W"</span>, W_L) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"W"</span>, </span>
<span id="cb2-19">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grepl</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"L"</span>, W_L) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"L"</span></span>
<span id="cb2-20"> )</span>
<span id="cb2-21">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb2-22">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Outcome =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.factor</span>(Outcome)) </span></code></pre></div></div>
</details>
</div>
<p>Then, to get both sides of a match-up to be the correct stats, I used some joining to combine them into a single dataset with the cumulative stats for each side that will then use to train a model.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1">selectedgames <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> games <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb3-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(</span>
<span id="cb3-3">    Season, Team, Date, Opponent, Outcome, Cumulative_Mean_Offensive, Cumulative_Mean_Defensive, Cumulative_Mean_WinQuality, TeamSRS, TeamSOS)</span>
<span id="cb3-4"></span>
<span id="cb3-5">opponentgames <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> selectedgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb3-6">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>Opponent) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb3-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rename</span>(</span>
<span id="cb3-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Opponent =</span> Team, </span>
<span id="cb3-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Opponent_Cumulative_Offensive =</span> Cumulative_Mean_Offensive, </span>
<span id="cb3-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Opponent_Cumulative_Mean_Defensive =</span> Cumulative_Mean_Defensive, </span>
<span id="cb3-11">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Opponent_Cumulative_Mean_WinQuality =</span> Cumulative_Mean_WinQuality, </span>
<span id="cb3-12">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">OpponentSRS =</span> TeamSRS, </span>
<span id="cb3-13">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">OpponentSOS =</span> TeamSOS</span>
<span id="cb3-14">    )</span>
<span id="cb3-15"></span>
<span id="cb3-16">bothsides <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> selectedgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb3-17">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">left_join</span>(opponentgames, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">by=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Opponent"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Date"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Season"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb3-18">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">na.omit</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb3-19">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>Outcome.y) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb3-20">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rename</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Outcome =</span> Outcome.x)</span></code></pre></div></div>
</details>
</div>
</section>
<section id="modeling-with-tidymodels" class="level2">
<h2 class="anchored" data-anchor-id="modeling-with-tidymodels">Modeling with Tidymodels</h2>
<p>There’s a growing supply of tutorials on how to use tidymodels to do machine learning, and one of the authors of the library, Julia Silge, has <a href="https://juliasilge.com/category/tidymodels/">a long list of posts</a> that greatly helped me figure this all out.</p>
<p>To start the modeling processing, I’m going to split my data into training and testing sets.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1">bracket_split <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">initial_split</span>(bothsides, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">prop =</span> .<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>)</span>
<span id="cb4-2">bracket_train <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">training</span>(bracket_split)</span>
<span id="cb4-3">bracket_test <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">testing</span>(bracket_split)</span></code></pre></div></div>
</details>
</div>
<p>I then created a simple recipe, which doesn’t do much except set aside some fields as ID fields instead of making them predictors.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1">xg_rec <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span id="cb5-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">recipe</span>(Outcome <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> ., <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> bracket_train) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb5-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">update_role</span>(Team, Opponent, Date, Season, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_role =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ID"</span>)</span>
<span id="cb5-4"></span>
<span id="cb5-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(xg_rec)</span></code></pre></div></div>
</details>
</div>
<p>Then I define my model, which I am going to tune all of the hyperparameters in an xgboost model later.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1">xg_mod <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span>   <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">boost_tree</span>(</span>
<span id="cb6-2">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">trees =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tune</span>(), </span>
<span id="cb6-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">learn_rate =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tune</span>(),</span>
<span id="cb6-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tree_depth =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tune</span>(), </span>
<span id="cb6-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">min_n =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tune</span>(),</span>
<span id="cb6-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">loss_reduction =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tune</span>(), </span>
<span id="cb6-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sample_size =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tune</span>(), </span>
<span id="cb6-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mtry =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tune</span>(), </span>
<span id="cb6-9">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb6-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">set_mode</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"classification"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb6-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">set_engine</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"xgboost"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">nthread =</span> cores)</span></code></pre></div></div>
</details>
</div>
<p>With a recipe and a model definition, I can create a workflow, which will now handle a whole lot of chores for me.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1">bracket_wflow <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span id="cb7-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">workflow</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb7-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_model</span>(xg_mod) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb7-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_recipe</span>(xg_rec)</span></code></pre></div></div>
</details>
</div>
<p>To tune my hyperparameters, I am going to use a <a href="https://en.wikipedia.org/wiki/Latin_hypercube_sampling">Latin Hypercube</a>, which is a method for generating near-random samples of paremeters to try.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1">xgb_grid <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grid_latin_hypercube</span>(</span>
<span id="cb8-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">trees</span>(),</span>
<span id="cb8-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tree_depth</span>(),</span>
<span id="cb8-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">min_n</span>(),</span>
<span id="cb8-5">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">loss_reduction</span>(),</span>
<span id="cb8-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sample_size =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sample_prop</span>(),</span>
<span id="cb8-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">finalize</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mtry</span>(), bracket_train),</span>
<span id="cb8-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">learn_rate</span>(),</span>
<span id="cb8-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span></span>
<span id="cb8-10">)</span></code></pre></div></div>
</details>
</div>
<p>To test these hyperparemeters, I am going to make some cross-fold valiations samples that we can use.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1">bracket_folds <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">vfold_cv</span>(bracket_train)</span></code></pre></div></div>
</details>
</div>
<p>And now comes the part that makes my laptop fan turn into a jet engine. The next block uses parallel processing to try the 30 samples from the Latin Hypercube and tests it against my cross fold validation samples. It … takes a while.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb10" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1">doParallel<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">registerDoParallel</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">cores =</span> cores)</span>
<span id="cb10-2"></span>
<span id="cb10-3">xgb_res <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tune_grid</span>(</span>
<span id="cb10-4">  bracket_wflow,</span>
<span id="cb10-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">resamples =</span> bracket_folds,</span>
<span id="cb10-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">grid =</span> xgb_grid,</span>
<span id="cb10-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">control =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">control_grid</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">save_pred =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>)</span>
<span id="cb10-8">)</span>
<span id="cb10-9"></span>
<span id="cb10-10">doParallel<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">stopImplicitCluster</span>()</span></code></pre></div></div>
</details>
</div>
<p>But out of it, we get the best combination of hyperparameters to use as inputs into our model. I’m going to use area under the curve as my evaluation metric to determine what is best.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb11" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1">best_roc <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select_best</span>(xgb_res, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"roc_auc"</span>)</span></code></pre></div></div>
</details>
</div>
<p>And I can now feed that into my final workflow.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb12" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1">final_xgb <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">finalize_workflow</span>(</span>
<span id="cb12-2">  bracket_wflow,</span>
<span id="cb12-3">  best_roc</span>
<span id="cb12-4">)</span></code></pre></div></div>
</details>
</div>
<p>And I can now train a model to use on bracket games.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb13" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb13-1">xg_fit <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span id="cb13-2">  final_xgb <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb13-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fit</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> bracket_train)</span></code></pre></div></div>
</details>
</div>
</section>
<section id="evaluating-the-model" class="level2">
<h2 class="anchored" data-anchor-id="evaluating-the-model">Evaluating the model</h2>
<p>So how does this model do?</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb14" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1">trainresults <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> bracket_train <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb14-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(xg_fit, bracket_train))</span>
<span id="cb14-3"></span>
<span id="cb14-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">metrics</span>(trainresults, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">truth =</span> Outcome, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">estimate =</span> .pred_class)</span></code></pre></div></div>
</details>
</div>
<p>Against my training set, not bad. I can predict the correct outcome of a basketball game better than 70 percent of the time.</p>
<p>How about against data the model hasn’t seen yet?</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb15" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb15-1">testresults <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> bracket_test <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb15-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(xg_fit, bracket_test))</span>
<span id="cb15-3"></span>
<span id="cb15-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">metrics</span>(testresults, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">truth =</span> Outcome, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">estimate =</span> .pred_class)</span></code></pre></div></div>
</details>
</div>
<p>Just about the same, which means my model is robust to new data.</p>
<p>I have made a machine learning model that is better at this than I could be.</p>
<p>Mission accomplished.</p>
<p>I think.</p>
</section>
<section id="play-in-games" class="level2">
<h2 class="anchored" data-anchor-id="play-in-games">Play In Games</h2>
<p>I’m not going to bore you with the tedium of applying this to every game in each round. My notebook that does it all is almost 900 lines of code long, and this post is already getting long. But here’s an example of what it looks like using the play-in games.</p>
<p>To do this, I needed to make a tibble of the games, with the team and opponent. The date doesn’t matter, but it’s needed because my model is expecting it.</p>
<p>Then, I need to get the right data for each team and join it to them so each game has the predictors the model is expecting. Then, using the model, we can predict the outcome.</p>
<div class="cell">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb16" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1">playin <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span>(</span>
<span id="cb16-2">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Team=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Norfolk State"</span>,</span>
<span id="cb16-3">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Opponent=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Appalachian State"</span>,</span>
<span id="cb16-4">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Date =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2021-03-19"</span>)</span>
<span id="cb16-5">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb16-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Team=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Wichita State"</span>,</span>
<span id="cb16-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Opponent=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Drake"</span>,</span>
<span id="cb16-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Date =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2021-03-19"</span>)</span>
<span id="cb16-9">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb16-10">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Team=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Mount St. Mary's"</span>,</span>
<span id="cb16-11">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Opponent=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Texas Southern"</span>,</span>
<span id="cb16-12">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Date =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2021-03-19"</span>)</span>
<span id="cb16-13">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">add_row</span>(</span>
<span id="cb16-14">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Team=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Michigan State"</span>,</span>
<span id="cb16-15">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Opponent=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"UCLA"</span>,</span>
<span id="cb16-16">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Date =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.Date</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2021-03-19"</span>)</span>
<span id="cb16-17">)</span>
<span id="cb16-18"></span>
<span id="cb16-19">playingames <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> selectedgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-20">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(Team) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-21">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(Date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(Date), Season <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2020-2021"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-22">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>Date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>Opponent, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>Outcome) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-23">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(playin)</span>
<span id="cb16-24"></span>
<span id="cb16-25">playingames <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> opponentgames <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-26">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(Opponent) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-27">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(Date <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(Date)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-28">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>()  <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-29">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>Season, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>Date, <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>Outcome) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-30">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">right_join</span>(playingames, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">by=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Opponent"</span>)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-31">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(Team, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb16-32"></span>
<span id="cb16-33">playinround <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> xg_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-34">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> playingames) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb16-35">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(playingames) </span>
<span id="cb16-36"></span>
<span id="cb16-37">playinround <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> xg_fit <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-38">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_data =</span> playinround, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"prob"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span></span>
<span id="cb16-39">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_cols</span>(playinround)</span>
<span id="cb16-40"></span>
<span id="cb16-41">playinround <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(Team, .pred_class, Opponent, .pred_L) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-42">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gt</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-43">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">opt_row_striping</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-44">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">opt_table_lines</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb16-45">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tab_style</span>(</span>
<span id="cb16-46">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">style =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cell_borders</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sides =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"top"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bottom"</span>), </span>
<span id="cb16-47">                         <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"grey"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">weight =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">px</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)),</span>
<span id="cb16-48">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">locations =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cells_column_labels</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">everything</span>())</span>
<span id="cb16-49">  )</span></code></pre></div></div>
</details>
</div>
<p>Since these games have already happened, we know the outcome, and my model got 3 of 4 correct. The only miss was predicting Norfolk State would win, but it also happens to be the game the model has the least amount of confidence in.</p>
<p>This might actually work.</p>
</section>
<section id="hows-it-going" class="level2">
<h2 class="anchored" data-anchor-id="hows-it-going">How’s it going?</h2>
<p>In a word: horrible.</p>
<p>After two rounds, my bracket is better than 38 percent of brackets on ESPN, which puts me in 9.1 millionth place, give or take. I’ve been as low as 10.8 millionth place, so I’ve come up a bit. I still have three of my four Final Four teams and four of eight Elite Eight teams.</p>
<p>When the dust has settled, I’m going to come back and evaluate. Here’s screenshots of my bracket.</p>
<div class="quarto-figure quarto-figure-left">
<figure class="figure">
<p><img src="https://www.mattwaite.com/posts/ncaa-bracket-with-machine-learning-2021/Screen Shot 2021-03-22 at 10.39.09 PM.png" class="img-fluid quarto-figure quarto-figure-left figure-img" style="width:100.0%"></p>
</figure>
</div>
<p><img src="https://www.mattwaite.com/posts/ncaa-bracket-with-machine-learning-2021/Screen Shot 2021-03-22 at 10.39.24 PM.png" class="img-fluid" style="width:100.0%"></p>


</section>

 ]]></description>
  <category>code</category>
  <category>analysis</category>
  <guid>https://www.mattwaite.com/posts/ncaa-bracket-with-machine-learning-2021/</guid>
  <pubDate>Mon, 22 Mar 2021 05:00:00 GMT</pubDate>
  <media:content url="https://www.mattwaite.com/posts/ncaa-bracket-with-machine-learning-2021/Screen Shot 2021-03-22 at 10.39.09 PM.png" medium="image" type="image/png" height="75" width="144"/>
</item>
<item>
  <title>Choosing a World Cup Team to root for in each match: An algorithmic approach.</title>
  <link>https://www.mattwaite.com/posts/2018-06-12-choosing-a-world-cup-team-to-root-for-in-each-match-an-algorithmic-approach/</link>
  <description><![CDATA[ 





<p>The World Cup is here. For a large swath of the planet, we do not have a team in the tournament, which raises a question: Who do you root for game by game?</p>
<p>I’m teaching a sports data visualization and analysis course this fall, so I started thinking if there was an assignment in here somewhere. Could students develop some kind of algorithm? And the more I thought about it, the more I realized: Nope.&nbsp;</p>
<p>Here’s why, in pseudocode, that an algorithmic approach to choosing a side in each match is not something you can do in code:&nbsp;</p>
<p>for each of two teams in a match: &nbsp; &nbsp;if you’ve been to that country: &nbsp; &nbsp; &nbsp; &nbsp;take that team &nbsp; &nbsp;else if you’ve been to both: &nbsp; &nbsp; &nbsp; &nbsp;take the one where you have better friends &nbsp; &nbsp;else if you have good friends or no friends in both: &nbsp; &nbsp; &nbsp; &nbsp;take the one where you had a better meal &nbsp; &nbsp;else if the food is pretty good in both: &nbsp; &nbsp; &nbsp; &nbsp;take the one with the less horrible national drink &nbsp; &nbsp;else if you’ve been to neither: &nbsp; &nbsp; &nbsp; &nbsp;take the one that didn’t bribe their way into the tournament &nbsp; &nbsp;else if both arrived seemingly fairly/both bribed everyone to get there: &nbsp; &nbsp; &nbsp; &nbsp;take the one who used to be a beloved ally until recently &nbsp; &nbsp;else if both were beloved allies until recently: &nbsp; &nbsp; &nbsp; &nbsp;take the one who you haven’t fought a war against at some point in history &nbsp; &nbsp;else if you’ve never fought a war against either: &nbsp; &nbsp; &nbsp; &nbsp;take the one that has a player you’ve heard of before &nbsp; &nbsp;else if neither has a player you know: &nbsp; &nbsp; &nbsp; &nbsp;take the one with the cooler nickname (example: the Indomitable Lions of&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Cameroon, sadly not in the tournament) &nbsp; &nbsp;else if neither country are all that friendly: &nbsp; &nbsp; &nbsp; &nbsp;take the one not run by a murderous dictator &nbsp; &nbsp;else if both are run by a murderous dictator: &nbsp; &nbsp; &nbsp; &nbsp;take the one with a better uniform &nbsp; &nbsp;else if both murderous dictatorships have decent kits: &nbsp; &nbsp; &nbsp; &nbsp;take the one that has nuclear weapons &nbsp; &nbsp;and if all else fails: &nbsp; &nbsp; &nbsp; &nbsp; root for Iceland. Their whole country has a population equal to Honolulu, Hawaii.</p>



 ]]></description>
  <guid>https://www.mattwaite.com/posts/2018-06-12-choosing-a-world-cup-team-to-root-for-in-each-match-an-algorithmic-approach/</guid>
  <pubDate>Tue, 12 Jun 2018 05:00:00 GMT</pubDate>
</item>
<item>
  <title>I wrote a data journalism manual for my college in 1997. They never used it, but they kept it.</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/2016-03-24-i-wrote-a-data-journalism-manual-for-my-college-in-1997-they-never-used-it-but-they-kept-it/</link>
  <description><![CDATA[ 





<p>In October 1997, I was trying to graduate from college. The University of Nebraska-Lincoln’s College of Journalism and Mass Communications told me that I needed 19 credit hours to graduate mid year, and that’s how many I was taking.</p>
<p>That is, until they told me six weeks before graduation that I needed one more.</p>
<p>To get that credit hour, the Journalism Department chair agreed to let me complete an independent study. In that independent study, for one credit hour, I was to create a Computer-Assisted Reporting class. The proposal I had to write said I would create a syllabus, recommend texts and create class materials.</p>
<p>In the proposal, I wrote that “every reporter should know how to feed a city budget into a spreadsheet and figure out the percent changes in the budget.” I also said they should be able to query a database, but not every reporter would have to know stats like linear regression. “An introduction to statistics is essential, but any depth is a waste of time.”</p>
<p>I was 22. It was 1997. We all make bad calls sometime.</p>
<p>But how do I know about this? Because the very same college that I wrote this proposal and subsequent manual for is now my employer. The same employer where I now teach data journalism. And that employer is cleaning out the archives, and today they found a file with my name on it.</p>
<p>In the file were notes from my senior exit interview. In that interview, I said that I was “not totally satisfied with the core courses” and believed the college should hire a data journalism/reporting professor like <a href="https://cronkite.asu.edu/about/faculty-and-leadership/faculty/doigbio">Steve Doig</a>. Absolutely nothing has changed since that day. I’m still not totally satisfied with the core courses, and I would cut off a toe it it meant we got to hire Steve.</p>
<p>But also in that file was the proposal for the data journalism course and the course materials I wrote for the credit.</p>
<p>It’s equal parts cringe worthy and things I teach now, 19 years later.</p>
<p>In it, I introduce strange lingo like ASCII text, delimiters and zip files. I show how to use Excel to measure change in populations. I show how to group and count some crime data to show what day the Lincoln Police Department got the most larceny reports (in 1995) using SQL. I talked about how to negotiate for data, and avoid being overcharged for data by bureaucrats who didn’t want to give up digital records. I showed people how to sign up for NICAR-L (which I joined in 1995 and have been on ever since). I even talked about how to use the web to find data. How? By using Dogpile, of course, to search for the Census Bureau’s population projections data set. Google didn’t exist when I wrote this.</p>
<p>There’s even a joke where the punchline is Quattro Pro.</p>
<p>I also made a bad bet on the geek/nerd label. The manual is called “Geek Like Me” and I talked about how everyone wanted to be a geek now. Alas, nerds ended up being the preferred term.</p>
<p>From what I can tell, the manual was read by the department chair – he noted a dozen or so typos in highlighter – and it was put in a file. To my knowledge, the document was never used. We can surmise that file somehow survived the retirement of that department chair, survived the move from one building to another one across campus, and has sat in a filing cabinet for, let’s be honest, no good reason at all until this week.</p>
<p>My copy of it was put on a <a href="https://en.wikipedia.org/wiki/Zip_drive">Zip Disk</a> where I thought it would be safe. I long ago lost the ability to read that disk, if I could even find it. I had just assumed that my efforts – strung out over a series of all-nighters – had just faded into nothing. To be honest, I had forgotten all about it until today.</p>
<p><a href="https://mattwaite.github.io/geeklikeme.pdf">And here it is</a>.</p>
<p>In the 14 years between my graduation and me being hired as a professor of practice, a course appeared on the books: JOUR407 Investigative and Computer Assisted Reporting. No one here now knows how it got there, who proposed it, or if it was ever taught before I got here. But I teach that course now. <a href="https://github.com/mattwaite">And all of my materials are online</a>.</p>
<p>Here’s hoping GitHub doesn’t go the way of the Zip Disk.</p>



 ]]></description>
  <category>data journalism</category>
  <category>retro</category>
  <guid>https://www.mattwaite.com/posts/2016-03-24-i-wrote-a-data-journalism-manual-for-my-college-in-1997-they-never-used-it-but-they-kept-it/</guid>
  <pubDate>Thu, 24 Mar 2016 05:00:00 GMT</pubDate>
</item>
<item>
  <title>Using Lego to teach data visualization</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/2015-01-23-using-lego-to-teach-data-visualization/</link>
  <description><![CDATA[ 





<p><img src="https://64.media.tumblr.com/7246c7339b8d93d2253381d6b89b5160/tumblr_inline_pc2ouzcYFg1qcjsxt_540.jpg" class="img-fluid"></p>
<p>Today in my data visualization class, I made students visualize meaningful differences between this year’s Super Bowl teams, the Seattle Seahawks and the New England Patriots. Except I made them do it with Lego.&nbsp;</p>
<p>A little silly, yes, but I wasn’t just gilding my Professor of the Year application, I swear. There was a purpose.&nbsp;</p>
<p>The first time I taught this class, I steered too hard into tools and code. We spent a little time on the history, theory and thinking behind data visualization and lot of time on teaching tools and later trying to cram enough d3 at them to make something. The problem was, in the race to get to the software tools, a lot of mental tools that would have helped them make better graphics didn’t get talked about.&nbsp;</p>
<p>So this time, I pledged to do it differently.</p>
<p>In the class – <a href="https://github.com/mattwaite/JOUR491-Data-Visualization">syllabus and other materials are online</a> – we’re using Alberto Cairo’s <a href="http://www.thefunctionalart.com/">The Functional Art</a>&nbsp;and Edward Tufte’s <a href="http://www.edwardtufte.com/tufte/books_vdqi">Visual Display of Quantitative Information</a> as texts. Today, we were talking about the form and function of graphics, about Cairo’s argument that the function limits the form. Cairo argues that the data, the questions the designer means the reader to ponder and the reader herself dictate the form, or at the very least constrain it to a limited set of choices.&nbsp;</p>
<p>That was the point I was trying to drive home: constraints. All journalism is constraint. Time, information, data, money, sources, access. So given a task and a constraint, what could you do?</p>
<p>Bring in the Lego.</p>
<p>Using squares and rectangles, I wanted them to make something. Visualize some data. We haven’t talked tools yet, so this would get them in the game without having to touch their laptops.&nbsp;</p>
<p><img src="https://64.media.tumblr.com/58f74faedcebadf162bab313fe1a4389/tumblr_inline_pc2ov1tRLX1qcjsxt_540.jpg" class="img-fluid"></p>
<p>If you want to steal this idea, you need to do the following:&nbsp;</p>
<ol>
<ul>
<li><p>Mug an 8-year-old. I conveniently found one in my house and shook him down for a few hundred bricks and two large flat square pieces to act as a base. You may not have one so close. The number of bricks needed ended up being less than 100, so it doesn’t take much. I also swiped a couple of packs of sticky notes from the college office to act as data labels.&nbsp;</p></li>
<li><p>Choose a topic or dataset that allows for some exploration and decision making. I chose the Super Bowl because it was fun and there is no shortage of stats in easily obtainable form online. I also thought – mistakenly – that football stats would be easily understood. I was surprised by the number of students who didn’t follow football that closely.&nbsp;</p></li>
<li><p>Get out of the way. I split the class of eight in half and told them I wanted them to visualize meaningful differences between the teams. That’s it. They immediately set about discussing what they would visualize and how they were going to make the bricks mean something. The discussions about scale and how to make a brick represent X touchdowns or Y yards were fantastic.&nbsp;</p></li>
</ul>
</ol>
<p><img src="https://64.media.tumblr.com/3ad5f9bb742363b77870d15c8767fd05/tumblr_inline_pc2ov1sSJK1qcjsxt_540.jpg" class="img-fluid"></p>
<p>To be clear, I <a href="https://twitter.com/zararah/status/530044489365479425">wasn’t the first to do this</a>, and one news organization did it as an <a href="http://mashable.com/2014/11/04/lego-senate-2014/">election results tracker</a>. But I’ll do it again. Class was energized, ideas were flowing and it was fun. Not a bad way to learn.</p>



 ]]></description>
  <guid>https://www.mattwaite.com/posts/2015-01-23-using-lego-to-teach-data-visualization/</guid>
  <pubDate>Fri, 23 Jan 2015 06:00:00 GMT</pubDate>
</item>
<item>
  <title>Everything I Know About Data I Learned From 70s Album Rock…</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/2014-12-09-everything-i-know-about-data-i-learned-from-70s-album-rock/</link>
  <description><![CDATA[ 





<iframe width="560" height="315" src="https://www.youtube.com/embed/yyLkL0h6efM?si=-zBiAfeLyJUDSDVo" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="">
</iframe>
<p>Everything I Know About Data I Learned From 70s Album Rock Radio, my Newsgeist 2014 Ignite talk.</p>



 ]]></description>
  <category>data journalism</category>
  <category>talks</category>
  <guid>https://www.mattwaite.com/posts/2014-12-09-everything-i-know-about-data-i-learned-from-70s-album-rock/</guid>
  <pubDate>Tue, 09 Dec 2014 06:00:00 GMT</pubDate>
</item>
<item>
  <title>A classroom experiment in Twitter Bots and creativity</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/2014-11-20-a-classroom-experiment-in-twitter-bots-and-creativity/</link>
  <description><![CDATA[ 





<p>This semester, I’m teaching a class in Story Bots, which is really a programming class disguised as a journalism class. I’m teaching students enough programming that they can automate journalistically useful things, things like scrape a website and alert you to a potential story. Or take a dataset and turn each record into a journalistic narrative.&nbsp;</p>
<p>One of the assignments was to make a Twitter bot. They could do what they wanted with it, but it had to use Twitter and had to run on a simple cron job. It had to tweet, and they had to put their bot on Github when they were done (sans access keys).&nbsp;</p>
<p>Here’s what they came up with.</p>
<p><strong><a href="https://twitter.com/sylviagagaplath">Lady Plath by Sara Janak</a> </strong></p>
<p>Lady Plath takes a line from a Sylvia Plath poem and a line of Lady Gaga lyrics and randomly combines them into gloriously weird tweets. Example:</p>
<blockquote class="twitter-tweet blockquote">
<p>Hearted gambling-game you warily practice I’m in love with Judas</p>
<div>
— Lady Plath (<span class="citation" data-cites="sylviagagaplath">@sylviagagaplath</span>)
</div>
<a href="https://twitter.com/sylviagagaplath/status/534591663104995328">November 18, 2014</a>
</blockquote>
<script charset="utf-8" src="//platform.twitter.com/widgets.js" type="text/javascript"></script>
<p><a href="https://github.com/sarajanak/JOUR491-Storybots-Janak-Homework/blob/master/ladyplath.py">Code here.</a></p>
<p><a href="https://twitter.com/NebraskaUFOs"><strong>Nebraska UFOs by Jeff Renken</strong></a></p>
<p>This bot goes to the <a href="http://www.nuforc.org/">National UFO Reporting Center</a>&nbsp;and checks for new reports in Nebraska. If it finds one, it tweets it out. Example:</p>
<blockquote class="twitter-tweet blockquote">
<p>10/30/04 Lincoln, Two red lights. It was like they were on each end of a bar and just moving slowly from the east… <a href="http://t.co/Ud7LNhijhp">http://t.co/Ud7LNhijhp</a></p>
<div>
— Nebraska UFOs (<span class="citation" data-cites="NebraskaUFOs">@NebraskaUFOs</span>)
</div>
<a href="https://twitter.com/NebraskaUFOs/status/527927170203516928">October 30, 2014</a>
</blockquote>
<script charset="utf-8" src="//platform.twitter.com/widgets.js" type="text/javascript"></script>
<p><a href="https://github.com/jeffrenken/jour491StorybotsRenkenHomework/tree/master/NebraskaUFOs">Code here</a>.</p>
<p><strong><a href="https://twitter.com/RNDM_HomerSays/with_replies">Random Homer Simpson Quote bot by Jordan Tate</a></strong></p>
<p>A select few people who hashtag something #HomerSimpson will get a randomly chosen quote response from the Random Homer Simpson Quote bot. Does what it says on the tin.</p>
<blockquote class="twitter-tweet blockquote">
<p><a href="https://twitter.com/lucioolima"><span class="citation" data-cites="lucioolima">@lucioolima</span></a> What do we need a psychiatrist for? We know our kid is nuts.</p>
<div>
— Random Homer QUOTES: (<span class="citation" data-cites="RNDM_HomerSays">@RNDM_HomerSays</span>)
</div>
<a href="https://twitter.com/RNDM_HomerSays/status/535432405885009920">November 20, 2014</a>
</blockquote>
<script charset="utf-8" src="//platform.twitter.com/widgets.js" type="text/javascript"></script>
<p><a href="https://github.com/JordanTate41/JOUR491-Storybots-Tate-homework/blob/master/homerbotgh.py">Code here</a>.</p>
<p><a href="https://twitter.com/tarantinoebooks"><strong>Tarantino ebooks by Tony Papousek</strong></a></p>
<p>This bot does two things: uses Markov chains to write a new Tarantino script, 140 characters at a time, and responds to anyone who tweets “English motherf***er, do you speak it” with a simple “What?” (If you haven’t seen Pulp Fiction, shame on you).&nbsp;</p>
<blockquote class="twitter-tweet blockquote">
<p>As he tosses his other glove out the register,“ and they don’t lift a fuckin’ joke man! She’s supposed to be much of a bag of water</p>
<div>
— Tarantino Ebooks (<span class="citation" data-cites="tarantinoebooks">@tarantinoebooks</span>)
</div>
<a href="https://twitter.com/tarantinoebooks/status/535455040241012736">November 20, 2014</a>
</blockquote>
<script charset="utf-8" src="//platform.twitter.com/widgets.js" type="text/javascript"></script>
<p><a href="http://papousek.org/twitter/">Code here</a>.</p>
<p><a href="https://twitter.com/rebel_ebooks"><strong>Rebel_ebooks by Spencer Hansen</strong></a></p>
<p>Excited for the new Star Wars movie? Read lines of dialogue before they appear on screen though the miracles of Markov chains of the Empire Strikes Back script (the best movie, FYI).&nbsp;</p>
<blockquote class="twitter-tweet blockquote">
<p>Feel the flow</p>
<div>
— rebel_ebooks (<span class="citation" data-cites="rebel_ebooks">@rebel_ebooks</span>)
</div>
<a href="https://twitter.com/rebel_ebooks/status/529326522151104512">November 3, 2014</a>
</blockquote>
<script charset="utf-8" src="//platform.twitter.com/widgets.js" type="text/javascript"></script>
<p><a href="https://github.com/Spenchismo/JOUR491-Storybots-Hansen-Homework/tree/master/ebooks">Code here</a>.</p>
<p><strong><a href="https://twitter.com/MattWaitEbooks">Matt Waite ebooks by Daniel Wheaton</a></strong></p>
<p>I like to think I run my classes a little different from most other university courses and it’s conversations like this that give me hope it’s true:</p>
<p>Daniel: “Can I have your complete Twitter archive?”</p>
<p>Matt: “Uh, why?”</p>
<p>Daniel: “I don’t want to say.”</p>
<p>Matt: “Sure, why not.”</p>
<p>And then this happens.</p>
<blockquote class="twitter-tweet blockquote">
<p>Con: good luck getting those songs out of math</p>
<div>
— MattWaitEbooks (<span class="citation" data-cites="MattWaitEbooks">@MattWaitEbooks</span>)
</div>
<a href="https://twitter.com/MattWaitEbooks/status/535524246760333312">November 20, 2014</a>
</blockquote>
<script charset="utf-8" src="//platform.twitter.com/widgets.js" type="text/javascript"></script>
<p><a href="https://github.com/dwheaton2011/JOUR491-Storybots-Wheaton/tree/master/Waitebot">Code here</a>.</p>
<p>In the interests of shared suffering, I made my own. It’s pretty tame by comparison.&nbsp;</p>
<p><a href="https://twitter.com/LNKdogbot"><strong>LNK Lost Dog Bot by Matt Waite</strong></a></p>
<p>The City of Lincoln has a Lost Pets page, where they put reports of lost animals. I scrape the dogs and tweet out the new ones with a number to call if you’ve seen them. Simple.</p>
<blockquote class="twitter-tweet blockquote">
<p>A chocolate Labrador Retriever went missing near 7400 Blk S 95 Ct on Nov.&nbsp;19. If you see ‘em, please call Animal Control at 402-441-7900.</p>
<div>
— LNK Missing Dog Bot (<span class="citation" data-cites="LNKdogbot">@LNKdogbot</span>)
</div>
<a href="https://twitter.com/LNKdogbot/status/535403500792844288">November 20, 2014</a>
</blockquote>
<script charset="utf-8" src="//platform.twitter.com/widgets.js" type="text/javascript"></script>
<p>With all this grading to do, I haven’t put my code up.</p>



 ]]></description>
  <guid>https://www.mattwaite.com/posts/2014-11-20-a-classroom-experiment-in-twitter-bots-and-creativity/</guid>
  <pubDate>Thu, 20 Nov 2014 06:00:00 GMT</pubDate>
</item>
<item>
  <title>UNL CoJMC students: Two data/programming/future courses for the fall</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/2014-03-31-unl-cojmc-students-two-dataprogrammingfuture-courses-for-the-fall/</link>
  <description><![CDATA[ 





<p>If you’re a UNL CoJMC student looking for courses in the fall, here’s two I’m teaching you should take a look at:</p>
<p><strong>JOUR407: Investigative and Computer-Assisted Reporting:&nbsp;</strong>This class is all about data journalism – emphasis on both parts of that phrase. I’ll show you how to incorporate data and data analysis into your stories, regardless of format. You’ll learn techniques that will help you break a dataset down and interview it like a source. We’ll get our hands dirty with data and we’ll turn those into stories. We’ll add some data visualization to the toolbox as well. <a href="https://github.com/mattwaite/JOUR407-Data-Journalism/blob/master/syllabus.md">The not-close-to-complete syllabus is here</a>.&nbsp;</p>
<p><strong>JOUR491: Intro to Storybots:&nbsp;</strong>More and more, publishers are using software bots to write stories. They cover baseball games and earthquakes. The dirty secret is that basic bots are not hard to write. It takes basic programming knowledge and basic journalism knowledge. Combine the two and you can write thousands of stories in a matter of seconds. In this class, we’ll learn how to make our own storybots, we’ll ponder the nature what it means to be human and where this is all going in journalism. Want a taste? <a href="https://source.opennews.org/en-US/articles/bot-or-be-botted/">Read this</a>. <a href="https://github.com/mattwaite/JOUR491-Storybots">I’ve put the very first sketches of the class online here</a>.</p>



 ]]></description>
  <guid>https://www.mattwaite.com/posts/2014-03-31-unl-cojmc-students-two-dataprogrammingfuture-courses-for-the-fall/</guid>
  <pubDate>Mon, 31 Mar 2014 05:00:00 GMT</pubDate>
</item>
<item>
  <title>A 5-step NICAR recovery plan</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/2014-03-02-a-5-step-nicar-recovery-plan/</link>
  <description><![CDATA[ 





<p>First time at NICAR this year? Awesome. Welcome. This was my 15th conference. I started in 1997 in Nashville. I was a senior in college, desperate to find a job, and NICAR was an amazing and formative experience for me. I made friends, learned a lot and found a kind of nerdy spiritual home. NICAR has become like a weird nomadic family for me. It’s my tribe. A really nerdy, wonderful tribe.</p>
<p>But I can remember being in your shoes after my first NICAR. You’re bone tired, but JACKED UP. Excited, but uneasy. There’s <em>so much</em> to learn. So many people doing so many amazing things with tools you’ve never heard of before, or using tools you have heard of in ways you never dreamed possible. It’s really easy to be intimidated by it all.</p>
<p>Don’t be.</p>
<p>The truth is, everyone at NICAR has either been where you are or are exactly where you are right now. I’m even there with you. So much to do. So much to learn.</p>
<p>Don’t let this time go to waste. Don’t let this energy fade away. Don’t be intimidated by the enormity of it all. Here’s 5 steps to avoid the post NICAR crash and burn.</p>
<p><strong>1. Find a specific story or project you want to work on that will require a technology you want to learn to get it done.</strong></p>
<p>The absolute worst thing you can do is go to work on Monday without an idea or plan to use what you saw, learned or got interested in. It is shockingly easy to go back to work, fall right back into your routine, go right back to the stuff you were working on before the conference and before you know it, it’s a month later and you’ve forgotten half of what got you interested in the first place.</p>
<p>The solution is to walk into the office with an idea and a plan to get it done. You’ve probably got a list of ideas right now. That’s great. Write them down, create a spreadsheet or a to-do list on your phone or whatever. Pick one idea on your list and post the rest of it somewhere you’ll see it regularly. Focus on one, get it done, then move on.</p>
<p>And start working on it right away. If you can walk in and start working hour one minute one on Monday, great. If you’ve got to find time in the day, brown bag your lunch and start then. Can’t get the time at the office? Work on it at home. But don’t wait. You’ll be shocked how fast this time will go and it’s vitally important. Waiting is the worst thing you can do.</p>
<p><strong>2. Pick one thing. One. You can’t learn all the NICAR in one project.</strong></p>
<p>My annual problem with NICAR is I leave with a stack of ideas and technologies I want to try RIGHT NOW. And that’s on top of the three or four side projects I want to work on all the time.</p>
<p>It’s tempting to want to try and inhale new things and just jam them into your skull. But it’s impossible. In fact it’s harmful to your progress. Pick one thing. One. One technology, one technique, one task, and do it. Just that one.</p>
<p>If you want to use Excel to look at your city’s budget, do that. Just that. Those amazing pivot tables and NodeXL social network graphs you saw will be there when you’re ready. If you want to write a scraper in Python to get data you can use for a story, do that. Just that. The news app that puts it on the web will come later. The point here is to focus.</p>
<p>Pick one problem, solve it.</p>
<p><strong>3. Your first project is going to suck. Do it anyway.</strong></p>
<p>This is just generally true, but one of the real intimidation factors for me at NICAR was that the class I took was taught by a Pulitzer Prize winner who did this otherworldly story and how the hell am I supposed to do that?</p>
<p>You’re not. Not yet anyway. The Taj Mahal was not built by someone who had never built an ugly shack before.</p>
<p>My first projects were for my campus newspaper and probably bored student readers right into a nap (which in college is known as reader service). But I still did them. Each one taught me something. How to do this with Excel, how to incorporate numbers into a story without boring people, etc. The awards came later, but never would have happened without those first stories.</p>
<p>Same goes for news applications. <a href="http://newsdevfirsts.tumblr.com/">There’s a whole website dedicated to showcasing everyone’s first news app.</a> <a href="http://newsnerdfirsts.tumblr.com/post/64735080309/census-2000">Mine is especially atrocious.</a> Hey, it was 2001, what can I say? We could barely spell internet back then.</p>
<p>But if you’re worried about living up to the standards of the people who taught your class, stop. Your first project will suck. You’ll look back on it later and cringe. And at a NICAR down the road, I’ll buy you a beer and we can argue about who has the more awful first project. And 50 people around us will join in. Everyone’s first project sucks. Do it anyway.</p>
<p><strong>4. Don’t quit until it’s done.</strong></p>
<p>I get this question all the time: “I’m a journalist. I want to learn how to program. Tell me how.” I have suggestions and websites and learning materials I can tell them about, but the most important thing I tell them is this: Don’t quit until it’s done.</p>
<p>When your brain hurts because you’re really stretching to learn something new, don’t quit. When you’re straight up frustrated because it’s not working and you don’t know why, don’t quit. When you’re tired of it, or you’re thinking “maybe this wasn’t for me”, don’t quit. Keep going. Push through that. You don’t get to say “this wasn’t for me” or “I just didn’t like it” until it’s done. If you finish whatever you set out to accomplish, and you see it in the world, and at that moment you decide to never do this again, fine. That’s your call. But I’ll bet you cash money seeing what you made in the world will hit you like a drug, and you’ll want to do it again. And next time, it’ll go faster, and it’ll be better, and you’ll want to do it again.</p>
<p>Learning something new is about not quitting when your mind and body and soul tell you to quit. Don’t quit. Be stubborn. The idea of quitting, of letting it beat you, should be offensive to you. Get mad. Better yet, get even. Finish it. Don’t quit.</p>
<p><strong>5. Remember: You are not alone.</strong></p>
<p>I said at the beginning two things I want you to remember: NICAR is a weird, nomadic family. And welcome to it.</p>
<p>People have been saying for decades that NICAR feels different – and it is different – because of the culture of the conference. I can talk for hours about what that culture is and why it’s the way it is, but it boils down to this: It’s a giving culture.</p>
<p>Every one of the speakers? Volunteer. All of the hands-on teachers? Same. Did you talk to someone in the hall? Grab a speaker after to ask them a question? They almost certainly stayed right there and answered your question, right? I can remember time after time of Big Name Journalists From Big Name News Organizations dropping everything and showing me how to do something. I can count scores of times where they gave me a business card and said call me if you run into trouble. That generosity amazed me. Inspired me. Made me want to do the same.</p>
<p>That culture extends outside of the conference. The NICAR-L listserv has been helping people every day for 20 years now. Get on it. Not comfortable with that? Email the teacher of your hands-on class. You’ll be amazed at how generous they are. Meet someone at the conference? Email them.</p>
<p>Ask for help, and help will be there. I promise. It’s part of being in the tribe. You do not have to do this yourself.</p>
<p>But here’s the deal: Remember all the help you got. Because someday someone is going to come to you in that same moment. Help them. That too is being part of the tribe.</p>



 ]]></description>
  <guid>https://www.mattwaite.com/posts/2014-03-02-a-5-step-nicar-recovery-plan/</guid>
  <pubDate>Sun, 02 Mar 2014 06:00:00 GMT</pubDate>
</item>
<item>
  <title>A small step toward solving the our curriculum is too full problem</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/2014-02-11-a-small-step-toward-solving-the-our-curriculum-is-too-full-problem/</link>
  <description><![CDATA[ 





<p>One of the arguments used to push back against adding new things into journalism school curricula is “Our curriculum is too full! We can’t possibly add anything more! What are we going to do? Stop teaching writing? Or editing?”</p>
<p>First, the argument is silly — no one said anyone was going to stop teaching writing or reporting or whatever “fundamental” skill is most beloved by the combatant.&nbsp;</p>
<p>Second, it’s not an either or problem.</p>
<p>Put another way, you can view a crowded curriculum as a challenge or a lament. Too many view it as a lament and throw their hands up.</p>
<p>I’ve started picking away at this problem — viewing it as the challenge that it is — by focusing on a specific class: beginning reporting.</p>
<p>Let’s start with a set of statements:</p>
<ol>
<ul>
<li><p>I believe that all reporting classes need to beef up the amount of data journalism contained in them. Data is everywhere, and thus it’s part of modern journalism, and thus it should be in every reporting class.</p></li>
<li><p>I believe the level of mathematics education that most journalism schools require (if any at all) is far too low.</p></li>
<li><p>I believe the inside-joke “journalists are bad at math ha ha” has to stop.</p></li>
</ul>
</ol>
<p>Given that, the place to start is beginning reporting. Why there? Because if you expose math and data to beginning reporters, they will not know any better than to think that math and data are part of the job. Because guess what? Math and data are part of the job.</p>
<p>The argument that I get against adding data to a beginning reporting class is that it can’t be done because we need to spend as much time as possible teaching them how to write and how to report. Learn how to interview people. Learn how to write an effective lead. Learn how to write using AP Style. Learn how to find the news. Learn how to come up with good story ideas. And many of them don’t get enough of all that in beginning reporting.&nbsp;</p>
<p>And, to be fair, they have a point. Until you write a few thousand leads, they’re hard to do and even harder to do well. For students who don’t read news, finding the news in something is difficult. It takes repetition.</p>
<p>But what if we combined some skills training and showed how one leads to another which leads to another?&nbsp;</p>
<p>What if we combined the basic math-for-reporters section we teach with how to do those exact same problems with a spreadsheet, and then used that spreadsheet with real data to find real stories? Math + Data = Story ideas.&nbsp;</p>
<p>Well, I’ve started to do exactly that, and <a href="https://github.com/mattwaite/MathForBeginningReporters">I’m hosting it on GitHub</a>. It’s a work in progress, but the idea is to take basic math skills, show how you can do them on a spreadsheet, then take real data and do the same thing, but this time with an eye toward generating story ideas. I’d like this module to take a week of class time — with in-class and out-of-class learning.&nbsp;</p>
<p>I have no idea when I’ll be done with it, but I intend to use it in my own beginning reporting class when it’s done.&nbsp;As always, pull requests, issues or criticisms are welcome.&nbsp;</p>
<p>Some of the math is painfully basic, but I’ve found students who had no idea that mean and average were the same thing. They’d so completely fled from math that concepts like orders of operation were foreign to them. So laugh all you want at some of the topics covered, but I assure you, they’re rooted in experience.&nbsp;</p>
<p>I have to believe that with a little creativity, the “our curriculum is too full” problem can be solved. I have to believe this because if it can’t, journalism education is screwed.</p>



 ]]></description>
  <guid>https://www.mattwaite.com/posts/2014-02-11-a-small-step-toward-solving-the-our-curriculum-is-too-full-problem/</guid>
  <pubDate>Tue, 11 Feb 2014 06:00:00 GMT</pubDate>
</item>
<item>
  <title>Unconference panel pitch I will someday make</title>
  <dc:creator>Matt Waite</dc:creator>
  <link>https://www.mattwaite.com/posts/2013-09-12-unconference-panel-pitch-i-will-someday-make/</link>
  <description><![CDATA[ 





<p><strong>I want to solve a journalism problem with a <a href="http://store.makerbot.com/replicator2.html">MakerBot</a>. What is it?</strong></p>
<p>I hate having a fantastic solution and no problem to solve. Being a solution in search of a problem sucks. I’m hoping to get students thinking about this in an <a href="http://makerhours.org/post/60465693744/announcing-the-maker-hours-fund">open lab time I’m running</a>. But seriously. I want a MakerBot. My gut says there’s a journalism problem to solve here. But I don’t know what it is yet.&nbsp;</p>
<p>Yet.</p>



 ]]></description>
  <guid>https://www.mattwaite.com/posts/2013-09-12-unconference-panel-pitch-i-will-someday-make/</guid>
  <pubDate>Thu, 12 Sep 2013 05:00:00 GMT</pubDate>
</item>
</channel>
</rss>
