contingency.periodogram: The contingency periodogram for periodicity in categorical...

Description Usage Arguments Details Value References Examples

Description

A function to estimate the contingency periodogram to test for periodicity in categorical time series.

Usage

1
contingency.periodogram(x, maxper = 6, exact = FALSE)

Arguments

x

A vector representing the categorical time series.

maxper

the maximum lag (period) considered.

exact

If TRUE the FISHER exact test is calculated

Details

This is the contingency periodogram of Pierre Legedre and Pierre Dutielle to test for periodicity in categorical time series. I have coded the function so as to provide both the Fisher exact test and the asymptotic chi-square test.

Value

An object of class "contingency.periodogram" is returned consisting of a matrix with a row for each period considered. The columns are:

exact.p

the Fisher exact test at each lag (if exact=TRUE).

chi2

the asymptotic chi-square value.

df

the chi-square degrees-of-freedom.

asympt.p

the chi-squared asymptotic p-value.

References

Legendre et al. (1981) The contingency periodogram: A method for identifying rhytms in series of nonmetric ecological data. Journal of Ecology, 69, 965-979. https://doi.org/10.2307/2259648

Examples

1
2
3
4
    data(plodia)
    data<-as.factor((scale(plodia) > 0))
    fit <- contingency.periodogram(data, maxper = 9) 
    ## Not run: plot(fit)

Example output

Loading required package: locfit
locfit 1.5-9.1 	 2013-03-22
Loading required package: acepack
Warning messages:
1: In chisq.test(table(t3[, 1], t3[, 2])) :
  Chi-squared approximation may be incorrect
2: In chisq.test(table(t3[, 1], t3[, 2])) :
  Chi-squared approximation may be incorrect
3: In chisq.test(table(t3[, 1], t3[, 2])) :
  Chi-squared approximation may be incorrect
4: In chisq.test(table(t3[, 1], t3[, 2])) :
  Chi-squared approximation may be incorrect
5: In chisq.test(table(t3[, 1], t3[, 2])) :
  Chi-squared approximation may be incorrect

nlts documentation built on May 1, 2019, 8:44 p.m.