Logistic regression with two slopes and one intercept I am using R to fit a logistic model to some data. The problem is as follows:
"The effects of the dose of poison $(x)$, in milligrammes, and the method of delivery $(w)$ on the
probability of survival were examined in a study of rats. The two methods of delivery were
as a solid with food or as a liquid in water. For each combination of dose and method of
delivery, a certain number of rats $(r)$ were used and the number who survived $(y)$ is recorded.
Below are the data.

Now when I plot these data, it looks like a model that has a different slope for each delivery method but the same intercept would be suitable:

How would I tell R to do this? I know that to fit a model with different intercepts but the same slope is "glm(p~x+w,...)" and to fit a model with two slopes and two intercepts is "glm(p~x+w+x:w,...)" but can't figure out the case for different slopes and the same intercept.

How do you determine that the intercept is the same for both methods of delivery $w$, from a plot of the observed probability of survival $p$ against the dose $x$?
Recall that a logistic regression is a linear model for the log odds (here, of survival):
$$
\begin{aligned}
\log\frac{\operatorname{P}(Y)}{1-\operatorname{P}(Y)} =\mathbf{X}\boldsymbol{\beta}
\end{aligned}
$$
So it's more informative to plot the log odds of survival on the y-axis:

This plot doesn't suggest to me to specify that the slope is the same for both $w$ but to add a quadratic term for $x$.
Here are two fits, both on the logit scale (the link function of the logistic regression is the logit). The first fit is for the model y ~ x + x:w; it has the same intercept, different slopes for $w$. The second fit is for the model y ~ w + rcs(x, 3): restricted cubic splines with 3 knots in the dose $x$, with a vertical shift between the two methods of delivery $w$. The second model suggests that the relationship between dose and the log odds of survival is mostly linear for $x\geq2$.


Created on 2022-12-11 with reprex v2.0.2
