1. Home
2. DSTTEST procedure

# DSTTEST procedure

Plots power and significance for t-tests, including equivalence tests (R.W. Payne).

### Options

`NSAMPLES` = scalar Number of samples for the t-test (1 or 2); default 2 Significance level at which the response is to be tested; default 0.05 Type of test to be done (`onesided`, `twosided`, `equivalence`, `noninferiority`); default `ones` Ratio of replication sample2:sample1 (i.e. the size of sample 2 should be `RATIOREPLICATION` times the size of sample 1); default 1

### Parameters

`RESPONSE` = scalars Response to be detected Anticipated variance of sample 1 Anticipated variance of sample 2; default `*` assumes the same variance as sample 1 Number of replicates Number of residual degrees of freedom; default `*` calculates these automatically, assuming a standard t-test

### Description

`DSTTEST` produces a plot showing the probability distributions for the null and alternative hypotheses for various types of t-test. This is a companion procedure to `STTEST`, which calculates sample sizes for t-tests. The area of the distribution for the null hypothesis, in the critical region (where the null hypothesis would be rejected), is coloured in red. Its size corresponds to the significance level of the t-test, which is set by the `PROBABILITY` option (default 0.05). The area of the distribution for the alternative hypothesis in the critical region is coloured in dark blue, unless it overlaps the red colour of the null hypothesis. The size of the dark blue area (including that overlapped by red) corresponds to the power of the test. The area of the distribution for the alternative hypothesis in the non-critical region (where the null hypothesis would still be accepted) is coloured in light blue.

The plots can be done for either 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 to be detected 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 `NREPLICATES` parameter specifies the size of the first sample. By default, it is assumed that the sizes of the samples in the two-sample test are equal. However, you can set the `RATIOREPLICATION` option to a scalar, `R` say, to indicate that the size of the second sample is `R` times the size of the first sample.

By default, `DSTTEST` 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.

(m1m2) ≤ –d

or

(m1m2) ≥ d

with the alternative hypothesis that they are equivalent, i.e.

d < (m1m2) < 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

(m1m2) ≥ –d

(which, in fact, represents a simple one-sided t-test). See `STTEST` for further details.

Options: `NSAMPLES`, `PROBABILITY`, `TMETHOD`, `RATIOREPLICATION`.

Parameters: `RESPONSE`, `VAR1`, `VAR2`, `NREPLICATES`, `RDF`.

Procedure: `STTEST`, `TTEST`.

Commands for: Design of experiments.

### Example

```CAPTION 'DSTTEST examples',!t('1) One-sided one-sample test,',\
'required response 2, anticipated variance 3.');\
STYLE=meta,plain
STTEST  [PRINT=replication,power; NSAMPLES=1] 2; VAR1=3; NREPLICATES=nrep
DSTTEST [NSAMPLES=1] 2; VAR1=3; NREPLICATES=nrep
CAPTION !t('2) Two-sided two-sample test, required response 2,',\
'anticipated variance 5, sample sizes in a ratio 1:2.')
STTEST  [PRINT=replication,power; TMETHOD=twosided; RATIOREPLICATION=2]\
2; VAR1=5; NREP=nrep
DSTTEST [TMETHOD=twosided; RATIOREPLICATION=2] 2; VAR1=5; NREP=nrep
CAPTION !t('3) 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; NREPLICATES=nrep
DSTTEST [TMETHOD=equivalence] 5; VAR1=20; NREPLICATES=nrep
CAPTION !t('4) Demonstrating non-inferiority with threshold 4,',\
'anticipated variance 20, significance level 0.05, power 0.90.')
STTEST  [PRINT=replication,power; TMETH=noninferiority] 4; VAR1=20; NREP=nrep
DSTTEST [TMETH=noninferiority] 4; VAR1=20; NREP=nrep
```
Updated on March 8, 2019