How Your Startup Can Use Bayes Rule to Survive
Tags: tutorial, startup, programming, webdev
Published: 2022-06-27 08:57:42

In economic downturns, the thing that keeps startups alive is numbers. The sort of sweet talking, finessing, and gut-decisions that might work in a bull market falls apart very quickly as soon as an investor, customer, or any other stakeholder lowers their risk intolerance.

If you’re trying to raise money right now, and you don’t have killer revenue numbers to back up your claims, you’re going to need to make predictions off of all the good data that you work with.

But how can you effectively leverage the information you have into coherent predictions? That’s where Bayes Rule comes in.

---

###A Practice Problem

Before we introduce the math behind Bayes Rule, let’s work with an example.

Let’s say we are building a SaaS API to give people pictures of dogs. At the moment we have three pieces of data on our users:

* 5% of our users are paying
* 20% of our users are from the United States
* 80% of paying users are from the United States

An important question that you might need to ask is if we run a certain marketing campaign in the United States where we expect to acquire 100 users in the United States, how many will be paying users. 

Bayes Rule allows us to answer this question

###Bayes Rule 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h452ymulms6lcdwyt901.png)

Bayes Rule is a method of updating our predictions based on different pieces of data that we have.

In the above equation here’s what each of those things mean:
* P(B|A): The probability that event B occurs, given that A is true
* P(A|B): The probability that event A occurs, given that B is true
* P(B): The overall probability that B is true
* P(A): The overall probability that A is true

In our above example, we have that A is the fact that a user is from the United States, and B is the fact that a user is paying. So now working with these examples we have:

* P(B|A): The probability that a user is paying, given that they are from the US(What we want to find out)
* P(A|B): The probability that a user is from the US, given that they are paying(80%)
* P(B): The percent of users that are paying(5%)
* P(A): The percent of users from the United State(5%)

So now we can plug these numbers in to get:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7wilrkh4el76dxk2gz63.png)

So our final answer is that a user from the United States has a 20% chance of paying! This means we can predict 20 of the 100 users to pay.

---

###Why this is so important

The reason this is so important is because it is a very common mistake to answer this question without using the fact that the users are from the United States. The gut way to answer this question would be to say that 5% of our users pay, so out of the 100 users we plan to acquire, 5 will pay.

But the reality is that every new piece of information can update our predictions. By considering the fact that the users are from the US, we can get a more accurate prediction(not to mention a higher one in our scenario). 

Bayes Rule allows us to look at predictions holistically and produce more accurate predictions. These tools to achieve accuracy are the kinds of things that can get an investor on your side.

Now keep in mind, collecting these pieces of data warrants a whole new discussion. Experimental design is something that most startups do horribly wrong, but don’t worry we’ll be covering it in the following weeks!

---

If you’re looking for more startup content make sure to subscribe and let us know down below what you want us to write about next!

At [Codesphere](https://link.codesphere.com/NP), we’re building an all-in-one collaborative web IDE, devops tool, and cloud platform. Give us a try!