Calculates the sample size to obtain a specified precision (R.W. Payne).
Options
PRINT = string token |
What to print (replication , precision ); default repl , prec |
---|---|
NSAMPLES = scalar |
Number of samples (1 or 2); default 2 |
CIPROBABILITY = scalar |
Probability level for the confidence interval to indicate the precision; default 0.95 |
RATIOREPLICATION = scalar |
Ratio of replication sample2:sample1 (i.e. the size of sample 2 should have be RATIOREPLICATION times the size of sample 1); default 1 |
REPLICATION = variate |
Replication values for which to calculate and print or save the precision; default * takes 11 replication values centred around the required number of replicates |
Parameters
PRECISION = scalars |
Required precision |
---|---|
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 precisions have been calculated |
VPRDETECTION = variates |
Precision for the various numbers of replicates |
Description
SPRECISION
calculates the number of replicates (or sample size) required to estimate a sample mean, or the difference between the means of two samples to a specified precision. The number of samples is specified by the NSAMPLES
option (default 2). The precision is obtained by calculating a confidence interval around the sample mean or difference of means, and represents half the width of the interval. (The interval is generated by a t distribution, so this represents the distance of the mean or difference between means and the lower or the upper limits of the interval.) The probability level for the interval is specified by the CIPROBABILITY
option (default 0.95 i.e. 95%).
The required precision is supplied by the PRECISION
parameter. The variances of the first and second samples are supplied by the VAR1
and VAR2
parameters. VAR2
can be omitted if there is only one sample, or the two samples have equal variances. It is generally assumed that the second sample (if present) should be the same size as the first sample. 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.
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); |
---|---|
precision |
to print a table giving the precision provided by a range of numbers of replicates. |
By default both are printed.
The replications and corresponding detection probabilities in the table can also be saved, in variates, using the VREPLICATION
and VPRDETECTION
parameters. The REPLICATION
option can specify the replication values for which to calculate and print or save the probabilities of detection; if this is not set, the default is to take 11 replication values centred around the required number of replicates.
Options: PRINT
, NSAMPLES
, CIPROBABILITY
, RATIOREPLICATION
, REPLICATION
.
Parameters: PRECISION
, VAR1
, VAR2
, NREPLICATES
, VREPLICATION
, VPRECISION
.
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.
See also
Procedures: ADETECTION
, ASAMPLESIZE
.
Commands for: Design of experiments.
Example
CAPTION 'SPRECISION example',\ '1) One sample, required precision 2, anticipated variance 3.';\ STYLE=meta,plain SPRECISION [PRINT=replication,precision; NSAMPLES=1] 2; VAR1=3 CAPTION '2) Two samples, required precision 2, anticipated variances 5.' SPRECISION [PRINT=replication,precision] 2; VAR1=5 CAPTION !t('3) Two samples, required precision 2,',\ 'anticipated variances 5 & 6.') SPRECISION [PRINT=replication,precision] 2; VAR1=5; VAR2=6 CAPTION !t('4) Two samples, required precision 2,',\ 'anticipated variances 5, sample sizes in a ratio 1:2.') SPRECISION [PRINT=replication,precision; RATIOREPLICATION=2] 2; VAR1=5