## That Other Site I Work On

This site has been sparse lately and it is because I’ve been busy with two other projects.

The first is my actual day job. I finished my PhD in May of 2017 and began working at Verily Life Sciences in August of 2017. Did I turn down some jobs with pro teams? Yes. Yes I did. Why? That’s a story for another day. I like what I do at Verily. I get to have fun, with people I like, working on cool healthcare projects. Plus we work out of the Google offices in Cambridge which are very nice and full of free food and fun toys.

The second project I’ve been working on is the visualizations section of Udam Saini’s EightThirtyFour.

http://eightthirtyfour.com/visualizations

Udam and I worked together on this site’s NBA foul project, which started as an attempt to quantify how mad DeMarcus Cousins gets in games. We built survival models and visualizations to examine how players accrue fouls. But these models can just as easily be applied to assists, blocks etc. In fact, I took the ideas and examined how Russell Westbrook accrued assists in his historic triple-double season. By using survival models, we can see how the time between assists increased significantly after he reached 10 assists in a game. This could be seen as evidence in favor of stat padding.

The tool we’ve built on the site linked above allows you to look at survival visualizations and models for pretty much any player in seasons between 2011 and 2017. The stats primer linked in the first line has more explanation and some suggestions for players and stats to look at.

Survival analysis models and visualizations are not always the easiest to explain, but I think there is value in having other ways to analyze and examine data. Survival analysis can help us better understand things like fatigue and stat padding. And can help add some math to intangible things like “tilt.”

This project was also a lesson in working on a problem with a proper software engineer. I am a statistician and I’m used to a certain amount of data wrangling and cleaning, but I largely prefer to get data in a nice data frame and go from there. And I certainly don’t have the prowess to create a cool interactive tool on a website that blends SQL and R and any number of other engineer-y things. Well. I’d like to think I could, but it would take ages and look much uglier. And be slower. Conversely, my partner in crime Udam probably can’t sort through all the statistics and R code as fast as I can. My background isn’t even in survival analysis, but I still understand it better than a SWE. So this part of his site was a chance for us to combine powers and see what we could come up with. In between our actual Alphabet jobs, of course.

I think in the world of sports analytics, it’s hard to find somebody who has it all: excellent software engineering skills, deep theoretical knowledge of statistics, and deep knowledge of the sport (be it basketball or another sport). People like that exist, to be sure, but they likely already work for teams or are in other fields. I once tried to be an expert in all three areas and it was very stressful and a lot of work. Once I realized that I couldn’t do it all by myself and started looking for collaborations, I found that I was able to really shine in my expert areas and have way more fun with the work I do.

The same is true in any field. I wasn’t hired by Verily to be a baller software engineer *and* an expert statistician *and* have a deep understanding of a specific health care area. I work with awesome healthcare experts and engineers and get to focus just on my area of expertise.

In both my job and my side sports projects my goal is always to have fun working on cool problems with people I like. It’s more fun to be part of a team.

Anyway, have fun playing with the site, and if you have any suggestions, let us know :]

## Russell Westbrook and Assists

### Introduction

I was going to flesh this idea out and refine it for a proper paper/poster for NESSIS, but since I have to be in a wedding that weekend (sigh), here are my current raw thoughts on Russell Westbrook. I figured it was best to get these ideas out now …  before I become all consumed by The Finals.

I’ve been thinking a lot about Russell Westbrook and his historic triple-double season. Partially I’ve been thinking about how arbitrary the number 10 is, and how setting 10 to be a significant cutoff is similar to setting 0.05 as a p-value cutoff. But also I have been thinking about stat padding. It’s been pretty clear that Westbrook’s teammates would let him get rebounds, but there’s also been a bit of a debate about how he accrues assists. The idea being that once he gets to 10, he stops trying to get assists. Now this could mean that he passes less, or his teammates don’t shoot as much, or whatever. I’m not concerned with the mechanism, just the timing. For now.

I’ll examining play-by-play data and box-score data from the NBA for the 2016-2017 season. This data is publicly available from http://www.nba.com. The play-by-play contains rich event data for each game. The box-score includes data for which players started the game, and which players were on the court at the start of a quarter. Data, in csv format, can be found here.

