[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Adrian Mander <Adrian.Mander@mrc-hnr.cam.ac.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: SSC new stuff |

Date |
Thu, 27 Oct 2005 13:41:17 +0100 |

Hi Kit,

I have written a new samplesize calculation for matched case/control studies.

called sampsi_mcc.

I have also had to embed this in my samplesize.ado file... Essentially I am trying to

write the whole of PASS2005 or encourage others to have a one stop shop for sample size and

power.

Anyway here are the files.

cheers

Ade

{smcl} {hline} help for {hi:samplesize} {hline} {title:Executes sample size/power calculations multiple times and produces graphical results} {p 8 22} {cmdab:samplesize} [, {opt null(numlist)} {opt alt(numlist)} {opt n1(numlist)} {opt n2(numlist)} {opt sd1(numlist)} {opt sd2(numlist)} {opt rho(numlist)} {opt a:lpha(numlist)} {opt p:ower(numlist)} {opt s:olve(string)} {opt r:atio(numlist)} {opt xvar(string)} {opt onesam:ple} {opt onesided} {opt me:thod(string)} {opt nocont:inuity} {opt pre(numlist)} {opt post(numlist)} {opt r0(numlist)} {opt r1(numlist)} {opt r01(numlist)} {opt sy(numlist)} {opt sx(numlist)} {opt yxcorr(numlist)} {opt var:method(string)} {opt command(string)} {opt m(numlist)} {opt phi(numlist)} {opt p0(numlist)} {help twoway_options } ] {p} {title:Description} {p 0 0} Most of STATA's sample size calculation programs do not allow {hi:numlists} for the options. {hi: samplesize} is designed to allow {hi:numlists} to do multiple calculations using various sample size commands. The resulting sample sizes or power calculations are then drawn using a {hi:twoway} graph. {p 0 0} At present the following commands are supported (more will be introduced): Help File Examples {help sampsi} {help samplesize##ttest:Two-sample t-test} {help sampsi_reg} {help samplesize##linreg:Linear regression } {help sampsi_mcc} {help samplesize##mcc:Matched Case-Control } {* help mvsampsi help samplesize##mv:Multivariate Regression } Please email me if you want the introduction of other sample size commands. {title:Updating this command} {p 0 0} To obtain the latest version click the following to uninstall the old version {p_end} {stata ssc uninstall samplesize} And click here to install the new version {stata ssc install samplesize} {title:Options} {p 0 0} {opt null(numlist)} specifies the "null value", #1 in {hi:sampsi}. {p 0 0} {opt alt(numlist)} specifies the "alternative value", #2 in {hi:sampsi}. {p 0 0} {opt n1(numlist)} size of sample 1. For {hi:sampsi_mcc} this is the number of cases. {p 0 0} {opt n2(numlist)} size of sample 2. {p 0 0} {opt sd1(numlist)} standard deviation of sample 1. {p 0 0} {opt sd2(numlist)} standard deviation of sample 2. {p 0 0} {opt a:lpha(numlist)} significance level of test; default is {hi:a(0.05)}. {p 0 0} {opt p:ower(numlist)} power of test; default is {hi:p(0.9)}. {p 0 0} {opt s:olve(string)} specifies whether to solve for the sample size or power; default is {hi:s(n)} solves for n and the only other choice is {hi:s(power)} solves for power. {p 0 0} {opt r:atio(numlist)} ratio of sample sizes; default is {hi:r(1)}. {p 0 0} {opt xvar(string)} specifies the variable to be used as the x-variable in the resulting plots. The default is the variable with the most values, this will work well for the majority of calculations. {p 0 0} {opt onesam:ple} one-sample test; default is two-sample. {p 0 0} {opt onesided} one-sided test; default is two-sided. {p 0 0} {opt m:ethod(string)} analysis method is {hi:post}, {hi:change}, {hi:ancova}; default is {hi:m(all)} although only {hi:ancova} will be plotted. {p 0 0} {opt nocont:inuity} do not use continuity correction for two-sample test on proportions. {p 0 0} {opt pre(numlist)} number of baseline measurements; default is {hi:pre(0)}. {p 0 0} {opt post(numlist)} number of follow-up measurements; default is {hi:post(1)}. {p 0 0} {opt r0(numlist)} correlation between baseline measurements; default is {hi:r0(0)}. {p 0 0} {opt r1(numlist)} correlation between follow-up measurements; default is {hi:r1(0)}. {p 0 0} {opt r01(numlist)} correlation between baseline and follow-up measurements; default is {hi:r01(0)}. {p 0 0} [{help sampsi_reg} option] {opt sy(numlist)} the standard deviation of the Y's. {p 0 0} [{help sampsi_reg} option] {opt sx(numlist)} the standard deviation of the X's. {p 0 0} [{help sampsi_reg} option] {opt yxcorr(numlist)} the correlation between Y's and X's. {p 0 0} [{help sampsi_reg} option] {opt var:method(string)} specifies the method for calculating the residual standard deviation. {opt varmethod(r)} uses the Y-X correlation and {opt varmethod(sdy)} uses the standard deviation of the Y's, the default uses a direct estimate of the residual sd {opt sd1(#)}. {p 0 0} [{help sampsi_mcc} option] {opt m(numlist)} specifies the number of matched controls per case; default is {hi:m(1)}. {p 0 0} [{help sampsi_mcc} option] {opt phi(numlist)} specifies the correlation of exposure between pairs of subjects in the case-control matched set; default is {hi:phi(0.2)}. {p 0 0} [{help sampsi_mcc} option] {opt p0(numlist)} specifies the probability of exposure in the controls; default is {hi:p0(0.5)}. {p 0 0} {opt command(string)} specifies the sample size command, the default is {hi:sampsi}. {title:Examples} {p 0 0} The full interactive version runs from a dialog box {stata db samplesize} (to be distributed in the near future) {marker ttest} {p 0 2} Two-sample comparison of mean1 to mean2. Compute sample sizes with n2/n1 = 2: {p_end} {p 2 2} {stata samplesize, null(132.86) alt(127.44) p(0.8) r(2(2)10) sd1(15.34) sd2(18.23)} {break} Compute power with n1 = n2, sd1 = sd2, and alpha = 0.01 one-sided: {break} {stata samplesize, null(5.6) alt(6.1) n1(100) sd1(1.5) a(0.01(0.01)0.05) onesided } {p 0 2} One-sample comparison of mean to hypothesized value = 180. Compute sample size: {p_end} {p 2 2} {stata samplesize, null(180) alt(211) sd(46(1)60) onesam } {break} One-sample comparison of mean to hypothesized value = 0. Compute power: {break} {stata samplesize, null(0) alt(-2.5) sd(4(0.2)5) n(25(10)55) onesam } {p 0 2} Two-sample comparison of proportions. Compute sample size with n1 = n2 (i.e., ratio = 1, the default) and power = 0.9 (the default): {p_end} {p 2 2} {stata samplesize, null(0.25) alt(0.4(0.01)0.6)} {break} Compute power with n1 = 500 and ratio = n2/n1 = 0.5: {break} {stata samplesize, null(0.25) alt(0.4) n1(300) r(0.5(0.1)0.9) } {p 0 2} One-sample comparison of proportion to hypothesized value = 0.5: {p_end} {p 2 2} {stata samplesize, null(0.5) alt(0.75) power(0.8(0.01)0.9) onesample } {break} Compute power: {break} {stata samplesize, null(0.5) alt(0.6) n1(200(10)400) onesam s(power)} {p 0 2} Repeated Measures {p_end} {p 2 2} {stata samplesize, null(498) alt(483(0.2)487) sd1(20.2) sd2(19.5) method(change) pre(1) post(3) r1(.1(.1).9) solve(n) } {break} Compute power: {break} {stata samplesize, null(498) alt(485) sd1(20.2) sd2(19.5) method(change) pre(1) post(1(1)10) r1(.7) n1(15) n2(15) solve(power)} {marker linreg} {p 0 2} Linear Regression {p_end} {p 2 2} {stata samplesize, null(0) alt(0.2(0.1)0.8) solve(n) command(sampsi_reg) } {break} Compute power: {break} {stata samplesize, null(0) alt(0.6(0.1)1.6) sx(0.5(0.2)1.5) solve(power) command(sampsi_reg)} {marker mcc} {p 0 2} Matched Case-control Study. {p_end} {p 2 2} {stata samplesize, alt(1.2(0.1)1.8) m(1(1)5) solve(n) command(sampsi_mcc) } {break} Compute power: {break} {stata samplesize, alt(1.2(0.1)3) phi(0.2(0.2)0.8) n1(100) solve(power) command(sampsi_mcc)} {title:Author} {p} Adrian Mander, MRC Human Nutrition Research, Cambridge, UK. Email {browse "mailto:adrian.mander@mrc-hnr.cam.ac.uk":adrian.mander@mrc-hnr.cam.ac.uk} {title:See Also} Related commands: {p 2 2} {help sampsi}, {help sampsi_reg} (if installed), {help sampsi_mcc} (if installed), {help sampclus} (if installed), {help xsampsi} (if installed), {help artmenu} (if installed), {help mvsampsi} (if installed), {help studysi} (if installed), {help sskapp} (if installed), {help ssizebi} (if installed), {help optfixn} (if installed), {help calcssi} (if installed), {help ggipower} (if installed), {help sampncti} (if installed).

**Attachment:
samplesize.ado**

{smcl} {hline} help for {hi:sampsi_mcc} {hline} {title:Calculates Sample Size or Power for Matched Case-Control Studies} {p 8 22} {cmdab:sampsi_mcc} [, {opt p0(#)} {opt alt(#)} {opt n1(#)} {opt m(#)} {opt phi(#)} {opt a:lpha(#)} {opt power(#)} {opt s:olve(string)} } ] {p} {title:Description} {p 0 0} {hi: sampsi_mcc} calculates the power and sample size for a matched case control study. The theory behind this command is described in Dupont (1988) Power Calculations for Matched Case-Control Studies, Biometrics. {p 0 0} The calculations require the usual alpha and beta values, a possible alternative odds ratio (the null is 1), phi the correlation of exposure between pairs in the case-control set (the default is 0.2) and the probability of exposure in the controls. {p 0 0} This command can be combined with {hi:samplesize} in order to look at multiple calculations and to plot the results. {title:Updating this command} {p 0 0} To obtain the latest version click the following to uninstall the old version {p_end} {stata ssc uninstall sampsi_mcc} And click here to install the new version {stata ssc install sampsi_mcc} {title:Options} {p 0 0} {opt p0(#)} specifies the exposure probability of controls; default is {hi:p0(0.5)}. {p 0 0} {opt alt(#)} specifies the "alternative OR". {p 0 0} {opt n1(#)} specifies the number of cases; default is {hi:n1(100)}. {p 0 0} {opt m(#)} specifies the number of matched controls per case; default is {hi:m(1)}. {p 0 0} {opt a:lpha(#)} significance level of test; default is {hi:a(0.05)}. {p 0 0} {opt power(#)} power of test; default is {hi:p(0.9)}. {p 0 0} {opt s:olve(string)} specifies whether to solve for the sample size or power; default is {hi:s(n)} solves for n and the only other choice is {hi:s(power)} solves for power. {p 0 0} {opt phi(#)} specifies the correlation of exposure between pairs in the case-control set. The paper recommends the default value {hi:0.2} when it is unknown. {title:Examples} {p 0 0} Calculate power for a two-sided test: {p_end} {p 2 2} {stata sampsi_mcc, p0(0.5) alt(1.5) n(100) s(power)} {p 0 0} Compute sample size: {p 2 2} {stata sampsi_mcc, p0(0.5) alt(1.5) s(n)} {p 0 0} Re-calculate the above values for 5 matched controls rather than 1: {p_end} {p 2 2} {stata sampsi_mcc, p0(0.5) alt(1.5) n(100) s(power) m(5)} {p 0 0} Compute sample size: {p 2 2} {stata sampsi_mcc, p0(0.5) alt(1.5) s(n) m(5)} {title:Author} {p} Adrian Mander, MRC Human Nutrition Research, Cambridge, UK. Email {browse "mailto:adrian.mander@mrc-hnr.cam.ac.uk":adrian.mander@mrc-hnr.cam.ac.uk} {title:See Also} Related commands: {p 2 2} {help sampsi}, {help samplesize} (if installed), {help sampclus} (if installed), {help xsampsi} (if installed), {help artmenu} (if installed)

**Attachment:
sampsi_mcc.ado**

**References**:**st: SSC Archive program requirements***From:*Kit Baum <baum@bc.edu>

- Prev by Date:
**Re: st: Macros and dummy variables** - Next by Date:
**st: Y axis values for hist ,density** - Previous by thread:
**st: SSC Archive program requirements** - Next by thread:
**st: command line text right-justified** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |