Programming the statistical procedures from SAS

Sample size calculations with SAS

Reply
Regular Contributor
Posts: 180

Sample size calculations with SAS

Hello everyone,

I would like to ask for your advise regarding sample size calculations using SAS (either with the power and sample size module or directly with code).

It is very simple calculating a sample size using the well known "t-test" scenario, and both SAS and other packages support this calculation, which is straightforward even manually.

What I want to do, is to calculate the required sample size for a trial with random effects. For example, random effects can be a multi-center effect, a repeated measures effect, or any other random effect. A trial can even have more than one random effect. My intuition say, that the more variance components I add to my model, the more samples I will need. I tried looking online for a solution but so far failed. Can I use SAS to calculate sample size for trials which will be analyzed with a mixed model (either with mixed proc or glimmix proc) ?

(Let's assume for now that my response is continuous just to make it more simple)

Thank you very much !

Respected Advisor
Posts: 2,655

Re: Sample size calculations with SAS

It is not simple, but the only practical way that I can think of to do this is through simulation.  The hard part is correctly simulating data.  The random factors and covariance structure are going to be critical.  Once you generate a good dataset, then it is a matter of doing the analysis, and recording the type II error rate for a preselected number of simulations.  Then change the sample size, and repeat.  Repeat this process until you can get enough results to narrow in on the sample size needed to control type II error at a given type I error rate.

I would suggest a google search on simulating clinical data for calculation of sample size.  There are probably some macros out there that will help.  If you do not have IML licensed, I strongly recommend that you get it, as developing correctly specified datasets through data steps is exceedingly difficult.

Steve Denham

SAS Super FREQ
Posts: 3,546

Re: Sample size calculations with SAS

I agree with Steve: simulation is the way to go.  In my forthcoming book, Simulating Data with SAS, I have  examples of power and sample size analysis and simulation of mixed models and repeated measures. Unfortunately, the book is currently undergoing a copyedit and won't be published until Q2 of 2013.

Valued Guide
Valued Guide
Posts: 684

Re: Sample size calculations with SAS

Here is another example where the wonderful new book by Walter Stroup is essential -- Generalized Linear Mixed Models: Modern Concepts, Methods and Applications (CRC Press, 2012). Chapter 16 is all about power and sample sizes for mixed models (multiple random effects, etc.). There are too many things to cover here, but Stroup gives detailed instructions on how to do what you want. Although simulation is useful, of course, you can do several things without simulation by using GLIMMIX or MIXED (coupled with the PARMS statement and HOLD option). By the way, Stroup is one of the authors of the classic: SAS for Mixed Models, 2nd edition (SAS Publ.).

For immediate access, check out the 2011 SAS Global Forum article by Stroup:

http://support.sas.com/resources/papers/proceedings11/349-2011.pdf

He goes through a LITTLE of the sample size and power calculations for mixed models. As he correctly points out, not properly taking account of the random effects can lead to meaningless results.

Respected Advisor
Posts: 2,655

Re: Sample size calculations with SAS

Holy cat.  I had forgotten all about Walt's method (and had even used it a couple of times)..  The Litmus Test design in the paper really helps me with a problem analysis we have had--and makes me think hard about using R side covariance structures when G-side may be a better approach.

Steve Denham

Regular Contributor
Posts: 180

Re: Sample size calculations with SAS

Thank you all for replying quickly.

Simulation sounds like an interesting way...

Rick, I am looking forward for having your book, already singed up on the SAS website and will get a notice when it's up for sale.

I have heard about the book of Walter Stroup, and for some weeks now I am thinking of buying it. If the book actually present an easier way of evaluation sample size, then it's another reason to get this book on my shelf.

Thanks everyone, your comments are very helpful and very appreciated !

Ask a Question
Discussion stats
  • 5 replies
  • 941 views
  • 0 likes
  • 4 in conversation