Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

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.

share|improve this question
1  
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. –  Peter Flom Jan 12 '13 at 22:20
2  
Peter, could you expand on why logistic regression is a bad option? It seems like a sensible approach to me... –  Marc Shivers Jan 12 '13 at 22:33
2  
@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. –  Peter Flom Jan 12 '13 at 23:05
1  
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. –  Macro Jan 13 '13 at 5:44
1  
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. –  Macro Jan 13 '13 at 5:45

1 Answer 1

up vote 1 down vote accepted

The number of negative training cases does matter, in just the same way that re-weighting your existing training set (as in boosting) will produce a different model, one that does better on the training cases whose weights have increased, at the expense of accuracy on the set of training cases whose weights have decreased.

For your example, I would suggest using all the negative examples you can find (it's rarely a good idea to throw away data), but re-weight your examples so that positive and negative examples each have 50% total weight (or whatever relative weights make sense in your particular use case).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.