Let’s look at the time to assist for every assist Westbrook gets and see if it significantly changes for assists 1-10 vs 11+. I thought about looking at every assist by number and doing a survival analysis, but soon ran into problems with sparsity and granularity. Westbrook had games with up to 22 assists, so trying to look at them individually got cumbersome. Instead I decided to group assists as follows: 1-7, 8-10 and 11+. I reasoned that Westbrook’s accrual rate for the first several assists would follow one pattern, which would then increase as he approached 10, and then taper off for assists 11+.

I freely admit that may not be the best strategy and am open to suggestions.

I also split out which games I would examine into 3 groups: all games, games where he got at least 11 assists, and games where he got between 11 and 17 assists. This was to try to account for right censoring from the end of the game. In other words, when we look at all games, we include games where he only got, say, 7 assists, and therefore we cannot hope to observe the difference in time to assist 8 vs assist 12. Choosing to cut at 17 assists was arbitrary and I am open to changing it to fewer or more.

### Basic Stats

Our main metric of interest is the time between assists, i.e. how many seconds of player time (so time when Westbrook is on the floor) occur between assists.

First, let us take a look at some basic statistics, where we examine the mean, median, and standard deviation for the time to assist broken down by group and by the different sets of games. Again, this is in seconds of player time.

We can see that if we look at all games, it appears that the time between assists goes down on average once Westbrook gets past 10 assists. However this sample of games includes games where he got upwards of 22 assists, which, given the finite length of games, means assists would tend to happen more frequently. Limiting ourselves to games with at least 11 assists, or games with 11-17 assists gives a view of a more typical game with many assists. We see in (1b) and (1c) that time to assist increases on average once Westbrook got his 10th assist.

However, these basic statistics only account for assists that Westbrook actually achieved, they do not account for any right censoring. That is, say Westbrook gets 9 assists in a game in the first half alone, and doesn’t record another assist all game despite playing, say, 20 minutes in the second half. If there game were to go on indefinitely, Westbrook eventually would record that 10th assist, say after 22 minutes. But since we never observe that hypothetical 10th assist, that contribution of 22 minutes isn’t included. Nor is even the 20 minutes of assist-less play. This basic censoring problem is why we use survival models.

### Visualization

Next we can plot Kaplan Meier survival curves for Westbrook’s assists broken down by group and by the different sets of games. I used similar curves when looking at how players accrue personal fouls – and I’ll borrow my language from there:

A survival curve, in general, is used to map the length of time that elapses before an event occurs. Here, they give the probability that a player has “survived” to a certain time without recording an assist (grouped as explained above). These curves are useful for understanding how a player accrues assists while accounting for the total length of time during which a player is followed, and allows us to compare how different assists are accrued.

Here is it very easy to see that the time between assists increases significantly once Westbrook has 10 assists. This difference is apparent regardless of which subset of games we look at, though the increase is more pronounced when we ignore games with fewer than 11 assists. We can also see that the time between assists doesn’t differ significantly between the first 7 assists and assists 8 through 10.

### Survival Models

Finally we could put the data into a conditional risk set model for ordered events. I’m not sure this is the best model to use for this data structure, given that I grouped the assists, but it will do for now. I recommend not looking at the actual numbers and just noticing that yes, theres is a significant difference between the baseline and the group of 11+ assists.

If interested we can find the hazard ratios associated with each assist group. To do so we exponentiate the coefficients since each coefficient is the log comparison with respect to the baseline of the 1st  through 7th assists. For example, looking at the final column, we see that, in games where Westbrook had between 11 and 17 assists, he was 63% less likely to record an assist greater than 10 versus how likely he was to record one of his first 7 assists (the baseline group). Interpreting coefficients is very annoying at times. The take away here is yes, there is a statistically significant difference.

### Discussion

Based on some simple analysis, it appears that the time between Russell Westbrook’s assists decreased once he reached 10 assists. This may contribute to the narrative that he stopped trying to get assists after he reached 10. Perhaps this is because he stopped passing, or perhaps its because his teammates just shot less effectively on would-be-assisted shots after 10. Additionally, there are many other factors that could contribute to the decline in time between assists. Perhaps there is general game fatigue, and assist rates drop off for all players. Maybe those games were particularly close in score and therefore Westbrook chose to take jump shots himself or drive to the basket.

What’s great is that a lot of these ideas can be explored using the data. We could look at play by play data and see if Russ was passing at the same rates before and after assist number 10. We could test if assist rates decline overall in the NBA as games progress. I’m not sure which potential confounding explanations are worth running down at the moment. Please, please, please, let me know in the comments, via email, or on Twitter if you have any suggestions or ideas.

