7

How do I compute the standard error if I only know the p-value, the beta (i.e., the regression coefficient from a linear regression), the sample size, and the number of regression parameters?

Abdel
  • 113

1 Answers1

11

In a linear regression, the $p$-value is calculated from a $t$-value, which is the coefficient divided by its standard error ($t=\hat{\beta}/\mathrm{SE}_{\hat{\beta}}$). The degrees of freedom used in the $t$-distribution for calculating the $p$-value are the residual degrees of freedom ($\mathrm{SE}_{\hat{\beta}}=\hat{\beta}/|t|$). The residual degrees of freedom, on the other hand are the total degrees of freedom of the variance $N-1$ minus the model degrees of freedom $k-1$, where $k$ is the number of parameters including the intercept. So the residual degrees of freedom are $(N-1)-(k-1) = N-k$.

From this, you can use the quantile distribution of the $t$-distribution to calculate the standard error. Example: Assume that $\hat{\beta}=5.47, p = 0.004, N = 100, k = 4$. The residual degrees of freedom are $100-4 = 96$. We assume that the $p$-value is two-sided.

Using R, the calculations are:

t_val <- qt(0.004/2, df = 96) # Calculating the t-value using quantile function
5.47/abs(t_val) # Calculating standard error
1.854659

So the standard error was 1.85.

COOLSerdash
  • 30,198
  • Does this also work for t-tests? – Papayapap Nov 08 '21 at 09:17
  • 1
    @Papayapap Sure, because $t$-tests are nothing else as regression models with categorical predictors. For a two-sample $t$-test, the predictor is binary and for the one-sample/paired $t$-test there is only an intercept. – COOLSerdash Nov 08 '21 at 09:26