title: Power calculations with two stage cluster sampling
body: <p>I am trying to do some power calculations in <code>R</code> for a survey experiment.</p>
  <p>I know how to do this using the <code>pwr</code> command. for instance, the following command shows that my optimal sample size to detect an effect size of 0.2, is having 394 respondents per group.</p>
  <pre><code>p.out &lt;- power.t.test(
    # sample size (leave blank!)
    n = ,
    # minimum detectable effect size
    delta = 0.2,
    # alpha and power (1-kappa)
    sig.level = 0.05, power = 0.8,
    alternative = &quot;two.sided&quot;
  )
  plot(p.out)
  
  </code></pre>
  <p>I would like to account for the fact that <strong>I have a two-stage cluster sampling strategy</strong>.
  For example, a set of 30 classrooms is selected, and then a random sample of ten students within each classroom is selected and interviewed. How can I account for this sampling variance in my power analysis?</p>
  <p>Note that this is <em>not</em> a scenario similar to <em>cluster randomised trial (CRT)</em>. Given the nature of survey experiments, treatment is not allocated at the group level, but rather at the unit level. In other words, every class will have randomly assigned treated and controlled students.</p>
  <p>Is there an easy and intuitive way to run a power analysis in this case? Maybe specifying some form of intraclass correlation?</p>
  <p>thanks a lot for your help</p>