# Pooling data for logistic regression

I want to run a logistic regression on greyhound races. For each race I have a dummy variable (y) that takes value one when the dog wins and zero otherwise.

Unfortunately the number of hounds in each race can vary as some are withdrawn for whatever reason. Currently I pool the data by vertically concatenating to create one huge column or race results and one large column for each independent variable.

1. Is this the correct way to pool the data for this type of problem?
2. Are there any issues with the fact that the data originally came from separate races often with different numbers of dogs running?
• I don't think a standard logistic regression model is going to be a good choice for this. Commented Apr 21, 2017 at 15:45
• Can you elaborate on why you don't think it's a good choice and/or suggest an alternative that would be better?
– Baz
Commented Apr 21, 2017 at 16:33
• Largely it comes down to the data not being independent. Whether a dog wins may have nothing to do with the dog. Commented Apr 21, 2017 at 16:38
• OK could I improve matters by including a dummy variable that indicated which dog belongs to which race?
– Baz
Commented Apr 21, 2017 at 17:00

This is all wrong-headed. First, note that there is no meaningful ontological status of 'winner'.

How to determine the quality of something when all you have is a set of results from head-to-head comparisons (e.g., sports teams based on the results of games in a season) is a very tricky question. In the simplest case, a Bradley-Terry model could be used to predict the probability that unit $$i$$ will beat unit $$j$$. Bayesian network analyses can also be used.

A Bradley-Terry model wouldn't quite work in your case, but your case is actually a lot simpler: You presumably already have data directly on the quality of each dog as a racing dog. Specifically, you should have each dog's race times. A better race dog is just a faster dog. If you want to determine what variables are related the ability of a race dog, you need to model racing times. If you want to rank existing dogs, you could fit a Bayesian model, or a mixed effects model and look at the BLUPs. If you wanted to estimated probabilities that dog A will win a given race (e.g., for book-making purposes), you could take fitted race time distributions for each dog in the race and simulate to generate the proportion of the runs that dog A has the lowest time.

Update:
As I understand your situation now from your comment, I gather you want to determine if odds that were given in the past (by whatever method) were reasonable given what you now know about whether a dog actually won its race. This is a different situation than I thought you were asking about in the body of the question. Here you aren't trying to build a model of any type, you are only trying to assess the calibration of the starting odds.

First, note that the odds that a bookmaker (e.g., the track) will offer / list are not the odds that they think are fair. They have to add a cut in order to make a living (cf., Odds made simple). So you need to remove that to get to the actual odds that were believed to be fair.

Once you have those numbers, the simplest check is that they should imply a 100% chance of one of the listed dogs winning. For example, if there were only two dogs and one had an estimated odds of winning of 1 to 3, the other dog's odds should be 3 to 1; if it were 10 to 1, something doesn't add up.

To answer your specific question, if the odds add up, you needn't take into account the number of dogs in a race, because the odds being offered are supposed to account for that, and if they don't, that's something you want to discover.

At this point, you could assess the discriminative performance of the odds by computing Somer's D, which is informationally equivalent to the area under the receiver operating characteristic curve (AUC).

Lastly, you could convert the fair odds into the log odds of winning and use them as a single predictive variable in a logistic regression model. The intercept and slope of that model should be $$0$$ and $$1$$, if the odds are not biased.

