I am planning to run a regression for the model of the form:

$y = \beta_0 + \beta_1x_1 + \beta_2x_2 + \beta_3x_1x_2 + \epsilon$

To determine the necessary sample size, I would usually use R's pwr.f2.test that has the parameters denominator degrees of freedom, numerator degrees of freedom, significance level, power and Cohen's f2 effect size.

However, my data will have multiple observations per individual. Let's say I have $n$ individuals, each with $k$ observations, so in total I have $n*k$ observations. I am planning to compute cluster-robust standard errors to account for the $n$ clusters. I am unsure what this means in terms of degrees of freedom. The literature, e.g. here, seems to suggest that the degrees of freedom are $n - 1$, but I am not sure about this.

So: How do I calculate sample size for a cluster-robust regression with power of 0.8 and significance level of 0.05 and three regression parameters?

EDIT regarding first response:

As I can determine the $k$ myself, there are no singleton clusters.


1 Answer 1


I would build a spreadsheet model around the equation and the experimental design:

$y = \beta_0 + \beta_1x_1 + \beta_2x_2 + \beta_3x_1x_2 + e $

where all the betas are known and the error term is sampled from a Normal random deviate with known mean of zero and a select value for the variance. Also, add singleton groups in linear regression model based on a design where fixed effects are nested within clusters.

Feed simulated data into the model and determine the effect of, for example, changing 'n'.

See also, if you can verify per this work,'Singletons, Cluster-Robust Standard Errors and Fixed Effects: A Bad Mix' that statistical significance could be overstated and produce incorrect inference.

Note also the author's statement:

The singleton problem can be easily dealt with by either removing singleton groups, or keeping them while excluding their count from the number of clusters 𝑀 and observations 𝑁. Solving the more general problem is an open question.

  • $\begingroup$ Thanks - yes, a simulation of the model was also something I had in mind. I edited my response also in response to your remark on singleton groups. $\endgroup$
    – broti
    Apr 18, 2020 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.