Calculates the sample size to obtain a specified precision (R.W. Payne).
|What to print (
||Number of samples (1 or 2); default 2|
||Probability level for the confidence interval to indicate the precision; default 0.95|
||Ratio of replication sample2:sample1 (i.e. the size of sample 2 should have be
||Replication values for which to calculate and print or save the precision; default
||Anticipated variance of sample 1|
||Anticipated variance of sample 2; default
||Saves the required number of replicates|
||Numbers of replicates for which precisions have been calculated|
||Precision for the various numbers of replicates|
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
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 lets you save the required size of the first sample.
||to print the required number of replicates in each sample (i.e. the size of each sample);|
||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
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.
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.
Commands for: Design of experiments.
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