Measuring effects of categorical factors on binomial outcome with many groups

I'd like to do some analysis of shooting efficiency in basketball when a team is leading (AHEAD) or trailing (BEHIND) by less than 8 points and whether they are HOME or AWAY. Here are a few examples of the data:

Ray Allen   HOME    BEHIND  59.4%   134
Ray Allen   HOME    AHEAD   57.13%  132
Ray Allen   AWAY    BEHIND  49.1%   166
Ray Allen   AWAY    AHEAD   48.03%  126
Jason Terry AWAY    BEHIND  56.6%   242
Jason Terry HOME    BEHIND  52.0%   193
Jason Terry AWAY    AHEAD   50.05%  198
Jason Terry HOME    AHEAD   48.73%  207
Jamal Crawford  AWAY    AHEAD   51.65%  82
Jamal Crawford  HOME    AHEAD   42.50%  178
Jamal Crawford  AWAY    BEHIND  35.5%   129
Jamal Crawford  HOME    BEHIND  33.4%   118
Kevin Durant    HOME    BEHIND  48.6%   222
Kevin Durant    HOME    AHEAD   44.05%  248
Kevin Durant    AWAY    BEHIND  41.4%   325
Kevin Durant    AWAY    AHEAD   40.07%  213


The 4th column is the FG% (i.e. proportion of made shots) and the 5th column is the number of shots (i.e. trials).

You can see even with these 4 players (and there are roughly 200 in the data set), that there is variation of the mean FG% between players, and for each player, there is not a consistent pattern in whether they are "better" at HOME or AWAY or AHEAD or BEHIND. So there's a lot of variance between groups and within groups as far as I can tell.

I thought about using lmer, but I wasn't sure how to do that for this problem, because if I just use the FG% as the outcome, I lose the information about how many shots were taken. Eventually, I'd like to put this into BUGS, but I thought there might be a more straightforward way for now, because I'm not quite ready for that yet.

I should just add that what I'm really after is a way to determine whether a player is "really" better under one of these conditions, or are the apparent differences just due to noise/variation from small sample sizes.

-
This question seems to call for a binomial model. E.g., putting the data in a data.frame with variables Name, Home, Ahead, Percent, and N, to get started (with a simple linear model, no interactions) you would account for the number of shot attempts by executing data$K <- floor(data$Percent * data$N / 100 + 0.5); data$L <- data$N - data$K; fit <- glm(cbind(K,L) ~ Name + Home + Ahead, data=data, family=binomial()); summary(fit). Is there some reason you haven't done this? – whuber Aug 30 '12 at 15:35
@whuber, I didn't know you could put the response in that form. Let me see if this works. I would also like to have interaction terms. – thecity2 Aug 30 '12 at 15:52
Put interactions in in the usual way. But start out without them to get a baseline. – whuber Aug 30 '12 at 15:59
Well, I just ran this model w/o interactions, and it came back with only 3 players having a p-val<0.05. This doesn't really help me. – thecity2 Aug 30 '12 at 16:05
How not, Evan? That sounds like a useful result to me. It's telling you there are few detectable differences among players after you factor in the other variables. However, such a result might not be credible in light of obvious differences in basketball performance. In fact, I found significant player differences even in the small subset you posted. It sounds like you should experiment on a smaller dataset and make sure you're applying and interpreting the procedures correctly by exploring the data extensively and producing diagnostics for the procedures. – whuber Aug 30 '12 at 16:09

To circumvent the 200-players problem, you could fit whichever model you choose (logit, binomial...), without the player variable as such, but inside a discrete mixture framework. You'll have to process the data right (for instance you want to make sure that all stats of a single player are taken together, and you'll have to determine the optimal number of clusters in the mixture) but the fitted mixture model will group players into clusters, which should reflect differences in performance, or rather differences in how the conditions (home and ahead) affect performance. This is very easy and fast with R package flexmix.

Building on the same idea, you could also just run an unsupervized clustering algo (k-means, gaussian mixture, self-organizing map) on the data transformed as such: each player has one vector of 8 values $(rate_{home,lead}, N_{home, lead}, rate_{home, behind}, N_{home, behind}, ...)$. In that case each player belongs to a cluster of players with similar characteristics, and you can check whether the differences between clusters are significant.

-

I think you could fit a logistic regression model using player, ahead/behind, home/away, percentage success and number of shots taken under those conditions as possible covariates. Then difficulty with player is that you have over 200. I think that success percentage under specific conditions could serve as a substitute for player since the player and his past performance under the conditions should be highly related to the outcome. To predict for individual players you just use that player's other covariates.

-
Does that work even for factors with hundreds of levels like the player factor here? Also, the 5th column (number of shots) is really just acting as the number of trials. It's not something I would want to fit, but I think it should be taken into account for the sample size that the FG% is based on. Does that make sense? – thecity2 Aug 30 '12 at 15:25
How many players do you have data on? – Michael Chernick Aug 30 '12 at 15:28
The player and his field goal percentages should be highly correlated. It may be just as good to drop player and just use the remaining 4 covariates. – Michael Chernick Aug 30 '12 at 15:30
@Michael, clearly different players have different "baselines" e.g. Shaq would have a much higher baseline than Jason Kidd in terms of FG %. Averaging over those (which is effectively what happens when you only use the 4 remaining variables) may be hard to interpret, wouldn't you say? Why not use a random intercept for each player? – Macro Aug 30 '12 at 15:32
Inference is definitely what I'm after here. Anyone can calculate means, and that's usually all that is done. Say, Player A shoots 51% and Player B shoots 49%, you will always see a sports commentator saying Player A > Player B. But given the amount of variation and noise, who really knows if Player A > Player B next year? That's what I want to know. What can inferences/predictions can I really make about these data? – thecity2 Aug 30 '12 at 16:08