Randomized response (source code)

= Randomized response
{title2=$q=(1-x)+(2x-1)p$}
{wiki}

= Randomised response
{synonym}

<Randomized response> masks which of two complementary binary questions a person answered. Suppose the sensitive property has <probability> $p$, and independently the direct question is selected with known <probability> $x$, while the complementary question is selected otherwise. Truthful answers then have yes <probability> $q=xp+(1-x)(1-p)$. The investigator observes only the answer, preserving uncertainty about an individual's status while permitting population <statistical estimation> when $x\ne1/2$.

For $n$ independent responses, $Y\sim\operatorname{Bin}(n,q)$, and the affine <estimator> $\widetilde p=(Y/n-1+x)/(2x-1)$ is an <unbiased estimator>. Its <variance> is $q(1-q)/[n(2x-1)^2]$, by the mean and <variance> of a <binomial distribution>. Equivalently the <variance> is $p(1-p)/n+x(1-x)/[n(2x-1)^2]$, exposing the extra sampling uncertainty caused by the masking. At $x=1/2$, all $p$ produce $q=1/2$ and <identifiability> fails. At $x=0$ or $1$, there is no masking and the extra variance vanishes.

Because $0\leq p\leq1$, <maximum likelihood estimation> gives $\widehat p=\min(1,\max(0,\widetilde p))$. This follows by maximizing the <binomial likelihood> over the interval $q\in[\min(x,1-x),\max(x,1-x)]$ and then inverting its monotone affine parametrization. Clipping can introduce <bias>: for $n=1$, $x=3/4$ and $p=0$, the clipped estimate has mean $1/4$.