SAS Code for Sample Size and Power Calculation in Two-Sample Comparisons

Slide Note
Embed
Share

SAS code snippets are provided for conducting power and sample size analyses in two-sample comparisons using the TWOSAMPLEMEANS statement. The code covers scenarios such as two-sample t-tests assuming equal variances, unbalanced designs, unequal variances, and more. Examples and syntax are included to demonstrate how to specify sample sizes and calculate power for different experimental setups.


Uploaded on Sep 15, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. SAS code for sample size/power calculation in two-sample comparisons

  2. Procedure : power The TWOSAMPLEMEANS statement performs power and sample size analyses for pooled and unpooled tests, equivalence tests, and confidence interval precision involving two independent samples.

  3. 1. Two-Sample t Test Assuming Equal Variances You can use the NPERGROUP= option in a balanced design and express effects in terms of the mean difference, as in the following statements. Default values for the DIST=, SIDES=, NULLDIFF=, and ALPHA= options specify a two-sided test for no difference with a normal distribution and a significance level of 0.05. proc power; twosamplemeans test=diff meandiff = 7 stddev = 12 npergroup = 50 power = .; run;

  4. proc power; twosamplemeans test=diff meandiff = 7 stddev = 12 npergroup = . power = 0.8; run;

  5. You can also specify an unbalanced design by using the NTOTAL= and GROUPWEIGHTS= options and express effects in terms of individual group means: proc power; twosamplemeans test=diff groupmeans = 8 | 15 stddev = 4 groupweights = (2 3) ntotal = . power = 0.9; run;

  6. Another way to specify the sample sizes is with the GROUPNS= option: proc power; twosamplemeans test=diff groupmeans = 8 | 15 stddev = 4 groupns = (25 40) power = .; run;

  7. 2. Two-Sample Satterthwaite t Test Assuming Unequal Variances The following statements demonstrate a power computation for the two-sample Satterthwaite t test allowing unequal variances. Default values for the DIST=, SIDES=,NULLDIFF=, and ALPHA= options specify a two-sided test for no difference with a normal distribution and a significance level of 0.05. proc power; twosamplemeans test=diff_satt meandiff = 3 groupstddevs = 5 | 8 groupweights = (1 2) ntotal = 60 power = .; run;

  8. Exercise data one; input y type @@; datalines; 65 1 81 1 57 1 66 1 82 1 82 1 67 1 59 1 75 1 70 1 run; procttest data=one; class type; var y; run; 64 2 71 2 83 2 59 2 65 2 56 2 69 2 74 2 82 2 79 2

  9. procpower; twosamplemeans test=diff meandiff = 2 stddev = 9.3155 npergroup = 10 power = .; run; procpower; twosamplemeans test=diff meandiff = 1 stddev = 9.3155 npergroup = . power = 0.9; run;

Related