arfilter: AR filter

Description Usage Arguments See Also Examples

View source: R/armodel.R

Description

Filter a time series using AR coefficients

Usage

1
arfilter(x, mod, x.mean = mod$x.mean, init = "focb")

Arguments

x

a time series

mod

an AR model

x.mean

the mean used. By default the mean of the original model. Set to zero for no demeaning

init

how the initial values should be chosen. First observation carried backwards (default), mean of the first values, or the first values in reverse.

See Also

armodel

Examples

1
2
3
4
5
6
7
8
9
set.seed(1)
arap <- ar(AirPassengers)
spec.ar(arap)
spec.pgram(arfilter(rnorm(10000), arap), span=21, na.action=na.omit)

arm <- armodel(c(1.3, -0.4))
spec.ar(arm)
plot(x <- rnorm(200), type="l")
lines(scale(arfilter(x, arm), center=FALSE), col="red", lwd=2)

AkselA/R-ymse documentation built on March 21, 2020, 9:52 a.m.