@chelseaparlettpelleriti 🐧🧊 and that’s on making sure you create a safe place to ask questions as a teacher 😎✌🏼 #statsTikTok #datascience
♬ The Wonder Pets! – Wonder Pets
Tag: statistics
LaLonde (1986) after Nearly Four Decades: Lessons Learned (Guido Imbens, Yiqing Xu)
“We show that modern methods, when applied in contexts with significant covariate overlap, yield robust estimates for the adjusted differences between the treatment and control groups. However, this does not mean that these estimates are valid. To assess their credibility, validation exercises (such as placebo tests) are essential, whereas goodness of fit tests alone are inadequate. Our findings highlight the importance of closely examining the assignment process, carefully inspecting overlap, and conducting validation exercises when analyzing causal effects with nonexperimental data.”
Comparing Analysis Method Implementations in Software (CAMIS)
“The goal of this project is to demystify conflicting results between software and to help ease the transitions to new languages by providing comparison and comprehensive explanations.”
Hedges’ g for multilevel models in R {lmeInfo}
This package looks useful (for {nlme} not {lme4}).
“Provides analytic derivatives and information matrices for fitted linear mixed effects (lme) models and generalized least squares (gls) models estimated using lme() (from package ‘nlme’) and gls() (from package ‘nlme’), respectively. The package includes functions for estimating the sampling variance-covariance of variance component parameters using the inverse Fisher information. The variance components include the parameters of the random effects structure (for lme models), the variance structure, and the correlation structure. The expected and average forms of the Fisher information matrix are used in the calculations, and models estimated by full maximum likelihood or restricted maximum likelihood are supported. The package also includes a function for estimating standardized mean difference effect sizes (Pustejovsky, Hedges, and Shadish (2014) <doi:10.3102/1076998614547577>) based on fitted lme or gls models.”
How Many Imputations Do You Need? {howManyImputations}
“When performing multiple imputations, while 5-10 imputations are sufficient for obtaining point estimates, a larger number of imputations are needed for proper standard error estimates. This package allows you to calculate how many imputations are needed, following the work of von Hippel (2020).”
Useful example here.
References
Von Hippel, P. T. (2020). How many imputations do you need? A two-stage calculation using a quadratic rule. Sociological Methods & Research, 49(3), 699-718.
QCA versus regression trees
I have been pondering the relationship between qualitative comparative analysis (QCA) and regression trees – and obviously I’m not the first to do so. Here’s an interesting blog post by Rick Davies (2012), which includes a reanalysis of a QCA using a decision tree.
There’s also a 2014 EES talk:
Surprisal!

