View source: R/difference.sign.test.R

difference.sign.test | R Documentation |

Performs the nonparametric Difference-sign test of randomness.

difference.sign.test(x, alternative)

`x` |
a numeric vector containing the data |

`alternative` |
a character string specifying the alternative hypothesis. Must be one of " |

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

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). |

Ayana Mateus and Frederico Caeiro

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.

## ## 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)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.