Stata 15 help for sampsi

sampsi continues to work but, as of Stata 13, is no longer an official part of Stata. This is the original help file, which we will no longer update, so some links may no longer work.

See [PSS] power for a recommended alternative to sampsi.

Title

[R] sampsi -- Sample size and power for means and proportions

Syntax

sampsi #1 #2 [, options]

options Description ------------------------------------------------------------------------- Main onesample one-sample test; default is two-sample sd1(#) standard deviation of sample 1 sd2(#) standard deviation of sample 2

Options alpha(#) significance level of test; default is alpha(0.05) power(#) power of test; default is power(0.90) n1(#) size of sample 1 n2(#) size of sample 2 ratio(#) ratio of sample sizes; default is ratio(1) pre(#) number of baseline measurements; default is pre(0) post(#) number of follow-up measurements; default is post(1) nocontinuity do not use continuity correction for two-sample test on proportions r0(#) correlation between baseline measurements; default is r0()=r1() r1(#) correlation between follow-up measurements r01(#) correlation between baseline and follow-up measurements onesided one-sided test; default is two-sided method(method) analysis method where method is post, change, ancova, or all; default is method(all) -------------------------------------------------------------------------

Menu

sampsi

Statistics > Power and sample size > Tests of means and proportions

sampsi with repeated measures

Statistics > Power and sample size > Tests of means with repeated measures

Description

sampsi estimates require sample size or power of tests for studies comparing two groups. sampsi can be used when comparing means or proportions for simple studies where only one measurement of the outcome is planned and for comparing mean summary statistics for more complex studies where repeated measurements of the outcome on each experimental unit are planned.

If n1(#) or n2(#) is specified, sampsi computes power; otherwise, it computes sample size. For simple studies, if sd1(#) or sd2(#) is specified, sampsi assumes a comparison of means; otherwise, it assumes a comparison of proportions. For repeated measurements, sd1(#), or sd2(#) must be specified. sampsi is an immediate command; all its arguments are numbers; see immed.

For simple studies, where only one measurement of the outcome is planned, sampsi computes sample size or power for four types of tests:

1. Two-sample comparison of means. The postulated values of the means are #1 and #2. The postulated standard deviations are sd1() and sd2().

2. One-sample comparison of mean with hypothesized value. Option onesample must be specified. The hypothesized value (null hypothesis) is #1. The postulated mean (alternative hypothesis) is #2. The postulated standard deviation is sd1().

3. Two-sample comparison of proportions. The postulated values of the proportions are #1 and #2.

4. One-sample comparison of proportion with hypothesized value. Option onesample must be specified. The hypothesized proportion (null hypothesis) is #1. The postulated proportion (alternative hypothesis) is #2.

Options

+------+ ----+ Main +-------------------------------------------------------------

onesample indicates a one-sample test. The default is two-sample.

sd1(#) and sd2(#) are the standard deviations of population 1 and population 2, respectively. One or both must be specified when doing a comparison of means. When the onesample option is used, sd1(#) is the standard deviation of the single sample (it can be abbreviated as sd(#)). If only one of sd1(#) or sd2(#) is specified, sampsi assumes that sd1() = sd2(). If neither sd1(#) nor sd2(#) is specified, sampsi assumes a test of proportions. For repeated measurements, sd1(#) or sd2(#) must be specified.

+---------+ ----+ Options +----------------------------------------------------------

alpha(#) is the significance level of the test. The default is alpha(0.05) unless set level has been used to reset the default significance level for confidence intervals. If a set level #-level command has been issued, the default value is alpha(1-level/100). See [R] level.

power(#) = 1 - b is the power of the test. The default is power(0.90).

n1(#) and n2(#) are the sizes of sample 1 and sample 2, respectively. One or both must be specified when computing power. If neither n1(#) nor n2(#) is specified, sampsi computes sample size. When the onesample option is used, n1(#) is the size of the single sample (it can be abbreviated as n(#)). If only one of n1(#) or n2(#) is specified, the unspecified one is computed using the formula ratio = n2()/n1().

ratio(#) is the ratio of sample sizes for two-sample tests: ratio() = n2()/n1(). The default is ratio(1).

pre(#) specifies the number of baseline measurements (prerandomization) planned in a repeated-measure study. The default is pre(0).

post(#) specifies the number of follow-up measurements (postrandomization) planned in a repeated-measure study. The default is post(1).

nocontinuity requests power and sample size calculations without continuity correction for two-sample test on proportions. If not specified, the continuity correction is used.

r0(#) specifies the correlation between baseline measurements in a repeated-measure study. If r0(#) is not specified, sampsi assumes that r0() = r1().

r1(#) specifies the correlation between follow-up measurements in a repeated-measure study. For a repeated-measure study, either r1(#) or r01(#) must be specified. If r1(#) is not specified, sampsi assumes that r1() = r01().

r01(#) specifies the correlation between baseline and follow-up measurements in a repeated-measure study. For a repeated-measure study, either r01(#) or r1(#) must be specified. If r01(#) is not specified, sampsi assumes that r01() = r1().

onesided indicates a one-sided test. The default is two-sided.

method(post|change|ancova|all) specifies the analysis method to be used with repeated measures. change and ancova can be used only if baseline measurements are planned. The default is method(all), which means to use all three methods.

Examples

1. Two-sample comparison of mean1 to mean2. Compute sample sizes with n2/n1 = 2:

. sampsi 132.86 127.44, p(0.8) r(2) sd1(15.34) sd2(18.23)

Compute power with n1 = n2, sd1 = sd2, and alpha = 0.01 one-sided:

. sampsi 5.6 6.1, n1(100) sd1(1.5) a(0.01) onesided

2. One-sample comparison of mean to hypothesized value = 180. Compute sample size:

. sampsi 180 211, sd(46) onesam

One-sample comparison of mean to hypothesized value = 0. Compute power:

. sampsi 0 -2.5, sd(4) n(25) onesam

3. Two-sample comparison of proportions. Compute sample size with n1 = n2 (that is, ratio = 1, the default) and power = 0.9 (the default):

. sampsi 0.25 0.4

Compute power with n1 = 500 and ratio = n2/n1 = 0.5:

. sampsi 0.25 0.4, n1(300) r(0.5)

4. One-sample comparison of proportion to hypothesized value = 0.5:

. sampsi 0.5 0.75, power(0.8) onesample

Compute power:

. sampsi 0.5 0.6, n(200) onesam

5. Repeated measures:

. sampsi 498 485, sd1(20.2) sd2(19.5) method(change) pre(1) post(3) r1(.7)

Compute power:

. sampsi 498 485, sd1(20.2) sd2(19.5) method(change) pre(1) post(3) r1(.7) n1(15) n2(15)

Stored results

sampsi stores the following in r():

Scalars r(N_1) sample size n_1 r(N_2) sample size n_2 r(power) power r(adj) adjustment to the SE r(warning) 0 if assumptions are satisfied and 1 otherwise


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