S-values are a neat idea for helping to think about – maybe even feel – the meaning of p-values. They are described by Rafi and Greenland (2020). This post explains the basic idea, beginning with flips of a coin.
- Suppose you flip an apparently fair coin and the outcome is heads. How surprised would you feel?
- Now flip it twice: both outcomes are heads. How surprised would you feel now?
- Flip the coin 40 times. All of the outcomes are heads. How surprised are you now?
I suspect your level of surprise has gone from something like “meh” through to “surely this isn’t a fair coin?!”
S-values (the S is for surprisal) provide a way to think about p-values in terms of how likely it would be to get a sequence of all heads from a number of flips of a fair coin. That number of flips is the s-value and can be calculated from the p-value.
Here is an example of a coin flipped three times. There are \(2^3 = 8\) possible outcomes, listed in the table below:
| First coin flip | Second coin flip | Third coin flip |
|---|---|---|
| H | H | H |
| H | H | T |
| H | T | H |
| H | T | T |
| T | H | H |
| T | H | T |
| T | T | H |
| T | T | T |
If the coin is fair, then the probability of each of these outcomes is \(\frac{1}{8}\). In particular, the probability of all heads is also \(\frac{1}{8}\), or 0.125.
More generally, the probability of getting all heads from \(n\) fair coin flips is \(\frac{1}{2^n}\). Here is a table showing some examples:
| Flips | Probability all heads |
|---|---|
| 1 | 0.5 |
| 2 | 0.25 |
| 3 | 0.125 |
| 4 | 0.0625 |
| 5 | 0.03125 |
| 6 | 0.01562 |
| 7 | 0.00781 |
| 8 | 0.00391 |
| 9 | 0.00195 |
| 10 | 0.00098 |
Now here is the connection with p-values. Suppose you run a statistical test and get \(p = 0.03125\); that’s the same probability as that of obtaining five heads in a row from five coin tosses. The s-value is 5.
Or suppose you merely got \(p = 0.5\). That’s the probability of obtaining heads after one flip of the coin. The s-value is 1.
The larger the s-value, the more surprised you would be if the coin were fair.
To convert p-values to s-values, we want to find an \(s\), such that
\(\displaystyle \frac{1}{2^s} = p\).
The log function (base 2) does this for us:
\(\displaystyle s = -\log_2(p)\).
What about the traditional (or notorious?) 0.05 level?
\(-\log_2(0.05) = 4.32\),
to two decimal places. So, that’s the same as getting all heads when you flip a coin 4.32 times – which isn’t entirely intuitive when expressed as coin flips. But you could think of it being a little more surprising than getting four heads in a row if you flipped a fair coin four times.
References
Rafi, Z., Greenland, S. Semantic and cognitive tools to aid statistical science: replace confidence and significance by compatibility and surprise. BMC Med Res Methodol 20, 244 (2020).
Nice explanation of hazard ratios, by David Spiegelhalter
And the tool mentioned therein.
The interocular traumatic test
“The preceding paragraph illustrates a procedure that statisticians of all schools find important but elusive. It has been called the interocular traumatic test; you know what the data mean when the conclusion hits you between the eyes. The interocular traumatic test is simple, commands general agreement, and is often applicable; well-conducted experiments often come out that way. But the enthusiast’s interocular trauma may be the skeptic’s random error. A little arithmetic to verify the extent of the trauma can yield great peace of mind for little cost.” (Edwards, Lindman, & Savage, 1963, p.217, who attribute the “test” to J. Berkson, personal comm., 14 July 1958)
“Counterfactual” is not a synonym for “control group”
“Counterfactual” is not a synonym for “control group”. In fact, the treatment group’s actual outcomes are used when estimating the control group’s counterfactual outcomes, which is necessary to estimate the average treatment effect on control (ATC) or average treatment effect (ATE) estimands.
An individual’s treatment effect is defined as a within-person difference between the potential outcome following treatment and the potential outcome following control. This individual treatment effect is impossible to measure, since only one potential outcome is realised depending on which group the individual was in. However, various averages of the treatment effects can be estimated.
For ATC, we are interested in estimating averages of these treatment effects for control group participants. We know the control group’s actual outcomes. We also need to answer the counterfactual query:
If individuals in the control group had been assigned treatment, what would their average outcome have been?
To estimate ATC using matching, we need to find a treatment group match for each individual in the control group. Those treatment group matches are used to estimate the control group’s counterfactual outcomes.
For ATE, we are interested in estimating averages of these treatment effects for all participants. This means we need a combination of answers to the following counterfactual queries:
(a) If individuals in the treatment group had been assigned control, what would their average outcome have been?
(b) If individuals in the control group had been assigned treatment, what would their average outcome have been?
To estimate ATE using matching, each treatment individual needs a control group match and each control group individual needs a treatment group match. So, for ATE, both treatment and control groups could be considered counterfactuals, in the sense that they are both used to estimate the other group’s counterfactual outcomes. However, I think it is clearer if we draw a distinction between group (treatment or control) and what we are trying to estimate using data from a group (actual or counterfactual outcomes). It’s also possible to reason counterfactually without any comparison group; however, you need to make stronger assumptions.