1. Home
  2. SIGNTEST procedure

SIGNTEST procedure

Performs a one or two sample sign test (E. Stephens & P.W. Goedhart).

Options

PRINT = string token Whether to print the test statistic with the associated probability and sample size (test); default test
METHOD = string token Type of test (twosided, greaterthan, lessthan); default twos
GROUPS = factor Defines the groups for a two-sample test if only the Y1 parameter is specified
NULL = scalar Median value or difference in medians under the null hypothesis; default 0

Parameters

Y1 = variates Data values for a one-sample sign test (neither Y2 nor GROUPS specified), or for the first sample of a two-sample test (Y2 also specified) or the values in both samples of a two-sample test (GROUPS specified but not Y2)
Y2 = variates Data values for the second sample of a two-sample test
STATISTIC = scalars To save the sign test statistic
NBINOMIAL = scalars To save the effective sample size
PROBABILITY = scalars To save the probability level of the test

Description

The sign test is a nonparametric test for difference in location between two related samples, or for testing the location of a single sample. The data values are specified by the parameters Y1 and Y2 and the option GROUPS. For a one-sample test, the Y1 parameter should be set to a variates containing the data. The data for a two-sample test can either be specified in two separate variates using the parameters Y1 and Y2. Alternatively, they can be given in a single variate, with the GROUPS option set to a factor to identify the two samples; the units are then assumed to be specified in the same order within each group. The GROUPS option is ignored when the Y2 parameter is set. The NULL option defines the size of the median under the null hypothesis for a one-sample test, or the difference between the two medians in a two-sample test. By default NULL=0.

The test is assumed to be two-sided unless otherwise requested by the METHOD option. Settings greaterthan or lessthan will give one-sided tests for the median or the difference between medians greater than, or less than, the null hypothesis value respectively.

In a one-sample test, units that are equal to the null hypothesis median are excluded and the effective sample-size is reduced. Similarly, in a two-sample test, units are excluded where the differences between the pairs of values are equal to that required by the null hypothesis. Units with missing values are also excluded.

By default, SIGNTEST prints the test statistic, the effective sample size and the (exact) probability level. This information can also be saved in named scalars using the STATISTIC, NBINOMIAL and PROBABILITY parameters repectively, and printing can be suppressed by setting option PRINT=*.

Options: PRINT, METHOD, GROUPS, NULL.

Parameters: Y1, Y2, STATISTIC, NBINOMIAL, PROBABILITY.

Method

The procedure uses standard Genstat directives for calculation and manipulation.

Action with RESTRICT

If the variates or the factor are restricted, the test is calculated using only the units not excluded by the restriction. In a two-sample test, the two variates or the variate and factor should be restricted in the same way. RESTRICT can be used for example to limit the data to only one or two groups when the GROUPS factor has more than two levels.

Reference

Siegel, S. (1956). Nonparametric Statistics for the Behavioural Sciences. McGraw-Hill, New York.

See also

Procedure: SSIGNTEST, MANNWHITNEY, TTEST, WILCOXON.

Commands for: Basic and nonparametric statistics.

Example

CAPTION 'SIGNTEST example',\
      'Data from Siegel (1956), Nonparametric Statistics, p. 70.',\
      !t('1. Carry out a two-sample, two-sided test, saving the sign test',\
      'statistic, effective sample size and binomial probability in',\
      'scalars Stat, Nbin and Prob respectively.');\
      STYLE=meta,plain,plain
VARIATE  [VALUES=4,4,5,5,3,2,5,3,1,5,5,5,4,5,5,5,5] F
 &       [VALUES=2,3,3,3,3,3,3,3,2,3,2,2,5,2,5,3,1] M
SIGNTEST Y1=F; Y2=M; STATISTIC=Stat; NBINOMIAL=Nbin; PROBABILITY=Prob
PRINT    Stat,Nbin,Prob
CAPTION  !t('2. Repeat example 1 for a one-sided alternative hypothesis',\
         'that variate F has a greater median than M.')
SIGNTEST [METHOD=greaterthan]  F ; M
CAPTION  !t('3. Repeat example 2 using a single variate with the GROUPS',\
         'option set.')
VARIATE  [VALUES=#F, #M] Single
FACTOR   [LABELS=!t(F,M); VALUES=17(1,2)] Group
SIGNTEST [METHOD=greaterthan; GROUPS=Group] Single
CAPTION  !t('4. Carry out a one-sample, two-sided sign test with the null',\
         'hypothesis that the median of variate F is 3.')
SIGNTEST [NULL=3] F
Updated on March 5, 2019

Was this article helpful?