# Does Kobe Bryant shoot better from far away?

I am studying how well Kobe Bryant shoots and to do so I have run a logistic regression. The variable shot_made_flag is 0 if missed and 1 if he scored. And I am running the regression against distance from the basket.

  logitshots <- glm(df$shot_made_flag ~ df$shot_distance, family = binomial(link="logit"))
Call:  glm(formula = df$shot_made_flag ~ df$shot_distance, family = binomial(link = "logit"))

Coefficients:
(Intercept)  df$shot_distance 0.3681 -0.0441 Degrees of Freedom: 25696 Total (i.e. Null); 25695 Residual Null Deviance: 35330 Residual Deviance: 34290 AIC: 34300  As you see the coefficient of distance is negative. So what I do next is to compute the probability of scoring if Bryant is 1 meter farther. To do so I have done it this way, but I get a positive effect, so I am not sure about it. (exp(coef(logitshots))/(1+exp(coef(logitshots)))) (Intercept) df$shot_distance
0.5909933        0.4889768


So how would you interpret this? every 1 meter means a 48% more chances of scoring (Lol)? Is this approach the right one? I guess that Kobe scoring from 25 meters is very unlikely (maybe modelling by a quadratic function?)

I'd really appreciate any interesting insight and help! :)

• The relationship is almost surely nonlinear and probably not even one that is simple to approximate with a polynomial. I suggest a spline model., – Peter Flom Jun 3 '16 at 11:37

## 1 Answer

One of your questions is whether the model is appropriate for the data. Without access to the data this is hard to say. A gam() instead of a glm() as suggested by @PeterFlom in the comments is one natural alternative, though.

As for the interpretation I always recommend to compute some hands-on cases to get a feeling what the non-linear logit curve means. If shot_distance is indeed in meters one could consider a range from 0 to 10 meters and then compute the linear predictor (on the logit scale) and then transform it to probabilities:

sdist <- 0:10
linpr <- 0.3681 - 0.0441 * sdist
prob  <- exp(linpr) / (1 + exp(linpr))
prob
##  0.5909998 0.5802988 0.5695217 0.5586784 0.5477788 0.5368332 0.5258519
##  0.5148456 0.5038249 0.4928005 0.4817831
plot(prob ~ sdist, type = "l") So you can see that the scoring probability decreases from about 60% to about 50% in this range, i.e., roughly one percentage point per meter. It's been some time that I've been following NBA basketball but this does not seem to be a very plausible model...

Nevertheless, if we accept the model and just want to interpret the coefficients we could check either the relative change in the odds per meter which are constant:

exp(-0.0441)
##  0.9568583
odds <- prob/(1 - prob)
odds[-1]/odds[-11]
##  0.9568583 0.9568583 0.9568583 0.9568583 0.9568583 0.9568583 0.9568583
##  0.9568583 0.9568583 0.9568583


Thus, the odds of scoring decrease by about 4.3% per meter.

The absolute changes in the probabilities are not constant due to the nonlinear logit link. But so close around 50% they are approximately constant and in this case correspond to about 1 percentage point. For example, in comparison to the slope at a distance of 4 meters:

-0.0441 * dlogis(0.3681 - 0.0441 * 4)
##  -0.01092433
diff(prob)
##  -0.01070102 -0.01077706 -0.01084334 -0.01089960 -0.01094562 -0.01098123
##  -0.01100629 -0.01102071 -0.01102443 -0.01101743