REMINDER: The above analysis is something I threw together in the days between my graduation celebrations and The Finals starting and isn’t as robust or detailed as I might like. Take with a handful of salt.

## Catch & Shoot – Causal Effects

This is Part 3 of my series on Catch & Shoot jumpers
Part 1 can be found here
Part 2 can be found here

“You know, for having the name ‘Causal Kathy’ you don’t seem to post that much causal inference” – my beloved mentor giving me some solid life advice.

So alright, let’s talk about causal inference. First of all, what is causal inference? It’s a subfield of statistics that focuses on causation instead of just correlations. Think of this classic xkcd comic:

To give a more concrete example, let’s think about a clinical trial for some new drug and introduce some terminology along the way. Say we develop a drug that is supposed to lower cholesterol levels. In a perfect world, we could observe what happens to a patient’s cholesterol levels when we give him the drug and when we don’t. But we can never observe both outcomes in a world without split timelines and/or time machines. We call the two outcomes, under treatment and no treatment, “potential outcomes” or “counterfactuals.” The idea is that both outcomes have the potential to be true, but we can only ever observe one of them, so the other would be “counter to the fact of the truth.” Therefore, true, individual causal effects can never be calculated.

However, we can get at average causal effects across larger populations. Thinking of our drug example, we could enroll 1,000 people in a study and measure their baseline cholesterol levels. Then we could randomly assign 500 of those subjects to take the drug and assign the remaining 500 to a placebo drug. Follow up after a given period of time and measure everyone’s cholesterol levels again and find individual level changes from baseline. Then we could calculate the average change in each group and compare them. And since we randomized treatment assignment, we would have a good idea of the causal effect of the drug treatment on the outcome of cholesterol.

However, we can’t always randomize. In fact, it’s rare that we can. There are many reasons to prevent well controlled randomized trials. For example, if we wanted to test whether or not smoking causes cancer, it would be unethical to randomly assign 500 subjects to smoke for the rest of their lives and 500 subjects not to smoke and see who develops cancer. Similarly, if we want to know whether or not a catch & shoot (C&S ) shot in basketball has a positive effect on FG%, we can’t randomly assign shots to be C&S vs pull-up.

In general, basic statistics and parametric models only give correlations. When you fit a basic regression, the coefficients do not have causal interpretations. This is not to say that regressions and correlations aren’t interesting and useful – if you’ve been following my series on NBA fouls, you’ll note that I don’t do causal inference there. Associations are interesting in their own right. But today, let’s start looking at causal effects for C&S shots in the NBA.

Side note: If you’d like to read more about causal inference in the world of sports statistics, this recent post from Mike Lopez is great.

### Analysis

We’re going to be fitting models, so the first thing we’ll do is remove outlier shots. In this case I’m going to subset and only look at shots that were less than 30 feet (so between 10 and 30 feet). All the previous analysis was was basic and non-parametric, so including rare shots (like buzzer beater half court heaves) wouldn’t have a large impact. However now we are using models and making parametric assumptions, so outliers and influential points will have a bigger impact. It makes sense to remove them at this point.

Statistics side note: Part of the reason we need to remove outliers is because our analysis method will involve fitting “propensity scores” – the probably of treatment given the non-outcome variables. In this case we will model the probably a shot is a C&S given shot distance, defender distance, whether a shot was open, and the shot clock. For unusual outlier shots, the distance will often be abnormally long and it will be rare that the shot is successful. Thus if we left those shots in the data set, we would run into positivity problems.

Also, we aren’t going to look at the average causal effect of a C&S. That estimate assumes that all shots could be a C&S or a pull-up, and the player chose one or the other based on some variables. Most pull-up shots couldn’t have been a C&S, even if the player wanted them to be. But most C&S shots could have been pull-up shots. The player could have elected to hold the ball for longer and dribble a few times before taking the shot. Or even driven to the basket. Of course things are more nuanced. For example, some players (like my beloved Shaun Livingston) will almost never take a 3 point shot, C&S or pull-up. While others (like his teammate Klay Thompson) are loath to pass up a chance to take a C&S. Therefore looking at an average causal effect is not a great strategy. Instead we will look at the effect of a C&S on shots that were C&S shots. In the literature this is called the effect of treatment on the treated (ETT) or sometimes the average treatment effect on the treated (ATT). I use ETT, partially because that is what I was taught and partially because my advisor’s initials are ETT and it makes me giggle.

