# Power calculation for a coefficient in linear regression

Consider a simple linear regression of the form: $$Y \sim \beta_0 + \beta_1 X + \beta_2 Z + \epsilon$$

I have questions regarding calculation of power for $\beta_1$. To calculate power, I approached this via simulation and I did:

1. Simulate data with true $\beta$'s as: $\beta_0 = 0.5, \beta_1 = 1, \beta_2 = 2$
2. I also assumed $x \sim N(0,1)$ and $\epsilon \sim N(0, 0.1)$ and Z is binary variable
3. I put this data simulation into a loop and in each iteration, I fit a linear regression.
4. My understanding of power is that since we knew $\beta_1 \ne 0$, so power is rejecting the null hypothesis so in order to calculate power, it's enough to see how many times in our simulation we got a p.value less than 0.05 for $\beta_1$. Is that a correct way of calculating power?

Thanks very much for your help,

• That will tell you the power under the particular assumptions, sample size (unstated) and parameter values you've got there. If that's what you're interested in, it should be fine. If you want power in order to compute a sample size for a study, you'll be interested in the relationship between $n$ and power for some set of assumed $\beta_1$ values and $\sigma^2_\epsilon$ and so on. If you want to see for some fixed $n$ how power changes with $\beta_1$, you'll be doing that for a range of $\beta_1$ values and constructing a power curve. Oct 26, 2014 at 6:40
• If you turn this comment into an answer you'll be sure to have my upvote for it!
– Andy
Oct 26, 2014 at 8:02
• @Glen_b, thanks very much for your answer. Regarding the last part of your answer, suppose the true value of \beta_1 is 1 and in my simulations, it's estimated by average 0.5 and all of the times it was significantly different from 0. In this case, do I get power of 100% ? even though my estimates for \beta_1 were very different from the true value of 1.0 !
– Sam
Oct 27, 2014 at 0:22