Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

difference.sign.test

Difference Sign Test


Description

Performs the nonparametric Difference-sign test of randomness.

Usage

difference.sign.test(x, alternative)

Arguments

x

a numeric vector containing the data

alternative

a character string specifying the alternative hypothesis. Must be one of "two.sided" (default), "left.sided" or "right.sided".

Details

Consecutive equal values are eliminated.

The possible values "two.sided", "left.sided" and "right.sided" define the alternative hypothesis. By using the alternative "two.sided" the null hypothesis of randomness is tested against either an increasing or decreasing trend. By using the alternative "left.sided" the null hypothesis of randomness is tested against an decreasing trend. By using the alternative "right.sided" the null hypothesis of randomness is tested against an increasing trend

Value

A list with class "htest" containing the components:

statistic

the (normalized) value of the statistic test.

parameter

the size of the data, after the remotion of consecutive duplicate values.

p.value

the p-value of the test.

alternative

a character string describing the alternative hypothesis.

method

a character string indicating the test performed.

data.name

a character string giving the name of the data.

ds

the total number of positive diferences (not shown on screen).

mu

the mean value of the statistic DS (not shown on screen).

var

the variance of the statistic DS (not shown on screen).

Author(s)

Ayana Mateus and Frederico Caeiro

References

Brockwell, P.J. and Davis, R.A. (2002). Introduction to Time Series and Forecasting, 2nd edition, Springer (p. 37).

Mateus, A. and Caeiro, F. (2013). Comparing several tests of randomness based on the difference of observations. In T. Simos, G. Psihoyios and Ch. Tsitouras (eds.), AIP Conf. Proc. 1558, 809–812.

Moore, G. H. and Wallis, W. A. (1943). Time Series Significance Tests Based on Signs of Differences, Journal of the American Statistical Association, 38, 153–154.

Examples

##
## Example 1
## Annual Canadian Lynx trappings 1821-1934 in Canada.
## Available in datasets package
##
## Not run: plot(lynx)
difference.sign.test(lynx)

##
## Example 2
## Sweet potato production, harvested in the United States, between 1868 and 1937.
## Available in this package.
##
data(sweetpotato)
difference.sign.test(sweetpotato$production)

randtests

Testing randomness in R

v1.0
GPL (>= 2)
Authors
Frederico Caeiro and Ayana Mateus
Initial release
2014-11-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.