Sunday, June 12, 2011

Monte Carlo #2 | The Practical Implementation of The Model

Let's continue the topic. Today I am going to show an example of the practical implementation of the model, which was described in the previous post. The calculations are made in Maple. If you are not familiar with this framework I highly recommend you to read the book of J.S. Dagpunar 'Simulation and Monte Carlo'. You can also download samples here.

Mathematicians say that the simulation is rather time consuming in Maple. It's not our case, because simulation in finance is not as compicated as in physics or neurobiology. We're going to generate only 10 000 scenarious for 48 periods, that's not so much. Before going to the algorythm I'd like to answer two nice questions I was asked after the publicaation of the previous post:

> The definition of the conversion among the practicioners is a bit different from one you operate with in your model. What is the conversion rate in your opinion?

Thanks a lot for your comment. I have not noticed that traditionally conversion is understood as the relation of new customers and unique visitors. I prefer to use conversion of unique visitors into customers in order to show the share of all customers from the total number of unique visitors.

> You predict unique visitors and the conversion of them into customers. Why don't you predict customers instead of all that staff?

This question is quiet controversal. If we deal with the model like the one, which was described in the previous post, we can say that the answer is evident. Predicting the future flow of customers is a more rational approach, but there is an idea I want to share with you. According to my research, I've found out that there is correlation between the number of unique visitors and the conversion rate. The linear regression model was not significant. And I decided that it would be more correct to analize the functional dependance between the flow of unique visitors and different contingency factors. The stochastic nature of conversion is my assumption, which was prooved by my observations. I see volatility of conversion as a sort of noise, which does'nt allow us to make more accurate predictions. That's why I see it rational to exclude that noise at the very beginning, before some sophisticated models of prediction are built.

Let's go to the implementation of the model, described in the previous post.

Firstly, we begin to generate scenarious for the flow of future visors. We define the parameters from the equation (3) in the previous post. S[0] is the initial point, r is the growth rate, sigma is the level of volatility, T - the number of periods (in months). M - the number of scenarious. N is the number of 'dots', which makes the graph more detailed, but is not needed thats why we define it the same as T.
restart;
with(Statistics):
Vis[0]:= 5000: rvis:= 0.15: sigmavis:= 0.05: N:= 48: M:= 10000: T:= 48: h := T/N: 
randomize():
U := RandomVariable(Normal(0, 1)):
W := exp((rvis-(1/2)*sigmavis^2)*h+sigmavis*sqrt(h)*U):
Visitors := [seq(Sample(W, N), i = 1 .. M)]:
for i to M do Visitors[i][1] := Vis[0] end do:
Visitors := map(CumulativeProduct, Visitors):
Xrng := [seq(h*i, i = 1 .. N)]:

Then we generate scenarious for the conversion. The parameters are relatively the same, but with different values. There is a very important thing
I want you to notice. The convertion rate is taken as a mean from all its' scenarious in each particular period.
Conv[0]:= 0.07: rconv:= 0.0001: sigmaconv:= 0.05: N:= 48: M:= 1000: T:= 48: h := T/N:
randomize():
U := RandomVariable(Normal(0, 1)):
W := exp((rconv-(1/2)*sigmaconv^2)*h+sigmaconv*sqrt(h)*U):
SPr := [seq(Sample(W, N), i = 1 .. M)]:
for i to M do SPr[i][1] := Conv[0] end do:
SPr := map(CumulativeProduct, SPr):
Xrng := [seq(h*i, i = 1 .. N)]:
SD := 50:
for k to N do
Conv[k]:=Mean([seq(SPr[i][k],i=1..M)])
end do:

