cfilter: Time Series Convolution Filters

Description Usage Arguments Details Value Author(s) Examples

View source: R/RcppExports.R

Description

Applies a convolution filter to a univariate time series.

Usage

1
cfilter(x, filter, sides, circular)

Arguments

x

A column vector of length T

filter

A column vector of length f

sides

An int that takes either 1:for using past values only or 2: filter coefficients are centered around lag 0.

circular

A bool that indicates if the filter should be wrapped around the ends of the time series.

Details

This is a port of the cfilter function harnessed by the filter function in stats. It is about 5-7 times faster than R's base function. The benchmark was done on iMac Late 2013 using vecLib as the BLAS.

Value

A column vec that contains the results of the filtering process.

Author(s)

R Core Team and JJB

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
x = 1:15
# 
cfilter(x, rep(1, 3), sides = 2, circular = FALSE)
# Using R's function
filter(x, rep(1, 3))
#
cfilter(x, rep(1, 3), sides = 1, circular = FALSE)
# Using R's function
filter(x, rep(1, 3), sides = 1)
#
cfilter(x, rep(1, 3), sides = 1, circular = TRUE)
# Using R's function
filter(x, rep(1, 3), sides = 1, circular = TRUE)

SMAC-Group/gmwm documentation built on Sept. 11, 2021, 10:06 a.m.