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.
Thanks for any advice.
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