# How to customize a link function to perform a logistic regression?

My data was collected using Randomized Response Technique. So I have additional variability into the data. I have a binary response variable. Should I customize a logit link function to incorporate the known probabilities of Randomized Response Technique to perform a logistic regression? I would like to know if this approach is appropriate or how one might correctly perform a regression with these kinds of responses.

If a customized link function is appropriate, I should customize the logit $\log \left({p \over 1-p}\right)$ to the customized $\log \left({p-0.25 \over 0.75-p}\right)$. Can anyone help me to do that? I don't have too much experience using R.

• Although we could migrate this to SO where the R community likely could give you a good answer to the programming issue quickly, I would like to suggest instead that you edit your question to ask whether this approach is appropriate and how one might correctly perform a regression with these kinds of responses.
– whuber
Sep 1, 2014 at 15:57
• the only way I know is creating a custom set of functions to get a family through make.link, and then calling it from the glm. You need to define the function itself, the inverse, and the derivative I think.. Check make.link?, family? in help and at google Sep 1, 2014 at 18:39

Here is how to do the necessary algebra. Others can add an example of how to do it in R. Suppose you response variable of interest is $Y$, which is the response to a question with answer "yes" or "no" (We code "yes" as 1 and "no" as 0). Suppose we have a valid logistic regression model for $Y$: $$P(Y=\text{yes} | x) = g^{-1}(x) =\frac{e^{\beta' x}}{1+e^{\beta' x}}$$ where $g$ is the link function, $g^{-1}$ the mean function. We get $$g(y) = \ln(\frac{y}{1-y})$$ No, with the randomized resaponse technique, instead you observe a response variable $Y^*$ which is defined as $Y^* = \begin{cases} Y, ~~\text{with probability$1-q$} \\ \text{yes}, ~~\text{with probability$q$}. \end{cases}$
Since now, in all cases, regardless of the values of the regressor variable(s) $x$, the probability of a "yes" response is at least $q$, so effectively we obtain the link function by restricting the probability parameter to range in $(q,1)$, not in $(0,1)$. Calculate: $$P(Y^*=\text{yes}|x)=q+(1-q)P(Y=\text{yes}|x)=\frac{q+e^{\beta'x}}{1+e^{\beta'x}}$$ (where $q$ here is a known probability). Inverting this gives the link function $g(y)=\ln(\frac{y-q}{1-y})$.
• Anyhow, did you understand the roloe of the parameter $q$ in my answer? Sep 9, 2014 at 11:12