PrSAT: Second Examples

Philosophy 148

February 7, 2008

First, load in the PrSAT package

See my PrSAT website for instructions on downloading and installing PrSAT (assuming you have Mathematica installed).

<<PrSAT`

Example #0

Proving a couple of equivalence theorems about independence.  First, define a non-equivalence operator (for simpler input):

X_≢Y_:=LogicalExpand[Not[(X∧Y)||(!X∧!Y)]];

PrSAT[{
(Pr[X∧Y]==Pr[X]Pr[Y])≢(Pr[X∧¬Y]==Pr[X]Pr[¬Y])
}]

PrSAT[
{
(Pr[X∧Y]==Pr[X]Pr[Y])≢(Pr[¬X∧¬Y]==Pr[¬X]Pr[¬Y])
}]

Example #1

The pairwise independence vs mutual independence counterexample involving the labeled tickets.

MODEL1 = PrSAT[
{
Pr[X]==(1/2),
Pr[Y]==(1/2),
Pr[Z]==(1/2),
Pr[X∧Y∧Z]==0,
Pr[X∧Y]==(1/4),
Pr[X∧Z]==(1/4),
Pr[Y∧Z]==(1/4)
}]

TruthTable[MODEL1]

We can use EvaluateProbability to check that this model is a counterexample to the claim in question:

EvaluateProbability[{
Pr[X∧Y]==Pr[X] Pr[Y],
Pr[X∧Z]==Pr[X] Pr[Z],
Pr[Y∧Z]==Pr[Y] Pr[Z],
Pr[X∧Y∧Z]==Pr[X] Pr[Y] Pr[Z]},
MODEL1]

We can use PrSAT to find a regular countermodel to this claim, as follows:

MODEL2=PrSAT[{
Pr[X∧Y]==Pr[X] Pr[Y],
Pr[X∧Z]==Pr[X] Pr[Z],
Pr[Y∧Z]==Pr[Y] Pr[Z],
Pr[X∧Y∧Z]≠Pr[X] Pr[Y] Pr[Z]},Probabilities->Regular]

TruthTable[MODEL2]

Example #2

A counterexample to transitivity of independence.  We can use PrSAT to automatically find such a counterexample:

MODEL3 = PrSAT[
{
Pr[X∧Y]==Pr[X] Pr[Y],
Pr[Y∧Z]==Pr[Y] Pr[Z],
Pr[X∧Z]≠Pr[X] Pr[Z]
},Probabilities->Regular]

TruthTable[MODEL3]

We can use EvaluateProbability to check that this model is a counterexample to the claim in question:

EvaluateProbability[{
Pr[X∧Y]==Pr[X] Pr[Y],
Pr[Y∧Z]==Pr[Y] Pr[Z],
Pr[X∧Z]==Pr[X] Pr[Z]},
MODEL3]

Example #3

An example of Simpson's Paradox:

MODEL4= PrSAT[
{
Pr[p∧q|r]==Pr[p|r] Pr[q|r],
Pr[p∧q|¬r]==Pr[p|¬r] Pr[q|¬r],
Pr[p∧q]≠Pr[p] Pr[q]
},Probabilities->Regular]

TruthTable[MODEL4]

We can use EvaluateProbability to check that this model is a counterexample to the claim in question:

EvaluateProbability[{
Pr[p∧q|r]==Pr[p|r] Pr[q|r],
Pr[p∧q|¬r]==Pr[p|¬r] Pr[q|¬r],
Pr[p∧q]==Pr[p] Pr[q]},
MODEL4]

Example #4

Hacking's "Odd Question #5" — Base Rate Fallacy example:

MODEL5= PrSAT[
{
Pr[𝔼|ℍ]==0.8,
Pr[𝔼|¬ℍ]==0.1,
Pr[ℍ]==0.01
}]

TruthTable[MODEL5]

We can use EvaluateProbability to calculate the "posterior" Pr(H | E):

EvaluateProbability[Pr[ℍ|𝔼],MODEL5]