Obtain the CI from a p-value

From Doug Altman’s paper “How to obtain the confidence interval from a P value” BMJ 2011;343:d2090 Steps to calculate CI for a difference Est from p-value calculate the test statistic for a normal distribution test, z, from p:     calculate the standard error:     (ignoring minus signs) calculate the 95% CI:    …

Toy datasets with random NAs

Simulated (toy) datasets are very helpful to test data analysis tools and various other functions or transformations. For example, inserting random blanks (NAs) may allow testing imputation procedures. I have created a function to quickly insert NAs into a vector, that can be used across rows, columns, or on the whole data frame with one…

Power calculations

Underpowered studies are a big (but far from the only) source of the current replication crisis in the medical literature. Power calculations hinge on the expected effect size (often expressed as Cohen’s d), the populations’ spread around the mean (standard deviation) and arbitrary frequentist assumptions about alpha and beta. Cohen’s d is conceptually similar to…