diffCirc: Lagged differences for circular time series

View source: R/auxiliary.R

diffCircR Documentation

Lagged differences for circular time series

Description

Returns suitably lagged and iterated circular differences.

Usage

diffCirc(x, circular = TRUE, ...)

Arguments

x

wrapped or unwrapped angles to be differenced. Must be a vector or a matrix, see details.

circular

convenience flag to indicate whether wrapping should be done. If FALSE, the function is exactly diff.

...

parameters to be passed to diff.

Details

If x is a matrix then the difference operations are carried out row-wise, on each column separately.

Value

The value of diff(x, ...), circularly wrapped. Default parameters give an object of the kind of x with one less entry or row.

Examples

# Vectors
x <- c(-pi, -pi/2, pi - 0.1, -pi + 0.2)
diffCirc(x) - diff(x)

# Matrices
set.seed(234567)
N <- 100
x <- t(euler2D(x0 = rbind(c(0, 0)), A = diag(c(1, 1)), sigma = rep(2, 2),
               mu = c(pi, pi), N = N, delta = 1, type = 2)[1, , ])
diffCirc(x) - diff(x)

egarpor/sdetorus documentation built on March 4, 2024, 1:23 a.m.