After that we try to predict the dynamics of the changing portfolio structure.
Cast[0]:= 0.15: rind:= 0.0045: sigmaind:= 0.000001: N:= 48: M:= 1000: T:= 48: h := T/N:
randomize():
U := RandomVariable(Normal(0, 1)):
W := exp((rind-(1/2)*sigmaind^2)*h+sigmaind*sqrt(h)*U):
SPr := [seq(Sample(W, N), i = 1 .. M)]:
for i to M do SPr[i][1] := Ind[0] end do:
SPr := map(CumulativeProduct, SPr):
Xrng := [seq(h*i, i = 1 .. N)]:
for k to N do
AvPers[k]:=Mean([seq(SPr[i][k],i=1..M)]):
AvSelf[k]:=1-AvPers[k]:
end do:
To predict sales revenue we'll need ARPU (average revenue per user) in each product category:
arpuSelf:=500:
arpuPers:=1500:
Cost of revenue is considered to be 85% of an average revenue per customer.
cogsSelf:=0.85*arpuSelf:
cogsPers:=arpuPers*0.85:
I didn't have enough time to put a simple exponential function instead of the randomizer,
so I put sigma to the minimal level and the number of scenarious to 1.
FCost[0]:= 3000: rfcost:= 0.02: sigmafcost:= 0.00001: N:= 48: M:= 1: T:= 48: h := T/N:

randomize():
U := RandomVariable(Normal(0, 1)):
W := exp((rfcost-(1/2)*sigmafcost^2)*h+sigmafcost*sqrt(h)*U):
SPr := [seq(Sample(W, N), i = 1 .. M)]:
for i to M do SPr[i][1] := FCost[0] end do:
SPr := map(CumulativeProduct, SPr):
Xrng := [seq(h*i, i = 1 .. N)]:
for k to N do
OpC[k]:=Mean([seq(SPr[i][k],i=1..M)])
end do:
The same with the depreciation. That's just an example. I recommend you to exclude this factor from the model, because it's not so important in case of an internet company at the early stage.
Dep[0]:= 250: rdep:= 0.005: sigmadep:= 0.00001: N:= 48: M:= 1000: T:= 48: h := T/N:
randomize():
U := RandomVariable(Normal(0, 1)):
W := exp((rdep-(1/2)*sigmadep^2)*h+sigmadep*sqrt(h)*U):
SPr := [seq(Sample(W, N), i = 1 .. M)]:
for i to M do SPr[i][1] := Dep[0] end do:
SPr := map(CumulativeProduct, SPr):
Xrng := [seq(h*i, i = 1 .. N)]:
for k to N do
Dep[k]:=Mean([seq(SPr[i][k],i=1..M)])
end do:
The amount of money we reinvest. Here is a weak place of the model. We can not reinvest with the negative cash flow. That's why it will be more correct to make a condition identical to the taxes calculator which will be further. I'll fix this bug pretty soon! :)
Cap[0]:= 30000: rcap:= 0.01: sigmacap:= 0.0001: N:= 48: M:= 1000: T:= 48: h := T/N:
randomize():
U := RandomVariable(Normal(0, 1)):
W := exp((rcap-(1/2)*sigmacap^2)*h+sigmacap*sqrt(h)*U):
SPr := [seq(Sample(W, N), i = 1 .. M)]:
for i to M do SPr[i][1] := Cap[0] end do:
SPr := map(CumulativeProduct, SPr):
Xrng := [seq(h*i, i = 1 .. N)]:
for k to N do
Cap[k]:=Mean([seq(SPr[i][k],i=1..M)])
end do:
with(SumTools):
r:=0.42/12:
k:=1:
In order to show the distribution of results there was a special function built called 'valuator'.
Valuator:=proc(i)local TotalCust, CustPers, CustSelf, SalesPers, SalesSelf, GrossMargin, OperatingProfit, OperatingProfitAT, tax, FCF, PV, PVn, PrVal;
global k,N,r, arpuPers, arpuSelf,cogsSelf,cogsPers,Visitors,Conv,AvPers,AvSelf,OpC,Cap;
for k to N do
Totalcust[k]:=abs(Visitors[i][k]*Conv[k]):
custPers[k]:=abs(Totalcust[k]*AvPers[k]):
custSelf[k]:=abs(Totalcust[k]*AvSelf[k]):
SalesPers[k]:=custPers[k]*arpuPers:
SalesSelf[k]:=custSelf[k]*arpuSelf:
GrossMargin[k]:=SalesPers[k]+SalesSelf[k]-cogsSelf*custSelf[k]-cogsPers*custPers[k]:
OperatingProfit[k]:=GrossMargin[k]-OpC[k]:
if (OperatingProfit[k] 0) then tax[k]:= OperatingProfit[k]*0.2: else tax[k]:=0 end if:
OperatingProfitAT[k]:=OperatingProfit[k]-tax[k]:

FCF[k]:= OperatingProfitAT[k]+Dep[k]-Cap[k]:
PV[k]:=FCF[k]/(1+r)^k:
end do:
PV[49]:=(PV[48]/(r-(0.05)/12))/(1+r)^48:
PVn:=[seq(PV[k],k=1..N)]:
DefiniteSummation(PV[t],t=1..N)+PV[49];
end proc:
Finally, we can build a histogram, illustrating the result.
with(Statistics):
q:=1:
M:=10000:
for q to M do
Value[q]:= Valuator(q):
end do:
ValueList:=[seq(Value[q],q=1..M)]:
with(Statistics):
A := ValueList:
B:=Mean(A);
Q := Histogram(A, averageshifted=3, color=grey, title="The value distribution according to 10 000 scenarious"):
plots[display](Q);

That's it!

Friday, June 3, 2011

Valuation of startups with the Monte Carlo simulation model

The issue of the valuation of internet companies at the seed stage is quite controversial. Companies of this category are considered to be quiet risky from the point of view of the investor, but the risk is not only the probability of loss, but big capital gains as well.

If you are the person, who wants to measure the value of the company of this sort with the discounted cash flow approach, I’d recommend you the following sources:

My goal in this post is to describe my model of valuation with Monte Carlo simulation instruments. In my opinion it’s an optimal choice for those who want to measure the value of the Internet Company and take contingency factors into consideration. After all this method can be easily modified for the real options approach implementation, which allows considering specific risks of the company as well.

Let me go straight to the point. The model was built for the valuation of companies in ecommerce. For this reason my approach is based on the assumption that the customers of the company in the time period are calculated according to the number of unique visitors and the conversion of this people into the customers:


It’s important to note that if we deal with startups there is a very high volatility in the flow of visitors.

The daily reach of visitors for Mixpanel and Zemanta are good examples:



Conversion rate of visitors into customers is volatile as well. Traditionally it varies from 5% to 7%. Let’s make an assumption that it’s like that, but of course there are cases of a higher one or lower. It fully depends on the business model of the company, the way how sales are organized, but it’s not actually the issue of this post.

Almost undetermined behavior of future visitors can be described with the differential equation of geometric Brownian motion:


As far as I know this differential equation can’t be solved and the only way to get the information on the most possible answer is to generate a big number of scenarios. And that is the basic idea of Monte Carlo simulation approach. The number of unique visitors in the period t can be described in the following way:


μ is the expected growth and σ is the volatility. The parameters are estimated on the historical data.

Z is the random variable with a normal distribution.

Almost the same is for the conversion rate:


Thanks to the conversion rate and the number of unique visitors we get the number of costumers. Let call this variable ‘TotalCastumers’.

The customers of the company are the sum of customers in each product category i, with the total number of product categories N.

Let’s consider that there are two categories of services provided by the company, then i=2.


The calculation of %Cast allows us to operate with the portfolio structure, which can be permanent or changing exponentially or even stochastically. I recommend you to make your choice according to the historical information of the company you want to evaluate.

After that we can start calculating sales revenue:


arpu_ is average revenue per user. The formula for the GrossMargin in the period t can be calculated according to the following equation:


Where COGS is the cost of goods sold.

After that we calculate OperatingProfit which is the GrossMargin minus FixedCosts:


We can also calculate Income after taxes which is calculated according to the value of OperatingProfit:


I decided to express depreciation and investments exponentially, but any other functional form also possible.


Free cash flow is calculated in the following way:


The value of the firm can be calculated according to the formula:


r is the cost of acquired capital, which is identified according to the ROI of the venture capitalist, who gives the money. g – is the future growth, which varies from 5% to 15% and depends on the industry.

The idea is that we generate a big number of scenarious for the flow of website visitors. Conversion can be taken as a mean of one's distribution.

That’s the theoretical model I wanted to share with you. The practical implementation of the model will be in the further post.