For those interested, here is a quick primer on the math behind ETT.

### Results

Below we see the effect of C&S on FG% on C&S shots. This effect is calculated for threes and twos. The estimates are computed with functionals that are functions of the observed data; they are not coefficients in a regression. As such, I calculated means, standard errors, and confidence intervals by repeatedly bootstrapping the data (250 times) and using weights randomly drawn from an exponential distribution with mean 1. This is a way to bootstrap the data without having to draw shots with replacement and uses every shot in every resample.

All estimates control for the following potential confounders:  shot distance, defender distance, an indicator for whether a shot was open, and the time left on the shot clock. I do not think this is a rich enough set of variables to full control for confounding, but its a decent start.

We can see that not dribbling and possessing the ball for less than 2 seconds (catch & shoot definition) does have a significant effect on FG%. The effect size is small but positive, about 0.04 for both two and three point shots. This means that a C&S three point attempt is about 4% more likely to be successful than if that shot were taken as a pull-up. This is a very small causal effect.

To me, this shows that the effect of a C&S isn’t as big as the raw numbers suggest. I calculated a few other measures of causal effects, both for ETT and ATE, but found nothing significant. I’m certain that the modeling assumptions required are not fully met, which may be biasing results towards the null. Were I to move forward on this project, I would dig deeper into the models I’m using and try to get a better understanding of the best way to model and predict both why a player elects to take a certain type of shot and what makes a shot more likely to be successful.

When I set out on this project, I was mostly just upset about the definition of a catch & shoot, since it didn’t take openness into account. I like to think I’ve made my case. If I had to make a change, I’d want the NBA to track open C&S shots as a separate statistic. Maybe even split it out further into twos and threes, or at least emphasize EFG% over FG%. The actual causal effect of a C&S isn’t that big – I’d rather keep track of a stat that does have a big effect.

I’ll probably let this project go for a while. A lot of other people are looking at it and doing a good job of it. I can add the causal component, but I’d rather look at under-examined areas.

## SSAC17 “Recap”

The weekend has come and gone and so has the 2017 Sloan Sports Analytics Conference. This was the third time I attended the conference and easily the most enjoyable experience I have had to date.

Many others have recapped a lot of the compelling analytics content, so I don’t feel compelled to repeat much of that. Moreover, I don’t have the journalistic abilities yet to condense everything I learned into a nice blog entry. AND I have a proper dissertation committee meeting this week, followed by the ENAR biometrics conference next week. Between the two, I haven’t been burdened with an abundance of time. So here are some thoughts on the conference, which will inevitably spiral into larger thoughts on the field as a whole.

My experience at SSAC this year was a weird mix of trying to see famous people speak, trying to hear interesting analytics/statistics talks, and trying to meet as many people as possible. In previous years I didn’t know anyone and wasn’t thinking seriously about a career in this field, so I prioritized panels with famous speakers. This was great for maximizing entertainment value. But now that I am making a proper attempt to pursue sports analytics as a career, it was clear I needed to actually understand where the field is and where its going… while still taking time to see big names where possible. Because who can resist Nate Silver and Mark Cuban or Nate Silver and Adam Silver. It’s clear that experiences at SSAC will vary greatly depending on interests and goals.

It’s also interesting to be at the conference while in a position of actively looking for a job. During almost every conversation I had, I was trying to maintain a balance between a number of potentially conflicting motivations. Mostly, I just wanted to nerd out and talk about sports stats with like-minded people. But I also wanted to make sure the work I am doing is in the right direction and get advice on how to be better. How can I improve my work not just to be better intrinsically, but also to have a bigger impact. And then at a certain point, especially if I was talking to somebody working for a team, I’d think “is this person on a team that is hiring? Would they want to hire me?” I’m better at networking than I used to be, but at the end of the day, I am a still a somewhat awkward stats nerd. One big takeaway from the conference for me was that I need to be more aggressive and confident in general. It’s easy to have imposter syndrome. I eventually felt generally okay with the other stats folks, but at a conference with a lot of MBAs, it can be intimidating to talk to new people. Especially since I was in the minority at SSAC.

