# Logistic regression: how to choose negative examples for training set

I want to predict the probability of rain based on the measured weather parameters like temperature, humidity, etc. Let's not get into why I want to do that despite the fact that weather websites already publish the probability of rain.

I want to implement this using logistic regression. I have weather data for 2012, every 15 minutes for each day. I also know the date and time during which it rained (Yes/No label). Feature vector comprises a concatenation of weather parameters (temperature, atmospheric pressure, wind speed, humidity) for t0, t0-15 min and t0-30m minutes if it rained at t0. Thus, I can create my supervised learning dataset with positive examples.

However, I am confused about how many negative examples I should choose? Negative feature vector would be derived in a similar fashion but when t0 does not have rain.

Here are my questions:

1. Should I choose equal number of positive and negative examples? Does my learning depend on how many examples of each category I include in my training set?

2. If learning does depend upon the number of positive and negative examples, how many negative examples should I choose?

I know there are many other ways to doing this prediction but please try to answer the questions regarding logistic regression only. I am not looking for other approaches.

• This is a bad question because logistic regression shouldn't be used here - time series analysis should be used. Nevertheless if you insist on logistic regression, the proportion of negative examples is not all that critical. Jan 12, 2013 at 22:20
• Peter, could you expand on why logistic regression is a bad option? It seems like a sensible approach to me... Jan 12, 2013 at 22:33
• @MarcShivers It is a bad tool 1) because the data will not be independent. 2) The best predictor of whether it is raining at 12:15 in NYC is whether it was raining at 12:00. Jan 12, 2013 at 23:05
• If you are purely interested in the conditional mean of a binary indicator given a set of predictors then I agree with those that say ordinary logistic regression is a viable option. Even when there is temporal autocorrelation, the likelihood that assumes independence is still a valid estimating equation (in the sense that it produces consistent estimators), sometimes call a pseudo or 'composite' likelihood. If p-values are needed then the standard errors are different (see e.g. Lindsey, 1988) but it sounds like the goal here is prediction so that wouldn't even come up. Jan 13, 2013 at 5:44
• Also, it seems fairly likely that much of temporal autocorrelation in rainfall would also be seen in the temporally varying predictor values, suggesting that there could be relatively little temporal autocorrelation in the conditional distribution of rainfall given the predictors (indeed, this has been my experience with data like this). This would also mean that the composite likelihood estimator wouldn't be very different from what the maximum likelihood estimator would be under the model that did properly characterize the temporal dependence. Jan 13, 2013 at 5:45