Two fun R packages

Pinference: Probability Inference for Propositional Logic. “Implementation of T. Hailperin’s procedure to calculate lower and upper bounds of the probability for a propositional-logic expression, given equality and inequality constraints on the probabilities for other expressions. Truth-valuation is included as a special case. Applications range from decision-making and probabilistic reasoning, to pedagogical for probability and logic courses.”

RobinCar2: ROBust INference for Covariate Adjustment in Randomized Clinical Trials. “Performs robust estimation and inference when using covariate adjustment and/or covariate-adaptive randomization in randomized controlled trials.” Though see this post.

Testimony

I would conjecture* that qualitative testimony about the impact of social programmes is often highly sensitive (if a programme works, then people will tell you it works) but has very poor specificity (if it doesn’t work, people are unlikely to tell you so, e.g., not recognising alternative explanations of change). If this conjecture is true, then it follows that positive feedback about a programme doesn’t tell us much; however, negative feedback would be highly informative. This follows from Bayes’ rule.

Play around with the probabilities here.

Sensitivity is the probability that someone will tell you the programme works, if it does actually work.

Specificity is the probability that someone will tell you the programme doesn’t work, if it doesn’t actually work.

Prevalence is the probability that programmes of the type you are asking about actually work, e.g., 0.5 would mean for a given type of programme you think the probability it does work is the same as the probability it doesn’t.

Positive predictive value (PPV) is the probability that the programme actually does work if someone tells you it does.

Negative predictive value (NPV) is the probability that the programme doesn’t actually work if someone tells you it doesn’t.

* This conjecture is at the bottom of the evidence hierarchy, whatever the opposite of a gold standard is. Balsa wood standard?

Four ways to calculate the probability that if it rains, I have an umbrella

This post shows four ways to calculate the conditional probability that I have an umbrella, given that it’s raining, \(P(umbrella|raining)\). The first way uses the ratio formula, \(P(raining \land umbrella)/P(raining)\). The second uses a three-valued logical connective, the conditional event, which can be traced back to the work of Bruno de Finetti in the 1930s (see, e.g., Baratgin, 2021). The third filters the dataset to rows where it’s raining before counting the proportion of those where I had an umbrella. The fourth uses logistic regression.