Skip to content
Prev 2098 / 5632 Next

[R-meta] getting standard errors from p-values

Hi Norman,

I am assuming we are talking about regular regression here.

The sample size is equal to the df plus the number of coefficients in the model (also counting the intercept). You can then recover the SE of the slope (regression coefficient) from the p-value and the slope. Here is an illustration:

set.seed(1234)
n <- 100
x1 <- runif(n)
x2 <- runif(n)
y  <- 0.1 * x1 + 0.2 * x2 + rnorm(n)

res <- coef(summary(lm(y ~ x1 + x2)))
res

b <- res[2,1]
b

p <- res[2,4]
p

# all you know is b, p, and the df (= n-3 in this example)
# this gives the SE of the slope for x1

abs(b) / qt(p/2, df=n-3, lower.tail=FALSE)

If b and/or p are rounded, then this will introduce some error into the back-calculation. I wouldn't worry about this unless p is given not as an 'exact' value, but for example as 'p < .05' or something like that.

Best,
Wolfgang