Calculates the sample size for t-tests, including equivalence tests (R.W. Payne).
Options
PRINT = string token |
What to print (replication , power ); default repl , powe |
---|---|
NSAMPLES = scalar |
Number of samples for the t-test (1 or 2); default 2 |
PROBABILITY = scalar |
Significance level at which the response is to be tested; default 0.05 |
POWER = scalar |
The required power (i.e. probability of detection) of the test; default 0.9 |
TMETHOD = string token |
Type of test to be done (onesided , twosided , equivalance , noninferiority ); default ones |
RATIOREPLICATION = scalar |
Ratio of replication sample2:sample1 (i.e. the size of sample 2 should be RATIOREPLICATION times the size of sample 1); default 1 |
REPLICATION = variate |
Replication values for which to calculate and print or save the power; default * takes 11 replication values centred around the required number of replicates |
Parameters
RESPONSE = scalars |
Response to be detected |
---|---|
VAR1 = scalars |
Anticipated variance of sample 1 |
VAR2 = scalars |
Anticipated variance of sample 2; default * assumes the same variance as sample 1 |
NREPLICATES = scalars |
Saves the required number of replicates |
VREPLICATION = variates |
Numbers of replicates for which powers have been calculated |
VPOWER = variates |
Power (i.e. probability of detection) for the various numbers of replicates |
Description
STTEST
calculates the number of replicates (or sample size) required for various types of t-test. The calculations can be done for a one-sample t-test (testing for evidence that the mean of the sample differs from a specific value) or a two-sample test (testing that means of the samples are different). The number of samples is specified by the NSAMPLES
option (default 2).
The size of response that should be detectable is supplied by the RESPONSE
parameter. (This is difference between the sample mean of a one-sample test and the specific value, or the difference between the means of the two samples in a two-sample test.) The VAR1
parameter supplies the variance of the observations in the sample of a one-sample test or of the first sample of a two-sample test. If the second sample of a two-sample test has a different variance from the first sample, this can be supplied by the VAR2
parameter.
The significance level for the test is specified by the PROBABILITY
option (default 0.05 i.e. 5%). The required probability for detection of the response (that is, the power of the test) is specified by the POWER
option (default 0.9). It is generally assumed that the sizes of the samples in the two-sample test should be equal. However, you can set the RATIOREPLICATION
option to a scalar, R
say, to indicate that the size of the second sample should be R
times the size of the first sample. The NREPLICATES
parameter allows you to save the required size of the first sample.
By default, STTEST
assumes a one-sided t-test is to be used, but you can set option TMETHOD=twosided
to take a two-sided t-test instead. Other settings of TMETHOD
enable you to test for equivalence or for non-inferiority. To demonstrate equivalence of the two samples (TMETHOD=equivalence
), their means m1 and m2 must differ by less than some threshold d; this is specified by RESPONSE
and should represent a limit below which the difference can be assumed to have no physical (or clinical) importance. Statistically, equivalence implies comparing a null hypothesis that the samples are not equivalent, i.e.
(m1 – m2) ≤ –d
or
(m1 – m2) ≥ d
with the alternative hypothesis that they are equivalent, i.e.
–d < (m1 – m2) < d
A one-sample test for equivalence operates similarly, but here d specifies the threshold for the sample mean itself. To demonstrate non-inferiority of sample 1 compared to sample 2, the null hypothesis becomes
(m1 – m2) ≥ –d
(which, in fact, represents a simple one-sided t-test).
The PRINT
option controls printed output, with settings:
replication |
to print the required number of replicates in each sample (i.e. the size of each sample); |
---|---|
power |
to print a table giving the power (i.e. probability of detection) provided by a range of numbers of replicates. |
By default both are printed.
The replications and corresponding powers can also be saved, in variates, using the VREPLICATION
and VPOWER
parameters. The REPLICATION
option can specify the replication values for which to calculate and print or save the power; if this is not set, the default is to take 11 replication values centred around the required number of replicates.
Options: PRINT
, NSAMPLES
, PROBABILITY
, POWER
, TMETHOD
, RATIOREPLICATION
, REPLICATION
.
Parameters: RESPONSE
, VAR1
, VAR2
, NREPLICATES
, VREPLICATION
, VPOWER
.
Method
An approximate number of replicates is calculated initially assuming a Normal approximation. This is then refined by calculating powers for a range of replications centred around that approximation.
In the equivalence test, comparing the null hypothesis that the samples are not equivalent, i.e.
(m1 – m2) ≤ –d
or
(m1 – m2) ≥ d
with the alternative hypothesis that they are equivalent, i.e.
–d < (m1 – m2) < d
defines an intersection-union test, in which each component of the null hypothesis must be rejected separately. This implies performing two one-sided t-tests (this is known as a TOST procedure). If the significance level for the full test is to be α, each t-test must have significance level α (see Berger & Hsu 1996). To obtain a detection probability (or power) of (1 – β), each of the t-tests must have detection probabilities of (1 – β/2).
Reference
Berger, M.L. & Hsu, J.C. (1996). Bioequivalence trials, intersection-union tests and equivalence confidence sets. Statistical Science, 11, 283-319.
See also
Procedure: TTEST
.
Commands for: Design of experiments.
Example
CAPTION 'STTEST example',\ '1) One-sample test, required response 2, anticipated variance 3.';\ STYLE=meta,plain STTEST [PRINT=replication,power; NSAMPLES=1] 2; VAR1=3 CAPTION '2) Two-sample test, required response 2, anticipated variances 5.' STTEST [PRINT=replication,power] 2; VAR1=5 CAPTION !t('3) Two-sample test, required response 2,',\ 'anticipated variances 5 & 6.') STTEST [PRINT=replication,power] 2; VAR1=5; VAR2=6 CAPTION !t('4) Two-sample test, required response 2,',\ 'anticipated variance 5, sample sizes in a ratio 1:2.') STTEST [PRINT=replication,power; RATIOREPLICATION=2] 2; VAR1=5 CAPTION !t('5) Demonstrating equivalence with threshold 5,',\ 'anticipated variance 20, significance level 0.05, power 0.95.') STTEST [PRINT=replication,power; POWER=0.95;\ TMETHOD=equivalence] 5; VAR1=20 CAPTION !t('6) Demonstrating non-inferiority with threshold 4,',\ 'anticipated variance 20, significance level 0.05, power 0.90.') STTEST [PRINT=replication,power; TMETHOD=noninferiority] 4; VAR1=20