BookmarkSubscribeRSS Feed
Wafflecakes
Calcite | Level 5

Hello,

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.

 

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.

 

In their paper, they provide the following code:

 

data pvalue; set _NULL_; %do mm = 1 %to &n_sim;

do cluster_id = 1 to tot_cluster; do period_id = 1 to tot_period;

data one;

seed=0;

var_y = &sd_y*&sd_y;

var_3 = &rho2*var_y;

var_2 = (&rho1-&rho2)*var_y;

var_e = var_y - var_3 - var_2;

tot_cluster = &c*&S;

tot_period = &b+&p*&S;

u_3 = rannor(seed)*sqrt(var_3);

step = ceil(cluster_id/&c);

u_2 = rannor(seed)*sqrt(var_2);

trt = 1*(period_id > &b+&p*(&S-step));

do sub_id = 1 to &K;

end;

 

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?

 

Many thanks,

 
 
1 REPLY 1
Rick_SAS
SAS Super FREQ

The paper "Ten Tips for Simulating Data with SAS" (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 Simulating Data with SAS.(Wicklin, 2013)

 

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).

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 445 views
  • 0 likes
  • 2 in conversation