whfir: FIR Causal Wiener-Hopf Filter Estimation

Description Usage Arguments Value Examples

View source: R/whfir.R

Description

Obtain the optimal (MMSE) Wiener-Hopf causal FIR filter for an known multivariate input ts x and known target ts s. Uses the Trench algorithm to compute the log-likelihood of the residual ts and AIC to choose optimal filter length (within a range provided by the user). Full AIC calculation not practical for signals longer than 10,000 samples.

Usage

1
whfir(x, s, n = NULL, AIC = TRUE)

Arguments

x

a ts, vector or matrix of values (columns as time series).

s

as ts or vector of values

n

filter length if integer or range of possible lengths if length two vector.

AIC

use full AIC calculation (default) or minimum squared error to choose filter.

Value

List with elements h, the matrix of optimal filter values (stored as columns); n, the (range of) filter length(s) tested; and AIC the AIC of tested filters (corresponds to n).

Examples

1
2
3
4
5
6
7
8
x <- rnorm( 500 )
h <- seq( 1, 0, length.out = 5 )
s <- stats::filter( x, h, sides = 1 )
x <- x[-(1:4)] # Remove filter roll-on
s <- s[-(1:4)]
wh <- whfir( x, s, n = c(1, 10 ) )
plot( h, ylab = "Filter Coefficients" )
lines( wh$h[,1], col = "red" )

jrevenaugh/TSAUMN documentation built on Nov. 8, 2019, 2:20 p.m.