Yep, I’m going to talk about diversity for a minute. There are a lot of men at Sloan. A lot of white men. And of the women who are there, few are statisticians. I was lucky enough to meet Diana Ma who does analytics for the Indiana Pacers. We hugged out of sheer joy of finding another woman in sports stats. Diana is the first woman I have met in person who works for a team in any sport. I’ve been in STEM for most of my life, and I’m used to being in scenarios that are majority white male, but SSAC takes the cake. Conference attendees are, for the most part, aware of the demographic disparities. Not just about the lack of women, but the lack of any other minorities. And there are always conversations about how to increase the diversity of the conference and the field overall. I don’t have a good answer, but I’m glad people (including Daryl Morey) are talking about it.

Side note to the jerks on twitter, and elsewhere, questioning why diversity is important – this is for you. Even if you want to argue that diversity adds nothing to the end product, equality is important. Not everyone who had interest in the conference had access. And not everyone who might have had interest had access to resources to foster that growing interest.

Moreover, I distinctly remember being at SSAC in 2015 and hearing somebody say that women shouldn’t bother with this field, because it is such a man’s world. I can’t remember if it was on a panel or a conversation I overheard, but it struck a huge chord with me and was a large part of why I eschewed the field for so long. Fortunately, I am lucky enough to have incredibly supportive friends, family, and mentors.

Which brings me to a final, big takeaway from the conference this year. Success in sports analytics has a large component of luck. From the family into which you were born, to the school you attended and the TA you happen to have for a class, to who re-tweets you, to who you randomly happen to be sitting next to at a panel. Don’t get me wrong, you also need skill. You need to be good enough that when you are lucky enough to make a connection or have your blog post re-tweeted, people find value in it and pay attention.

Our entire careers are about quantifying uncertainty and randomness in the data we examine; we should acknowledge the randomness in our lives.

Anyway. I met a lot of really awesome people. I’m going to avoid trying to name everyone, because I’m sure I’ll forget somebody and then feel bad. But needless to say, everyone was friendly, smart, and incredibly welcoming. I wish the conference were a few days longer so things wouldn’t be so rushed, interesting panels wouldn’t overlap, and I’d have more time to chat with everyone. It’s all well and good to talk over email or the phone, but in person conversations are ideal. Maybe next year I just won’t sleep.

I hope everyone makes it out to NESSIS in September.

Random thoughts

• Does specializing in a sport early really increase the risk of injury later in life? I think so. So do a lot of other people. But I also spoke to some folks this weekend who don’t buy it. Awesome. Let’s run the numbers. And then do it a few more times to make sure we have reproducible work.
• I was on the Hot Takedown live recording. I may or may not have totally whiffed a question about the Warriors. Caught the tail end of John Urschel’s segment. He’s great.
• Highlight of the weekend was a ~20 minute 1-on-1 conversation with John Urschel. We talked about causal inference, Voronoi diagrams, and super bowl win probability models. He is giant nerd and an incredibly warm person.
• Mark Cuban does not like Donald Trump.
• I love when athletes are on panels. Especially random additions. It’s nice to see Sue Bird and Shane Battier every year, but they are used to it by now. Luis Scola was a last minute addition to a few panels, and he gave thoughtful insights into how players use analytics.
• Luis Scola is a very tall man. So were a lot of the men at this conference. I am 5’4″.
• I know I want to pursue a career in sports analytics/statistics, but I have no idea of the best avenue. Should I try to join a team? The NBA? An independent company? Should I go get a regular job that will pay more and/or be less time intensive and pursue my own projects on the side? Which of these paths makes the most impact from the diversity side of things?
• I wonder if Bob Myers would be my agent when negotiating a job offer.
• Zach Lowe’s voice is as enjoyable in person as it is on his podcast.
• I still have yet to meet/introduce myself to Mike Zarren. Which is insane given the number of events I been at with him, my love for the Celtics, and the fact that I personally know another member of the Celtic’s analytics team. At this point, I almost want to see if I can meet Brad Stevens and Danny Ainge before meeting Mike.
• The name tags this year were not conducive to reading names. I wonder if that was intentional.
• Hynes >>>>>> BCEC
• Were we supposed to get two drink tickets? I only got one. But I feel like I got two last year.
• Years ago I did a project on optimal strategy for penalty kicks in the World Cup. I should update that.
• I have so many ideas for projects. So many. But this pesky PhD thing is going to get in the way for a few months. I’ll be able to put some stuff out, but school is going to take priority for a while.
• I love sports analytics so much.

## NBA Fouls – Substitutions and Discussion

This is Part 4 of my series on DeMarcus Cousins and how NBA players accrue personal fouls.
Part 3 can be found here.
Part 2 can be found here.
Part 1 can be found here.

