Performs a one or two sample sign test (E. Stephens & P.W. Goedhart).
|Whether to print the test statistic with the associated probability and sample size (
||Type of test (
||Defines the groups for a two-sample test if only the
||Median value or difference in medians under the null hypothesis; default 0|
||Data values for a one-sample sign test (neither
||Data values for the second sample of a two-sample test|
||To save the sign test statistic|
||To save the effective sample size|
||To save the probability level of the test|
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
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
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
The test is assumed to be two-sided unless otherwise requested by the
METHOD option. Settings
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.
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
PROBABILITY parameters repectively, and printing can be suppressed by setting option
The procedure uses standard Genstat directives for calculation and manipulation.
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.
Siegel, S. (1956). Nonparametric Statistics for the Behavioural Sciences. McGraw-Hill, New York.
Commands for: Basic and nonparametric statistics.
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