BookmarkSubscribeRSS Feed
saszyc
Calcite | Level 5

In SAS proc power, there is an example for Determining Required Sample Size for a Two-Sample t Test.

Here is the original code from SAS

proc power;

   twosamplemeans

      groupmeans   = (13 14) (13 14.5) (13 15)

      stddev       = 1.2 1.7

      groupweights = 1 | 1 2 3

      power        = 0.9

      ntotal       = .;

run;

I calculate the sample size by using formula, the result is always smaller the one obtained from SAS output.

For example, the first sample size I got is 60.466176 but SAS got 62.507429. Basically,  the fractional n total from SAS is always bigger then the one I calculated based on the common formula which is

n=4*stddev^2*(1.96+1.28)^2/(14-13). I want to know how SAS compute the sample size and base on what formula. I hope someone can help me to find it out. Thanks.

2 REPLIES 2
Reeza
Super User

The documentation has a good description:

SAS/STAT(R) 9.2 User's Guide, Second Edition

Proc Power>Details>Computational Methods and Formulas>Two Sample Means

The results from proc power are the total sample size for both groups that match the results from a web calculator as well:

Power/Sample Size Calculator

Your formula: 60.444

SAS : 64

UBC Calc: 62

All seem within the same ballpark, though not exactly the same. 

SteveDenham
Jade | Level 19

One thing to note is that you used the z distribution values (1.96, 1.28) in your calculation.  Use of the t distribution values will result in the more conservative number obtained by SAS.  Note that this is iterative, starting with the asymptotic normals, getting an estimate of sample size, calculating degrees of freedom and then obtaining t distribution values.  (At least I think that is the explanation).

Steve Denham

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 967 views
  • 0 likes
  • 3 in conversation