<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Sample size calculation for stepped wedge via simulation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sample-size-calculation-for-stepped-wedge-via-simulation/m-p/590002#M168819</link>
    <description>&lt;P&gt;The paper &lt;A href="https://support.sas.com/resources/papers/proceedings15/SAS1387-2015.pdf" target="_self"&gt;"Ten Tips for Simulating Data with SAS"&lt;/A&gt;&amp;nbsp;(Wicklin, 2015) is a good place to start if you are doing simple simulations. The definitive reference for complex Monte Carlo simulations in SAS is &lt;A href="https://support.sas.com/en/books/authors/rick-wicklin.html" target="_self"&gt;&lt;EM&gt;Simulating Data with SAS.(Wicklin, 2013)&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You didn't provide a link to the paper, and I have not read it, but I think the authors are simply providing a way of standardizing the problem. They are using the correlation between variables to relate the variance of u3 and u2 to the variance of Y. If the variance of Y is known, they are setting the variance of u3 to rho2*Var(Y) and the variance of u2 to (rho1-rho2)*Var(Y). In essence, they are declaring that the parameters in the problem are rho1 and rho2, rather than using the three-parameter formulation in terms of Var(Y), Var(U2) and Var(U3).&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2019 12:49:33 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2019-09-19T12:49:33Z</dc:date>
    <item>
      <title>Sample size calculation for stepped wedge via simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sample-size-calculation-for-stepped-wedge-via-simulation/m-p/589870#M168768</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am trying to do a simulation analysis to calculate the sample size for a stepped-wedged randomized control trial. The trial is designed such that there are repeated measures (Level 1) of individuals (Level 2) that are nested in clusters (Level 3). I have already defined the number of steps, step length, etc., and I have a number of different input parameters that I want to test (i.e. different numbers of clusters, ICC, and cluster size), but I was wondering if anybody has any experience or reference papers that they can share on how to properly generate the artificial data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The following paper by Heo et al. 2018 is also a three-level model: Sample size determinations for stepped-wedge clinical trials from a three-level data hierarchy perspective.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In their paper, they provide the following code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="page"&gt;&lt;DIV class="layoutArea"&gt;&lt;DIV class="column"&gt;&lt;P&gt;&lt;SPAN&gt;data pvalue; set _NULL_; &lt;/SPAN&gt;&lt;SPAN&gt;%do &lt;/SPAN&gt;&lt;SPAN&gt;mm = &lt;/SPAN&gt;&lt;SPAN&gt;1 &lt;/SPAN&gt;&lt;SPAN&gt;%to &lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;n_sim; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;do cluster_id = &lt;/SPAN&gt;&lt;SPAN&gt;1 &lt;/SPAN&gt;&lt;SPAN&gt;to tot_cluster; do period_id = &lt;/SPAN&gt;&lt;SPAN&gt;1 &lt;/SPAN&gt;&lt;SPAN&gt;to tot_period; &lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="layoutArea"&gt;&lt;DIV class="column"&gt;&lt;P&gt;&lt;SPAN&gt;data one; &lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="layoutArea"&gt;&lt;DIV class="column"&gt;&lt;P&gt;&lt;SPAN&gt;seed=&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eaeaea; white-space: pre;"&gt;var_y = &amp;amp;sd_y*&amp;amp;sd_y;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eaeaea; white-space: pre;"&gt;var_3 = &amp;amp;rho2*var_y;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eaeaea; white-space: pre;"&gt;var_2 = (&amp;amp;rho1-&amp;amp;rho2)*var_y;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eaeaea; white-space: pre;"&gt;var_e = var_y - var_3 - var_2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eaeaea; white-space: pre;"&gt;tot_cluster = &amp;amp;c*&amp;amp;S;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eaeaea; white-space: pre;"&gt;tot_period = &amp;amp;b+&amp;amp;p*&amp;amp;S;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eaeaea; white-space: pre;"&gt;u_3 = rannor(seed)*sqrt(var_3);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eaeaea; white-space: pre;"&gt;step = ceil(cluster_id/&amp;amp;c);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eaeaea; white-space: pre;"&gt;u_2 = rannor(seed)*sqrt(var_2);&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="layoutArea"&gt;&lt;DIV class="column"&gt;&lt;P&gt;&lt;SPAN&gt;trt = &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;*(period_id &amp;gt; &amp;amp;b+&amp;amp;p*(&amp;amp;S-step));&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="page"&gt;&lt;DIV class="layoutArea"&gt;&lt;DIV class="column"&gt;&lt;P&gt;&lt;SPAN&gt;do sub_id = &lt;/SPAN&gt;&lt;SPAN&gt;1 &lt;/SPAN&gt;&lt;SPAN&gt;to &amp;amp;K; &lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="layoutArea"&gt;&lt;DIV class="column"&gt;&lt;P&gt;&lt;SPAN&gt;end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To help me simulate my own data, can anyone with explain how all the variances terms are calculated (assuming sd =standard deviation, and rho1/2 = level 1 and 2 correlation (i.e. the intraclass correlation))? Additionally, for the random effects terms (u_3, u_2), why did they multiply rannor(seed) by the standard deviation?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Many thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="layoutArea"&gt;&lt;DIV class="column"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="layoutArea"&gt;&lt;DIV class="column"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 19 Sep 2019 00:46:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sample-size-calculation-for-stepped-wedge-via-simulation/m-p/589870#M168768</guid>
      <dc:creator>Wafflecakes</dc:creator>
      <dc:date>2019-09-19T00:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Sample size calculation for stepped wedge via simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sample-size-calculation-for-stepped-wedge-via-simulation/m-p/590002#M168819</link>
      <description>&lt;P&gt;The paper &lt;A href="https://support.sas.com/resources/papers/proceedings15/SAS1387-2015.pdf" target="_self"&gt;"Ten Tips for Simulating Data with SAS"&lt;/A&gt;&amp;nbsp;(Wicklin, 2015) is a good place to start if you are doing simple simulations. The definitive reference for complex Monte Carlo simulations in SAS is &lt;A href="https://support.sas.com/en/books/authors/rick-wicklin.html" target="_self"&gt;&lt;EM&gt;Simulating Data with SAS.(Wicklin, 2013)&lt;/EM&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You didn't provide a link to the paper, and I have not read it, but I think the authors are simply providing a way of standardizing the problem. They are using the correlation between variables to relate the variance of u3 and u2 to the variance of Y. If the variance of Y is known, they are setting the variance of u3 to rho2*Var(Y) and the variance of u2 to (rho1-rho2)*Var(Y). In essence, they are declaring that the parameters in the problem are rho1 and rho2, rather than using the three-parameter formulation in terms of Var(Y), Var(U2) and Var(U3).&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 12:49:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sample-size-calculation-for-stepped-wedge-via-simulation/m-p/590002#M168819</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-09-19T12:49:33Z</dc:date>
    </item>
  </channel>
</rss>

