# Fitting to data with a Bernoulli (I think) distribution

I have a series of data to which I want to fit my model. The model predicts the probability of success at a given value of x. I have a single data point at a number of points in this space. As I have a single point which is either pass or fail with a certain probability I believe I should fit using a Bernoulli maximum likelihood fit, is this correct? So i have a likelihood function which looks something like $$L(\theta,x) = \Pi^{n}_{i} \theta^{x_i}(1-\theta)^{1-x_i}$$ where n are my data points? This is just different enough to the usual Binomial likelihood case to have completely thrown me.

-
Isn't $\prod_i^n\theta^{x_i}(1-\theta)^{1-x_i}$ the same as $\theta^{\sum_i x_i}(1-\theta)^{n-\sum_i x_i} = \theta^y(1-\theta)^{n-y}$ where $y = \sum_i x_i$ is a binomial $(n,\theta)$ random variable? –  Dilip Sarwate Dec 21 '11 at 17:02
Wouldn't $y$ have the distribution ${n \choose k} \theta^y (1 - \theta)^{n-y}$ if $y = \sum_{i=1}^n x_i$ –  Sacha Epskamp Dec 21 '11 at 17:53
@SachaEpskamp What is the relationship between $y$ and $k$? In any case, the probability mass function of $y$ is irrelevant. The likelihood of the observation or data $$x = (x_1,x_2,\ldots,x_n)$$ is exactly what Bowler stated it to be, and it is essentially a binomial likelihood. The extra constant factor $\binom{n}{y}$ (remember that $y$ is a function of the data $x$ and is thus fixed) that you have included makes no difference: the value of $\theta$ that maximizes $\theta^y(1-\theta)^{n-y}$ is the same as that which maximizes $\binom{n}{y}\theta^y(1-\theta)^{n-y}$. –  Dilip Sarwate Dec 21 '11 at 22:12
add comment

## 2 Answers

If $x$ is a vector with independent measurements of a single variable which can be pass or fail, then this is the likelihood indeed, except that I think $L(\boldsymbol{x} \mid \theta)$ would be the proper notation.

EDIT: the binomial distribution is based on the sumscore. It would be the proper distribution if you were using $y = \sum_{i=1}^n x_i$.

-
Thining about it I asked a yes/no quesiton so this does actually answer it. Thanks. –  Bowler Jan 16 '12 at 15:28
add comment

I think what you want is logistic regression (or at least the likelihood that is maximized in logistic regression). If the wiki isn't enough, search for MLE fitting of logistic regression on Google.

-
Thanks, logistic regression looks interesting its definitely a possibility. –  Bowler Jan 8 '12 at 15:47
add comment