I strongly recommend reading parts 2 and 3 before continuing as this series builds on the past.

Substitutions

A natural question that arises from our previous analysis is to question if anything can be done to prevent a player from “tilting.” We now show that making quick substitutions can change how a player accrues fouls and reduce his “tilt.” We define a quick substitution (QS) as a substitution that occurs within 30 seconds of a personal foul. While this definition may capture substitutions that are not a reaction to the player committing a foul, we believe it is adequate for the purposes of this paper. Fouls are then classified as happening before or after the QS. As a result, games without a QS will classify every foul as happening before a hypothetical QS, which may never be observed. Furthermore, for ease of analysis, we only consider the first time a player has a QS, despite the possibility of it happening more than once per game.

Table 4 gives the output for survival analysis that includes an indicator for being before or after a quick substitution in the conditional risk set model for DeMarcus Cousins, Al Horford, Robin Lopez, and all centers pooled. The coefficient on QS for all players examined is negative, indicating that a quick substitution is associated with a lower chance that a player will foul at any time after the substitution. However, for all players examined, it is not always a significant difference. Quick substitutions seem to be associated with a reduction in Al Horford’s foul tendencies, though not significantly and the effect size is smaller for Horford than for Cousins. The players still have significant positive coefficients for later fouls, indicating that while they may still “tilt,” the QS may mitigate some of it.

Focusing on Cousins, Table 5 displays the survival model output for all fouls before a QS and after a QS side-by-side to facilitate comparison. The analysis of fouls before a quick substitution shows a significant increase in the chance that he commits a foul once he has 3 or 4 fouls. However, after the substitution, the coefficients are smaller, indicating that he is no longer as “tilted.” We visualize this change in foul behavior in Figures 3a and 3b which show the survival curves before and after a quick substitution. Cousins’s foul tendencies prior to a QS (Figure 3a) are similar to those seen across a whole game (Figure 2a). However, after a QS (Figure 3b), there is much less of a stark contrast. He does appear to commit his 4th fouls faster than his 3rd, but not as significantly as before the QS.

Al Horford, by contrast does not seem to be significantly affected by a QS, though throughout we have seen that Horford does not seem to “tilt” as much as other centers in general.  Figures 4a and 4b show Horford’s survival curves before and after a quick substitution. While there may be some distinction between the fouls before a QS, it is not as extreme as seen with Cousins, and there is certainly little order after a QS. Al Horford simply does not foul, “tilt,” or get affected by quick substitutions as much as other centers.

Discussion – Further Research

While we focused on only centers for this research, the methods used here can easily be used for all players in the NBA to identify players who “tilt.” In addition to looking at quick substitutions, it would be interesting to note other events which may reduce the effect of a “tilting” player, particularly other stoppages of play like timeouts or breaks in a period. We chose to look at substitutions shortly after a foul in the hopes of best capturing a direct coaching reaction to the foul. A timeout following shortly after a foul may also reflect a direct reaction to the foul and is a clear avenue for further analysis. Furthermore, while we only considered personal fouls in this study, it would be interesting to note how technical fouls play a role in “tilting” players. Technical fouls are especially interesting since they are rarely a part of strategy in the way a normal personal foul can be. Our overall aim is to examine players who are considered by many to be emotional, so how these players accumulate, or their teammates accumulate, technical fouls may have an impact on their foul rates and overall “tilt.” Additionally, we only adjusted for time and score, but there are many other factors that could be included such as the player being guarded (a player may be more likely to “tilt” against players who tend to play more aggressively or are known trash talkers) or if the rate at which the player of interest draws fouls (players may become more upset if they feel they are not receiving foul calls on their behalf). Moreover, while this paper was limited to a select few centers, the methods could easily be applied to all NBA players. Expanding the number of players analyzed would allow for greater understanding of how different players and positions accrue fouls.

Finally, we did not do any causal inference. Any effects we see are just associations. Proper causal inference analysis is a clear area for further research.

Conclusion

In this analysis, we used a survival model for fouls to show that fouling rates are not always independent of the number of fouls a player has accumulated. Emotional players, such as DeMarcus Cousins, often “tilt”, increasing the likelihood of committing another foul as they accrue more fouls. Our analysis also indicates that quickly substituting a player could influence an emotional player’s foul rate, reducing the likelihood of them picking up another foul.

