Hello!
I want to calculate sample size per group (or total) for difference in Median. So i have information what diff in median i expect (effect) and estimated SD, want 90% power and alpha=0.05. How can i calculate sample size in SAS for this?
Thank you
Hello @VioletaB,
If you have two independent samples with a location shift between their (otherwise ideally equal) distributions, I would suggest the TWOSAMPLEWILCOXON statement of PROC POWER. Note, however, that the expected median difference and estimated standard deviation (together with power and significance level) do not provide sufficient information for the sample size calculation. Sample size for the Wilcoxon rank-sum test also depends on the shape of the distribution. This is why there is the VARDIST option where you need to specify the distributions of the two samples.
Example: Normal distributions with SD=1.2, shifted by |m1−m2|=1
proc power;
twosamplewilcoxon
vardist('Group 1')=normal(0, 1.2)
vardist('Group 2')=normal(1, 1.2)
variables = 'Group 1' | 'Group 2'
sides = 2
alpha = 0.05
power = 0.85
npergroup = .;
run;
Result: n=28 per group.
With the more heavy-tailed Laplace distribution
vardist('Group 1')=laplace(0, 0.848528)
vardist('Group 2')=laplace(1, 0.848528)
the result is only n=21 per group, although the median difference and standard deviation (sqrt(2)*0.848528...=1.2) are the same as for the normal distributions above.
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.
Ready to level-up your skills? Choose your own adventure.