# How to predict the probability of an event?

I have a dataset where a set of people donated for charity along with the dates of the donation. I have to find the probability of each donor donating in the next three months.

Data is available from August 2014 - February 2016. I have to predict the probability of each person donating for March-June 2016.

Any help would be appreciated?

Below is a snapshot of the data

id  date    amount
1   13-08-14    2485
1   21-11-14    2105
1   17-09-15    1359
2   13-08-14    2542
2   20-04-15    1276
2   12-10-15    2694
3   20-11-14    3556
4   28-07-15    3383
5   13-08-14    1698
5   11-12-14    1725
5   09-06-15    1376
5   17-09-15    3230


Regards

• More information would be helpful. What does the raw dataset look like? Is it only "person_id","date","amount"? Do you have any other information on the donations? How many times, on average does each person donate and how many such people you have in your dataset? Some high level information along these lines will help someone answer your question better. – Nitesh Apr 5 '16 at 0:11
• I have edited the question with a snippet of the data, this is all the data that is available – Raj Apr 5 '16 at 0:19
• The dataset is very small to do any meaningful analysis on it. Its hard to do more than SQL like queries on it for now. Is your goal to create something that is on going and there is a chance that you get more data like this in the future? – Nitesh Apr 5 '16 at 17:38
• @Nitesh: I have a sizeable number of records, about 5K. What i dont have is the any other useful data columns other than the donation date and amount. – Raj Apr 5 '16 at 17:55
• Have you done some exploratory plots or analysis? Do people seem to donate in clusters - in which case the most probable donors in the next period will be those who just donated - or are donations uniform random in time, in which case it could be anyone. Make some plots, do some basic summary statistics. Do some people make one big donation and then none, and others make several small donations? Would "total donated so far" be a good predictor of "likely to donate again"? etc etc. You've just presented your data and none of your thoughts. Please edit the Q and add them. We can't think for you. – Spacedman Apr 6 '16 at 7:35

Please double-check if there's the only data you have got, because all you have is a single predictor date.

If this is indeed your only data source, then you only have a single predictor, and your independent variable is continuous. Now, you should plot date vs amount and fit a single linear regression. Does the fitting look good? Only you can tell because we don't have the full data-set.

If it's not a good fit, look at the plot and ask yourself does this look like a curve? If so, you might want to fit a spline curve or something like that.

You should also check the autocorrelation. This makes sense because your data look like a time series (you'll need to check it yourself). If this is the case, you might want to consider MA and ARCH model.

It's not possible for us to give you accurate advice because we don't know your data.

• Will the ARCH model predict the amount or the provide the probability of a person donating? – Raj Apr 5 '16 at 1:56
• It doesn't look anything like anything presented as a "time series" to me. "Time series" are invariably data observed at regular (monthly, daily) time intervals, and unless you pad this data set out with zeroes for every non-donation day (at which point you have a large number of binary time series, one for each donor), you don't have a time series. – Spacedman Apr 6 '16 at 15:49

You can use Binary Logistic Regression for this analysis.

Prior to using Binary Logit, you'd have to spend some time preparing the data for this analysis.

You can create several RFM types of features from this data set. Examples: Number of donations, time between donations, time since the most recent donation, time since the first donation, average donation amount, the amount of first donation, the most recent donation amount, etc. (I can provide more examples, if needed.)

Since your task is to predict the probability of donation during a four-month timeframe (Mar-Jun 2016), you can create those features (leading indicators) for each donor as of the end of October 2015. All leading indicators would be created based off of timeframes prior to that cut-off point. Your observation window is from Nov-2015 to Feb-2016. This is where your event flag (dependent variable) should come from: 1 if a donor donated (again) during the observation window, and 0 otherwise.

In order to make this model generalizable, I'd recommend pulling several such cross-sections of your data (in addition to the October 2015 slice explained above,)

You could try using the markov model! (An illustration of which can be found here)

Also, you could detect patterns in the dataset by plotting it and then figure out which algorithm to use based on what is the degree of correlation and the nature of the plot.

Also, what is the number of users you have? You could group together data of each user and run the algorithm for the user that is being asked for.

Regression is the way to go if you want to know if a user will donate or not, to find the probability, try markov!

I think you could use time series modeling algorithm as @Student_T said. Also you can make window time to find relation between new donate and previous donate and you can use amount, may be people with high payment and low payment have different behavior. first of all you should change your data in a way that fill gaps. I mean you should add data about month that a person have not any payment. after that you should make a table like this: person_id / month(or day or week or 3month) / count of payment / count of payment last month/ sum of amount that paid last month/ Is paid last month?/

then you should find whether your filed is useful and independent or not. and try to add other filed. and then build your model.

good luck.

First you need to find in what kind of distribution is your data: linear, exponential, normal ... Etc. After that you need to find the area size under the equation in which your event will occur. It's all come down to what kind of distribution you are on.

• I don't think the distribution of the event is the key here. The event is binary (donation or no donation), which in and of itself point towards binary logistic regression model. – Vishal Apr 7 '16 at 17:51