Consumer Predicted Probability Function I have the following data for the last year for several thousand clients: 


*

*Client ID

*Last Interaction Date with Business

*Last Buy Date

*No of items bought 

*Total value spend in $


I want to create a function that can predict the probability that a client will buy again. In other words; I want to get a function, where I can enter a client's last interaction date, last bid date, number of items bought and total value spend and get the probability that they will buy again. 


*

*What should be the first step? (Distribution? CDF?)

*Which model would be the best one to use? 

*Do I need more data? 

*Can I use Excel or R? 

 A: *

*The first step would be to add to your rows $(X_1,X_2,X_3,X_4,X_5)$ the information $Y$ whether there the client with ID $X_1$ came also later than on interaction date $X_2$. This means an inspection of the table.

*Personally, I would use the decomposition of the model in the following way:
$$
f(Y|X_1,X_2,X_3,X_4,X_5)=f(Y|X_2,X_3,X_4,X_5)f(X_2,X_3,X_4,X_5|X_1)
$$
where $f(Y|X_2,X_3,X_4,X_5)$ would be a model of new purchase for general atributes and $f(X_2,X_3,X_4,X_5|X_1)$ would be a model how the general atributes are distributed for the specific customer ID.

*To construct $f(Y|X_2,X_3,X_4,X_5)$, you can use logistic regression, for instance, eventually any other classification technique. For logistic regression in R, see this.

*For the construction of $f(X_2,X_3,X_4,X_5|X_1)$, i.e. typical behavior of the specific customer, I would use Gaussian mixtures that can capture wide class of distribution (for Gaussian mixtures R, see this). Practically, the data for specific ID would be queried. Having that model, the prediction that the buyer will come again is like this
$$
f(Y|X_1) = \iiint f(Y|X_2,X_3,X_4,X_5)f(X_2,X_3,X_4,X_5|X_1)dX_2dX_3dX_4dX_5
$$
the integration could be approximated by some Monte-Carlo method, i.e. sampling from $f(X_2,X_3,X_4,X_5|X_1)$ for given $X_1$ samples $(X_2^{k},X_3^{k},X_4^{k},X_5^{k})$ where $k=1,\dots,K$ and then summing
$$
f(Y|X_1) = \frac{1}{K}\sum_{k=1}^K f(Y|X_2^{k},X_3^{k},X_4^{k}, X_5^{k})
$$
Practically, this would mean substitution of the samples into the logistic model and calculation average for given customer ID. This is the number you are looking for.

*Instead of constructing $f(X_2,X_3,X_4,X_5|X_1)$ and sampling, you can use simply the measurements you have for the given customer ID and substitute them into the sum above. This approach will be more reasonable when you do not have too many data for given customer ID.

