File: stats-filter.Rd

package info (click to toggle)
r-cran-timeseries 4041.111-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,704 kB
  • sloc: makefile: 14
file content (75 lines) | stat: -rw-r--r-- 1,461 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
\name{filter}
\alias{filter}

\alias{filter,timeSeries-method}


\title{Linear filtering on a time series}

\description{

  Applies linear filtering to a univariate \code{"timeSeries"}.
      
}

\usage{
\S4method{filter}{timeSeries}(x, filter, method = c("convolution", "recursive"), sides = 2, 
       circular = FALSE, init = NULL)
}

\arguments{
  \item{x}{
    an object from class \code{"timeSeries"}.
  }
  \item{filter}{
    coefficients of the filter.
  }
  \item{method}{
    \code{"convolution"} or \code{"recursive"}.
  }
  \item{sides,circular}{
    
    for convolution filters only.  Onesided if \code{sides = 1}, centred
    around lag 0 if \code{sides = 2}. Circular if \code{circular =
    TRUE.}

  }
  \item{init}{

    for recursive filters only. Values before the start of the time
    series.

  }
}

\details{

  \code{filter} is a generic function with default method
  \code{stats::filter}.  The method for \code{"timeSeries"} is a wrapper
  for the latter.

  See \code{?stats::filter} for details about the arguments.
  
}

\value{
  a \code{"timeSeries"} object
}

\seealso{
  base R function \code{\link[stats]{filter}}
}

\examples{
## Creata a dummy signal 'timeSeries' - 
   data <- matrix(rnorm(100), ncol = 2)
   s <- timeSeries(data, units=c("A", "B"))
   head(s)
   
## Filter the series - 
   f <- filter(s, rep(1, 3))
   head(f)
   
## Plot and compare the first series - 
   plot(cbind(s[, 1], f[, 1]), plot.type="s")
}