BookmarkSubscribeRSS Feed
Lapis Lazuli | Level 10

Hi everyone,

any suggestion for how to do sample size calculation for a crossover 3x3 design?

Kind regards


Diamond | Level 26

PROC GLMPOWER ought to be able to figure out what sample size you need.


Here is an example somewhat similar to your experiment in the PROC GLMPOWER documentation

Paige Miller
Lapis Lazuli | Level 10

Thank you @PaigeMiller

I am still struggling to do the power calculation after 2 days working with this 😞

Could you or anyone else please help further? Any suggestions of the SAS code or an example online dealing with a similar problem? I couldn't really use the example you mentioned above

 Here is what I am thinking of: The means after the treatments (A, B, C) are presented in a data table:



















Assuming a SD 10 and alpha 0.05 and needed power of 0.8 and a correlation of 0,6, what would the code be to calculate sample size? or how do i modify the code in the suggested webpage by @PaigeMiller to solve this sample size problem?


Very much appreciated


Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

A crossover is a mixed model of some complexity, and I don't think any of the power analysis PROCs address it directly.


I'll point you to this SAS Community thread. Basically, there are two approaches: simulation and a nice trick discussed by Walt Stroup in his texts and papers. Here's a more recent paper by Walt.


This thread is a few years old, and Rick Wicklin's book on simulation is now published. 


With either approach, once you've done the power analysis, you now have code already written for the analysis of actual data. Sweet.


I hope this helps.


Lapis Lazuli | Level 10

Thanks @sld

I am really still struggling with this. i am not an expert at simulation so I tried a different approach but the results dont make sense:


data Study;
   input Treatment $ Group $ VAS CellWgt;
         Placebo      Group1      131       1
         Placebo      Group2      131       1
         Placebo      Group3      131       1
         Drug1       Group1      161       1
         Drug1       Group2      161       1
         Drug1       Group3      161       1
         Drug2       Group1      204       1
         Drug2       Group2      204       1
         Drug2       Group3      204       1

proc glmpower data=Study;
   class Treatment Group;
   model VAS = Treatment Group;
   weight CellWgt;
   contrast "Drug2 vs. others" 	Treatment  -1 -1 2;
   contrast "Drug1 vs. others" 	Treatment  -1 2 -1;
   contrast "Placebo vs. Drug2" Treatment   1  0 -1;
   contrast "Placebo vs. Drug1" Treatment   1 -1  0;
   contrast "Drug1 vs. Drug2"   Treatment   0  1  -1;
      stddev      = 67
      ncovariates = 1
      corrxy      = 0.8
      alpha       = 0.017
      ntotal      = .
      power       = 0.8;

Could anyone please give me help with this? I know everyone has a million things to do but if someone has time to suggest a working code or show me how to do it with simulation i would eternally appreciate it. 

Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

Your code generates a warning (in the log) and odd results because you have specified Group as a fixed effects factor in the model, and in the data step you have specified Group effects of exactly zero. If effects of Group were instead nonzero, then the code would run. But this code is for a two-way factorial (without interaction) in a completely randomized design, and you intend your design to be a crossover.


Replication in a crossover design can take different forms. For example, subjects could be blocked in sets of 3 ("squares"), or subjects could be independent (i.e., not clustered or blocked). Your power analysis needs to mimic your intended design. How do you envision doing replication in your study?


Once you know how you plan to replicate (and need only to figure out how many replications), then it may be helpful to write the code (which I will call the "data analysis code") for the experimental design that you anticipate. You can then compare the model in your data analysis code to the model in your power analysis code: if the models do not match, then you need a different power analysis specification.


You most likely will not be able to do power analysis for a crossover design with GLMPOWER because a crossover design is fundamentally a mixed model, and GLMPOWER does not accommodate mixed models. In the SAS Community thread that I linked to in my previous message, pay particular attention to the response by lvm who references a text and a paper by Walt Stroup; I referenced a second paper in my previous message in this thread. You also could study Ch 12 in Stroup's approach takes advantage of the ability to hold variance parameters constant (PARMS ... / HOLD) and does not require simulation of data. It is the approach that I use to estimate sample size for a mixed model.


I hope this helps.


 Edit: Note also that your CONTRAST statements are incorrect. By default, the order of levels for Treatment is alphabetical: Drug1, Drug2, Placebo. Your coefficients need to match the order of levels.



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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1 like
  • 3 in conversation