 In today's class, we will be taking a look at diffusion models and with a specific example on how we can model some existing scenarios, how do you estimate parameters and beta diffusion models. We have seen a stock flow representation of the diffusion model where we divide the total population into two potential adopters of the product and the adopters of the product. An adoption rate or the sales rate will move people from potential adopters to adopters, divided by the factors of contact rate as well as probability of buying i. So, the equations are shown. So, you can see AR is c into i into p into a by n. The total population is conserved n is equal to p plus a. So, in this model, the key thing that you understand is as soon as one person buys a product eventually everybody will buy the product. So, the model will run until the potential adopters become 0 and adopters is equal to n. There is nothing stopping them in preventing them from stopping half way. So, here as soon as one person buys a product then p more potential adopters will eventually buy the product. Now, let us see how we can use it for more real examples. Suppose the sales rate that is the units per year for each quarter is given in the following table. The sales record is from 1981 to 1987 quarter 1 to 4 per year and the units per year is given and when we plot it we get a sales rate graph as shown here that is the units per year. So, step one is once you get the data we visualize what we want. So, the data here shows a kind of a bell shaped pattern. It increases peaks at around 1984 third quarter and then it rapidly falls down and kind of set 0 at 1987 fourth quarter. So, that is the data that has been provided to us. Now, you would like to see how we can kind of simulate this kind of behavior using the diffusion models that we have learned. The first is to map it let us just make the observations. Sales data follows a bell shaped pattern. In case it is reasonable to think that the diffusion model might fit this data. So, what we have is sales rate which is nothing but the adoption rate that is obvious. Then what will be the cumulative sales? So, we are going to map it to the diffusion model. The diffusion model we have seen the terms adoption rate. So, in our example that is a sales rate. So, what would be the cumulative sales in a diffusion model? Owners or the adopters the model wages define adopters. So, that will be our cumulative sales. So, if it is a indeed a diffusion model then this adopters a cumulative sale need to represent a S shaped pattern. Now, that the sales rate is a cumulative sales rate we know that sales rate as it increases and then the sales rate is decreasing the underlying graph has to be S shaped correct it is in due to. But we can go ahead and plot it and see also what happens. The first step is we are going to do is we have the sales data that is only data we have based on that let us try to figure out what is the cumulative sales data plot it and see what is the curve. Then we will figure out how to estimate the parameters C i initial value of potential adopters, initial value of adopters, the total population N. So, let us do that. For that I urge you to download the excel file and open it the data whatever we saw is given. So, column B is given to you and based on column B if you scroll down the graph is also plotted which is nothing but the sales rate. We have plotted those two values right here nothing else to do just observe what is there in the field. So, first thing we are doing is the actual sales data gives it which year and which quarter and things like that whatever computation simulation purposes we can reset the scale to 0. So, the time starts at 0 and then since it is every quarter we can just make it 0.25, 0.5, 0.751 and so on and that is what the reset time column is put. Though we have data until only to 1987.4 we just extend it for few more data points which is fine. So, all we have done here is reset the time starting at 0. In the sense this is a tricky example the units of sales rate is units per year. There is at every quarter I am selling what is the quantity per year. But we want what we want is what is actual quantity sold in that quarter. So, to compute that first we divide sales that is units sold in that quarter as sorry should be 2 by 4 is not it the equation you see will be incorrect just change it to it should be 2 divided by 4. See what happened is kind of it is like you are accounting for that in a simulation time step or the level of accuracy every quarter they reporting what is the sales rate per year. But what do you want is actual quantity that is sold in that quarter. So, since each year has 4 quarters we are dividing the sales by 4. So, let us just divide it. So, it is B 2 by 4 and you just drag the column all the way to the end. So, sales is nothing but units sold that quarter is the total units sold divided by 4 that is the quantity sold in that quarter. The cumulative sales the first value is 0 the second value is the formula is given nothing but current cumulative sales plus whatever has been sold in that quarter. So, the second row you can drag it to the end cumulative sales column is 7 9 0 0. So, all of you got this values. So, all the steps that I am telling you right now is also written on the right side of the sheet step 1 rescale time step 2 get the quarter wise sales column E step 3 calculate cumulative sales column F. So, now just stop there up to column F it is sufficient. So, if you scroll down after doing column F you will see right side graph I mean the formulas have been prefilled for you as soon as put your numbers the graph will show this figure. So, this right side graph shows the cumulative sales data or the total number of order of the adopters over time which is a classical S shape. So, it looks like we can fit a diffusion model to see how well we can fit it. Just hold on to that so that you understand what you are doing there are so many spreadsheets. Now, we need to pretty much estimate these parameters C I P naught A naught and N from the data that is given. To estimate these parameters we need to look at bit of maths let us go ahead and do that. So, we are going to go to the equations diffusion model analytical equation it is going to be a pretty lengthy derivative. So, you can get started we have seen that the adoption rate AR is equal to C into I into P into A by N. So, this is what we had seen from the equation. So, whatever is the sales rate or the adoption rate is the same rate at which actual adopters change. So, this is nothing but the change in the number of adopters A. So, you want a smaller equation what I am plotting here is this model the simplicity sake I am just going to do it C into I is this. So, this is the model and underlying equation is shown. So, the change in A same as C into I into P into A by N we know that P plus A is equal to N or P is equal to N minus A. So, we can rewrite our D A by D T C into I into A into N minus A by N. So, remember what we did to solve for when you had exponential growth or asymptotic growth decide to solve the equations and to try to figure out what is analytical solution for it. We are going to do a very similar thing right now. So, you would like to solve this. So, this let us just denote it as equation 1 solving let us say D A by N into D A by A into N minus A is equal to C into I into D T integrating it on both sides. Let us put it P naught into T and we are going to write N minus A equal to P naught T C into I into D T which then gives me this continuing the last equation and this integrating it. So, it gives us log of A T minus log of N minus A T minus log of A naught minus log of N minus A naught equal to C into I into T. So, T naught is a time 0. So, the last term disappears. So, this can be pre-written as log of N minus A naught A T by N minus A T minus log of A naught by N minus A naught equal to C into I into T or log of A T by P T minus log of A naught by P naught equal to C into I into T. Let us call it as equation 2. Then I can play with this main equation as per my convenience. So, this can be further solved or to give us another expression as A T by N minus A T is equal to E power C I T into A naught by N minus A naught. Let us call it equation 3. We do not need to go through this to get it here. Just from here we can get this expression. So, we can get it from here. We can compute the expression for A T. So, what you are trying to do is trying to come and solve for A T. This is a intermediate step. We can view it in this form or we can expand further. N minus A T is nothing but P T. I just want to reinforce it. That is why this is a equivalent either a represent as P T or N minus A T. I can remove logarithm by raising to the power E which is what I did in equation number 3. We can actually solve for some of this equation. We can directly solve for A T to get A T is equal to N divided by 1 plus N by A naught minus 1 into E power minus C I T. Let us call it equation number 4. So, from 3 I have A T and N minus A T. You can take N minus A T. The other side multiply then take it over the other side, take a common factor of A T and again go back divide it and if you solve you will get this expression A T is equal to N by 1 plus N by A naught minus 1 into E power minus C into T by into C into I into T. First T is the time. So, in this equation if you see initial value of adapters is required. That is the initial value of adapters 0 there is no diffusion model happening. So, there has to be initial value of adapters. As soon as the initial value of adapters is going to be there this equation will come into effect. C is known, I is known, N is known, A naught is known. So, all the parameters are known. The only way I think the changes here is time. So, as we progress with time we can compute value of adoption rate or the not adoption rate. Adopters or in our example it is the cumulative sales. The reason these equations we already come to so much we can actually ask some very basic questions on you know when net adoption rate is maximum. We have taken it as from 1 and option rate is already given as C into I into A into N minus A by N which is A minus C into I into A square by N taking first differential and set to 0. We can get C I minus 2 into C into I into A by N equal to 0 which gives us A is equal to N by 2. So, when A is equal to N by 2 it is going to reach the maximum. You can take you can take second differential if you do second differential you will find it is a negative. So, that means it is a maximum point. So, but when does this occur? At what time will this occur? At what time will this occur? How will I find it? At what time will it occur? To figure this out substitute A t is equal to N by 2 in your equation what is it? In your equation 4 and solve for t. So, substitute A t is equal to N by 2 in equation 4 and solve for it. This is equation 4, this is equation 4. So, substitute A t is equal to N by 2 solve it for t and you will get t is equal to 1 by C into I to logarithm of t naught by A naught. So, this is the time at which it is going to hit the maximum.