cor_fun: cor_fun

Description Usage Arguments Details Value

Description

Calculates either the cross-correlation function for two variables or the auto-correlation function for a single variable. It can be used to calculate values with bounded periodicity (i.e. the values wrap around'). It uses the population level standard deviation; as such, for self-repeating patterns the ACF does not decay over time.

Usage

1
cor_fun(x, y = NULL, lag.max = 200, wrap = F, level = "sample")

Arguments

x

a vector of numeric values.

y

a vector of numeric values #optional input.

lag.max

the total number of lag times that cross-correlation or autocorrelation will be calculated for.

wrap

determines whether bounded periodicty should be used (wrap=T). Bounded periodicity means that the values 'wrap round'. Usually, not required.

level

determines whether correlation is calculated using the population-level correlation denominator of 'n' or the sample-level correlation demoninator of 'n-1'. Level only accepts values of 'population' or 'sample'. By default it is set to 'sample'.

Details

To autocorrelate a single variable, just pass x. To cross-correlate two variables, pass both x and y.

Value

cor.out object is returned. There are nine variables that can be accessed: cor, lag, series, x, y, fit_best, wrap, type, level, conf.int.


bvidgen/RPackage documentation built on May 13, 2019, 9:04 a.m.