We cannot say for certain the precise reason why a quick substitution has an effect. It could be that taking a player out of the game gives him time to calm down and become level-headed. However, it may also be related to the common strategy of attacking a player that is in “foul trouble”, often defined as approaching 3 fouls by halftime or 6 by the end of the game. Before the player is substituted, he may be in “foul trouble” causing the opposing team to attempt to draw a foul against him. After a QS and the player returns to the game, there is less incentive to attack since he is no longer in “foul trouble” due to the passage of game time. It may well be that a QS is simply a good indicator of keeping that player from being attacked. This hypothesis certainly merits further investigation.

While the scope of this paper is somewhat limited, we hope it will encourage others to explore the process by which players accrue fouls. We believe that further research in this area will reveal new insights into how players can remain effective throughout the game, especially if something as simple as a coach making a quick substitution can have such a significant impact. It may not be easy to stop “tilting” entirely, but there are ways to mitigate the effects.

## NBA Fouls – Survival Analysis

This is Part 3 of my series on DeMarcus Cousins and how NBA players accrue personal fouls.
Part 2 can be found here.
Part 1 can be found here.
I strongly recommend reading at least Part 2 before continuing as I reference it.

Survival Analysis

To provide more statistical rigor, we analyze our players using a conditional risk set model for ordered events. This model, first proposed by Prentice, Williams, and Peterson, models the hazard at each foul event time as a function of the current number of fouls accumulated and time since the last foul. The model is flexible and can include other covariates as needed. For this paper, our covariates include the lead or deficit in the score of the player’s team, game time in minutes, and an interaction between the two. We chose these covariates, as we believe that a closer game can have an impact on a player’s fouling rates. We include actual game time in minutes to reflect how close the game is to ending, and to account for potential overtime periods.

Let $X_{ki}$ and $C_{ki}$ be the foul and censoring time for the kth foul (k=1, 2, …,6) in the ith game and let $Z_{ki}$ be the vector of covariates for the ith game and with respect to the kth foul. We assume $X_{ki}$ and $C_{ki}$ are independent given $Z_{ki}$. We then define $T_{ki}=\min(Z_{ki},C_{ki})$ and let $\beta$ be a vector of unknown regression coefficients.  Under the proportional hazard assumption, the hazard function of the ith game and for the kth foul is:

$\lambda_{k}(t,Z_{ki})=\lambda_{0}\left(t\right)e^{\beta Z_{ki}}$

From Table 2, we can see that the difference in score plays a minimal impact on player fouling rates, even after adjusting for game time for Cousins, Horford, and Lopez. Closer games do not seem to cause more fouls to be committed. However, the total game time that has been played has an impact. Furthermore, as time goes on, it appears that players are less likely to foul. This trend holds true for our three players of interest and all players when pooled together, which is surprising considering that players are more likely to foul later in the game. With this analysis, it shows that players are more likely to foul if they have already fouled as the game goes on. If a player has not fouled already in the game, they are less likely to foul since time plays a negative relationship with likelihood to foul. This trend holds true for all centers we analyzed. These results are line with what we saw in Figure 1. Moreover, these results are similarly likely due to the selection bias we have that precludes us from seeing every foul in every game.

As before, we can limit our analysis to games where the players had at least 5 fouls, and examine analysis of the first four fouls. Table 3 displays the survival model output for Cousins, Horford and Lopez when we use the restricted dataset. For all players, fouls 2, 3, and 4 are committed significantly sooner than the prior foul. To find the hazard ratios associated with each foul, we exponentiate the difference in the coefficients since each coefficient is with respect to the baseline of the 1st foul. For example, when Cousins has 3 fouls he is 405% more likely to commit a foul at any given time than when he only has 2 fouls. Cousins is 303% more likely to commit a foul when he has four fouls compared to when he only has three. Although the hazard ratios increase dramatically with each foul, it is important to keep in mind that the initial probability of fouling at any given moment is low, as the initial foul takes nearly 500 seconds (over 8 minutes) to take place on average for DeMarcus Cousins.

It is interesting to note that the opposite effect happens with game time. As each minute passes in the game, Cousins is only 90% as likely to commit a foul as the previous minute. This trend holds for all players.

From the table, we can see that although all players seem to have this “tilting” behavior, DeMarcus Cousins has a higher likelihood of committing a foul than other players as he accrues fouls. Cousins seems to “tilt” more than others centers in our analysis. Part of this behavior may be explained by teams attacking players who already have many fouls, attempting to get them in foul trouble. However, we believe that no one factor can tell the complete story.