# Compute standard error from beta, p-value, sample size, and the number of regression parameters

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?

• What does "beta" represent here? I'm guessing regression coefficients? – COOLSerdash Mar 27 '18 at 16:06
• Yes it does! Regression coefficients from a linear regression. – Abdel Mar 27 '18 at 16:06
• Then please edit your question and add this information. Short answer: No, you need the residual degrees of freedom (or sample size and number of regression parameters). Just the coefficient and the p-value is not enough. – COOLSerdash Mar 27 '18 at 16:08
• Thank you! I will edit the question, as I actually do have the sample size, just not in the file I was looking at :) Thank you! – Abdel Mar 27 '18 at 16:09
• As I said: The sample size alone is still not enough: You need to know how many variables were included in the regression models. – COOLSerdash Mar 27 '18 at 16:13

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 $p-1$, where $p$ is the number of parameters including the intercept. So the residual degrees of freedom are $(N-1)-(p-1) = N-p$.
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, p = 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