# Analyzing lie in a cardgame

We are playing a card game in which cards can be of three categories — good, bad, neutral.

A player draws a variable number of cards $$n$$ and then states the composition of his cards. The player does not have to be truthful here. In the course of the game, a variable number of the $$n$$ drawn cards is actually revealed. I would like to calculate the probability that the person is lying given the revealed cards.

Does anyone have any tips?

• What is the simplest example you can think of? What is your motivation for asking this question? – Rodrigo de Azevedo Apr 3 at 14:46
• In general, you should use Bayes Theorem to find $P[\text{lying}|\text{information}]$ if you know $P[\text{information}|\text{lying}]$ and $P[\text{information}|\text{not lying}]$ and given some initial guess at $P[\text{lying}]$, but more information is needed about the game to calculate those. – John L Apr 3 at 15:02

You do not define hand size $$n,$$ the number revealed $$r,$$ the meaning of 'good', 'bad', 'neutral' (for the actual cards) or how specific the claims are to be. So only made-up examples seem possible. Here are a couple of examples.

(1) $$n = 13;$$ All cards are good, claimed "Mostly not good" (we assume 6 'good' and 7 not). We might doubt the claim after 3 cards are revealed as all good, and feel justified in calling "liar" after 4. If the claim is true, the hypergeometric PDF shows the probability of drawing no good cards in 2, 3 and 4 draws, respectively.

dhyper(0,  6,7,  2)
[1] 0.2692308
dhyper(0,  6,7,  3)
[1] 0.1223776          # Possible liar
dhyper(0,  6,7,  4)
[1] 0.04895105         # Likely liar


(2) More generally: $$n = 12, r = 6.$$ Chaim: "Equal numbers of each category." Observed results, $$X = (4, 1, 1)$$ observed. Unobserved $$Y = (0, 3, 3).$$ We can do a goodness-of-fit test of observed to claimed counts.

x = c(4,1,1);  y = c(0,3,3);  TAB=rbind(x,y)
TAB
[,1] [,2] [,3]
x    4    1    1
y    0    3    3


A straightforward use of Pearson's chi-squared test, cannot give an accurate P-value because of low cell counts.

chisq.test(TAB)

Pearson's Chi-squared test

data:  TAB
X-squared = 6, df = 2, p-value = 0.04979

Warning message:
In chisq.test(TAB) : Chi-squared approximation may be incorrect


However, in the implementation of chisq.test in R, it is possible to simulate a sufficiently accurate P-value.

chisq.test(TAB, sim=T, B=10^5)

Pearson's Chi-squared test with
simulated p-value (based on 1e+05 replicates)

data:  TAB
X-squared = 6, df = NA, p-value = 0.1429


So there is not sufficient evidence that the player is telling a lie. Often this simulated version of chisq.test gives P-values that approximate a version of Fisher's exact tests to accept tables larger than $$2 \times 2.$$

fisher.test(TAB)

Fisher's Exact Test for Count Data

data:  TAB
p-value = 0.1429
alternative hypothesis: two.sided


Of course, in this scenario, if more then 4 cards of any one type are revealed, we would doubt the truth of the claim.

Notes:

(a) In R the following procedure in equivalent to the first (failed) use of chisq.test:

prop.test(c(4,1,1), c(4,4,4))

3-sample test for equality of proportions
without continuity correction

data:  c(4, 1, 1) out of c(4, 4, 4)
X-squared = 6, df = 2, p-value = 0.04979
alternative hypothesis: two.sided
sample estimates:
prop 1 prop 2 prop 3
1.00   0.25   0.25

Warning message:
In prop.test(c(4, 1, 1), c(4, 4, 4)) :
Chi-squared approximation may be incorrect


(b) For tables with more cells and higher counts than above, fisher.test can overwhelm the capacity of some installations of R.