3 ms·
Did I read somewhere that this technique is actually used to gather survey data where the subject may have reason to lie? They can answer yes but it remains pla
by mildavw 13y ago
Did I read somewhere that this technique is actually used to gather survey data where the subject may have reason to lie? They can answer yes but it remains plausible that it was because of two coin flips coming up heads so they are not individually implicated. When you aggregate the data over many subjects, however, you have a better idea of how many actual cheaters there were than if you asked directly.
Anyway, here is the code below: http://jsfiddle.net/nQ3Gu/ http://jsfiddle.net/nQ3Gu/
var runs = 1000,
honest_admissions = 0,
automatic_admissions = 0;
function flip() {
return Math.random() < 0.5 ? 'h' : 't';
}
for (var i = 0; i < runs; i++) {
if (flip() == 't') {
honest_admissions++;
} else if (flip() == 'h') {
automatic_admissions++;
}
}
document.write('The "yes" is honest ' + honest_admissions / (honest_admissions + automatic_admissions) + ' of the time.')
2/3 of yeses are honest and 1/3 didn't have to answer the question!
- mildavw 13y agoOops. That's completely wrong. It's the case where every honest answer is yes! I think this is indeterminate. You have to know the ratio of total yesses to total participants. The real world use-case I was recalling is simpler: flip a coin and answer honestly if it's heads and "yes" if it's tails. Any individual response is non-incriminating, but if N is large enough where you can assume N/2 got heads, you can know the number of "honest cheaters."