Modelling a variable that is both categorical and continious I am attempting to design a study in which the impact of a variable on patient decision making is evaluated having adjusted for some other clinical variables. To give more detail, a clinical continuous variable (call it X) that is known to be associated with disease recurrence is used along some other clinical variables. Suppose, I have 100 patients and over the course of the study, the patients are randomized in such a way that half of them receive the variable X along other variables and choose to undergo treatment or not. While, the other half do not receive the info on variable X and based on other variables revealed to them choose to undergo treatment or not. Now, I'm interested to evaluate the impact of X on the decision (treatment vs no treatment), but as a continuous variable and the problem is half the patients did not receive the variable X. So, what is the appropriate approach here? Can I use a logistic regression model where I adjust for 1)other clinical variables, 2)whether someone received X or not (binary), and then also 3) X as continuous variable (for those who did not receive X, this value would be 0). I would appreciate your thoughts on this. thanks
 A: This is just an interaction. You want to model the effect of being treated vs. not being treated on the outcome. But the effect of being treated is, coarsely, a function of how the treatment was administered.
Let's say you were going to use logistic regression (which you probably should). Call $T=1$ when treated and $T=0$ otherwise, and $\operatorname{Pr}(Y=1)=p$ where $Y$ is your binary outcome. You're asserting that
$$
\log\left(\frac{p}{1-p}\right)\equiv\operatorname{logit}\left(p\right)=\alpha+\beta T
$$
That is, you're saying that when someone is treated, the log odds of $Y$, for that someone, increase by $\beta$. But you also want to say that, given $T=1$, the log odds of $Y$ will also vary with respect to treatment intensity $S$. The easiest way to incorporate this is to say
$$
\operatorname{logit}\left(p\right)=\alpha+\beta T+\gamma ST
$$
That is, $Y|T=1$ varies linearly with $S$. The fact that $S$ is "unobserved" when $T=0$ doesn't matter because it would get multiplied by zero anyway. Importantly, this model is just one step of algebra away from
$$
\operatorname{logit}\left(p\right)=\alpha+(\beta + \gamma S)T
$$
which, again, is mathematically equivalent but also reveals a different interpretation: the coefficient on $T$ itself is a function of $S$.
Interpreting this in terms of log odds is easy, because the effect is linear. But translating those log odds back to probabilities is somewhat more complicated. There is also an issue with statistical significance, in that p-values can be different depending on whether you're talking about log odds or raw probabilities. There's a thorough, if somewhat dense, walkthrough of these issue here, demonstrated in Stata.
Finally, you will often hear that you should never include interaction terms in a regression without also including the "main effects." That prescription obviously doesn't apply here.
