Last active
September 22, 2016 09:07
-
-
Save coppeliaMLA/9075498 to your computer and use it in GitHub Desktop.
Uncertainty in a financial model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#First we are going to set up probaility distributions for our beliefs about the inputs | |
#We've been told ARPU is about £7 and it's very unlikely to be higher than £10 or lower than £4 | |
#So we'll go for a normal distribution centred at 7 with 5% and 95% quantiles at 4 and 10 | |
#Show how we get the variance | |
arpu.sd<-3/1.96 | |
x<-seq(0, 15,by=0.5) | |
d<-dnorm(x, 7, arpu.sd) | |
plot(x, d, type='l') | |
#Do the same for acquistion and churn | |
acq.sd<-0.02/1.96 | |
x<-seq(0, 0.2,by=0.001) | |
d<-dnorm(x, 0.05, acq.sd) | |
plot(x, d, type='l') | |
ch.sd<-0.01/1.96 | |
x<-seq(0, 0.2,by=0.001) | |
d<-dnorm(x, 0.02, ch.sd) | |
plot(x, d, type='l') | |
#I'm to lazy to do the maths for this so I'll write a function | |
revenue<-function(arpu, acq, ch){ | |
num.cust<-50000 | |
for (m in 1:12){ | |
num.cust<-num.cust+acq*num.cust-ch*num.cust | |
} | |
return(num.cust*arpu) | |
} | |
#Now let's simulate 10k values from each of our distributions | |
sim.arpu<-rnorm(10000, 7, arpu.sd) | |
sim.acq<-rnorm(10000, 0.05, acq.sd) | |
sim.ch<-rnorm(10000, 0.02, ch.sd) | |
#We can then apply the function to these values to get a distribution for end of year revenue | |
sim.rev<-mapply(revenue, sim.arpu, sim.acq, sim.ch) | |
summary(sim.rev) | |
hist(sim.rev) | |
plot(density(sim.rev)) | |
#Note the distribution is slightly skewed | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment