# Logistic regression: Is there a significant difference for probability p between groups of Bernoulli random variables?

Let $S_{I+1} = \{1,2,\cdots,I\}$. And assume that there are exactly $J$ observations $(x_j,s_j) \in \mathbb{R} \times S_{I+1}$ for each integer $j$ such that $1 \leq j \leq J$. For each $i \in S_{I+1}$, I create Bernoulli distributed random variables $Y_{i_1}$,$Y_{i_2}, \cdots, Y_{i_J}$ such that $Y_{i_j} = 1$ if $s_j \leq i$ and $Y_{i_j} = 0$ otherwise. I proceed to do logistic regression on each of the $I$ groups using:

$$P(Y_{i_j} = 1 | x_j) = \frac{\exp(\beta_{i_0} + \beta_{i_1} x_j)}{1 + \exp(\beta_{i_0} + \beta_{i_1} x_j)} \qquad \text{for each i \in S_{I+1}.}$$

Thus I complete exactly one logistic regression for each $i \in S_{I+1}$.

Now fix $p, \alpha \in (0,1)$. How can I construct a $100(1- \alpha)\%$ confidence interval for $x_{p_i}$ such that $P(Y_{i_j} = 1 | x_{p_i}) = p$ for each $i \in S_{I+1}$? The purpose is that I want to test whether there is statistically significant difference between $x_{p_i}$-values. I suppose I need to use maximum likelihood estimation, but I am not sure where to begin.

• Can you get an answer by including the group factor in the model to check whether the function $P(Y = 1 | x)$ is the same for all groups? – Nik Tuzov Jul 22 '16 at 17:03
• @Nik I would only like to test a single probability between groups, not whether group has an impact on all the probabilities. – Mikkel Rev Jul 23 '16 at 12:19
• What is $x$? What is $x_p$? – Michael M Jul 23 '16 at 20:11
• $x$ and $x_p$ are real. They are predictors. The value of $x$ is arbitrary, the value of $x_p$ is such that $p = P(Y_j=1 | x_p)$ for some fixed $p$. – Mikkel Rev Jul 24 '16 at 9:36
• Marius, I edited the question, does it look right to you? – Nik Tuzov Jul 27 '16 at 14:30