• @Baz, BT won't work unless you only have 2 dogs in each race. I know diddly-squat about dog racing, but I assume that isn't true. BT is also unnecessary, as I discuss. "Which method" depends on your goals. Are you trying to understand the properties associated w/ faster dogs, are you trying to rank the existing dogs, or are you trying to make books? (A 1st step for any of these is to model race times.) Commented Apr 21, 2017 at 18:18
• I am primarily trying to see if the starting odds are efficient, that is do they represent they true empirical odds of the dog winning. To compare I do the logistic regression described above on a baseline model i.e. just a constant and observe the log likelihood. I then do it again with the starting odds. The LL improves quite substantially which I took to mean that the starting odds,do have predictive power as to the winner.
– Baz
Commented Apr 21, 2017 at 18:32
• @Baz, hmmm, I'm now thinking that you are trying to assess the quality of the starting odds in past races given the knowledge of what actually ended up happening. Is that right? If so, your method might be acceptable. That is a pretty limited context. If you tried to use it in the future, your method might happen to work, but I don't think it would actually be a good method. Commented Apr 21, 2017 at 19:56
• @Baz, I have no idea what any of that means--most likely, nothing. 1st, if you add the probabilities from the bookmaker they need to sum to <1 to favor him. 2nd, you should use ln(odds) (not log(.1/probs)) b/c that's what logistic regression works w/--it is linear on the log odds scale (see: here, & here). Commented Apr 22, 2017 at 17:15
• @Baz, I don't know what you're talking about re: "probability is simply the inverse of the decimal odds". Odds & probabilities don't work that way (see here). At any rate, to assess the odds for bias, run a logistic regression using log(odds) as the only predictor variable. The slope should be 1 w/ intercept 0. Commented Apr 22, 2017 at 17:38

That is fine way to structure the data, yes. Your trepidation comes from your data taking on a multilevel structure: Dogs are nested within races. You can test if you "need" to account for this multilevel structure by doing multilevel modeling. You can specify a model with a random intercept at the race level (Level 2) and one without this random intercept. Then you can compare these two models to see if the addition of the random intercept accounts for a significant proportion of the variance in your outcome.

The lme4 package in R is my go-to for running multilevel models, and it handles logistic regression by using the glmer() function along with the family= argument, specifying binomial.

1. I don't quite understand what you mean by "pool" here. What you described will certainly get your data in a format that makes it easy to work with in R or Python (although putting it in a data.frame object is cleaner imo).

2. The fact that different numbers of dogs racing probably won't be a problem. What will be a problem is the dependency each dog has on its competitors. Dogs don't run a race in a vacuum. Each dog affects each other dogs' probabilities of winning. Your model will tell you what dog-characteristics make up a winning dog, but will not account for dependency... which will probably seriously confound your results.

• I am primarily interested in the characteristics that make up a winning dog. Can you elaborate what you mean by confound my results? Can I do anything in the logistic regression framework to fix this perhaps by adding a dummy variable that indicates which race each dog is in?
– Baz
Commented Apr 21, 2017 at 16:32
• I am primarily interested in the characteristics that make up a winning dog. Can you elaborate what you mean by confound my results? If I understand you correctly I can use the pooled data to get a qualitative feel that one regressor is better than another, but the results won't be completely accurate because of the dependency issue. Is there anything I can do ideally in the logistic regression framework to fix this, perhaps by adding a dummy variable that indicates which race each dog is in?
– Baz
Commented Apr 21, 2017 at 16:41
• I guess the other obvious alternative is to carry out each regression individually, would this solve the dependency issue? I could then add up all the log-likelihoods and compare those for different regressors would it be legitimate to compare these combined log-likelihoods like this? Would this be a better way to formulate the problem?
– Baz
Commented Apr 21, 2017 at 16:50
• By "confounding your results" I mean that a winning dog only needs to be faster than its competitors. A winning dog in one race may have only placed 4th in another race. Your suggestion of doing separate regressions is interesting, but not using log-likelihoods like you suggest. You could perform individual race regressions and average the coefficient vector instead. You might get a good result, but I'm not sure there's good theory to back this up. I guess that would sort of resemble bagging? But the data split wouldn't be random... Commented Apr 21, 2017 at 16:58
• Given that I am primarily interested in whether a given regressor has explanatory power would any of the work arounds I suggest above work? Or should I be looking for a different method? Is so any suggestions as to which one?
– Baz
Commented Apr 21, 2017 at 17:02