# Predictive Analysis and Circuit Board Failures

** Published:**

# Predictive Analysis and Circuit Board Failures

Recently a friend came to me with a question. He had been working on testing *expensive* circuit boards and of the ten he tested, two didn’t work. His question for me was what was the probability of future ones working. This turns out to be a question of predictive analysis. Assuming that the boards work or don’t work according to a binomial distribution (i.e. a coin toss), the probability of success is the maximum likelihood estimate. So, the probability of the next board working is simply . However, asking questions about more than the next board is a bit more tricky. Given our observations , what is the probability of a set of new observations ?

In the simple maximum likelihood approach, we have estimated our parameter and so simply calculate the probability of new observations as . However, this fails to take into account our uncertainty of our estimate for .

In a Bayesian setting, however, we do take into account the uncertainty of our parameter. By Bayes Theorem, we have the equation for the posterior distribution

which tells us the likelihood of our parameter given our data. This is factored into our predictive distribution

.

First, since the distribution of our observations is binomial, the conditional likelihood of *s* successes and *f* failures is

However, is just an estimate from the observation and so it has its own distribution. The Beta distribution is a commonly used prior distribution, positive only on and having a flexible shape dependent on two shape parameters and .

where is the gamma distribution. Our best guess for and are based on our observations. Since the mean of the Beta distribution and our estimated , we set and .

Recalling that we are interested in the predictive probability of *s* future successes and *f* failures, we plug these equations back into Bayes theorem and find our posterior distribution to be

As it turns out, our posterior distribution is another Beta distribution, . This is because the Beta distribution is the conjugate prior for the Bernoulli likelihood function, among other. If the posterior and the prior distributions are in the same probability distribution families, we call them conjugate.

Factoring this into the predictive distribution, we find the probability of *s* future successes and *f* future failures to be

where and come from the observations . For a single success, the probability is just like our maximum likelihood estimation. For more than one success or failure, the probabilities differ. By applying a Bayesian approach, we are able to factor in the uncertainty of our parameter’s estimate into our calculations.