Statistics - Maple Help

Home : Support : Online Help : Statistics and Data Analysis : Statistics Package : Data Smoothing : Statistics/LinearFilter

Statistics

 LinearFilter
 apply linear filter to a data set

 Calling Sequence LinearFilter(X, Y, options)

Parameters

 X - Y - filter options - (optional) equation(s) of the form option=value where option is one of ignore or initial; specify options for the LinearFilter function

Description

 • The LinearFilter function applies linear filter to a set of observations. By default, convolution method is used:
 > X'[i] = Sum(X[i+1-j]*Y[j], j = 1..m);
 ${{\mathrm{X\text{'}}}}_{{i}}{=}{\sum }_{{j}{=}{1}}^{{m}}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}{{X}}_{{i}{+}{1}{-}{j}}{}{{Y}}_{{j}}$ (1)
 where m is the size of the filter. For $i the set of initial values will be used. By default, X is padded on the left with $m-1$ zeros. Option initial can be used to specify the initial values.
 Recursive filter is defined as follows:
 > X'[i] = X[i]*Y[1]+Sum(X'[i+1-j]*Y[j], j = 2..m);
 ${{\mathrm{X\text{'}}}}_{{i}}{=}{{X}}_{{i}}{}{{Y}}_{{1}}{+}{\sum }_{{j}{=}{2}}^{{m}}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}{{\mathrm{X\text{'}}}}_{{i}{+}{1}{-}{j}}{}{{Y}}_{{j}}$ (2)
 • The first parameter X is a single data sample - given as e.g. a Vector. Each value represents an individual observation.
 • The second parameter Y is the filter - given as e.g. a Vector. Each value represents a filter coefficient.

Options

 The options argument can contain one or more of the options shown below.
 • ignore=truefalse -- This option is used to specify how to handle non-numeric data. If ignore is set to true all non-numeric items in data will be ignored. Missing values are allowed in the data set but not in the filter.
 • initial=deduce, or Vector -- This option specifies the initial values in reverse order. The default is a set of $m-1$ zeros.
 • recursive=truefalse -- If this option is set to true then recursive filter will be used.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $A≔⟨\mathrm{seq}\left(\mathrm{sin}\left(i\right),i=1..9\right),\mathrm{undefined}⟩:$
 > $\mathrm{LinearFilter}\left(A,⟨1.,0.3,0.2⟩\right)$
 $\left[\begin{array}{c}{0.841470984807897}\\ {1.16173872226805}\\ {0.582203433069151}\\ {-}{0.532607007524832}\\ {-}{1.15774102164354}\\ {-}{0.718453279659453}\\ {0.381377094326484}\\ {1.13057112659923}\\ {0.840323278972529}\\ {\mathrm{HFloat}}{}\left({\mathrm{undefined}}\right)\end{array}\right]$ (3)
 > $\mathrm{LinearFilter}\left(A,⟨1.,0.3,0.2⟩,\mathrm{ignore}\right)$
 $\left[\begin{array}{c}{0.841470984807897}\\ {1.16173872226805}\\ {0.582203433069151}\\ {-}{0.532607007524832}\\ {-}{1.15774102164354}\\ {-}{0.718453279659453}\\ {0.381377094326484}\\ {1.13057112659923}\\ {0.840323278972529}\end{array}\right]$ (4)
 > $\mathrm{LinearFilter}\left(A,⟨1.,0.3,0.2⟩,\mathrm{ignore},\mathrm{initial}=⟨3,2,1⟩\right)$
 $\left[\begin{array}{c}{2.14147098480790}\\ {1.76173872226805}\\ {0.582203433069151}\\ {-}{0.532607007524832}\\ {-}{1.15774102164354}\\ {-}{0.718453279659453}\\ {0.381377094326484}\\ {1.13057112659923}\\ {0.840323278972529}\end{array}\right]$ (5)
 > $\mathrm{LinearFilter}\left(A,⟨1.,0.3,0.2⟩,\mathrm{ignore},\mathrm{recursive}\right)$
 $\left[\begin{array}{c}{0.841470984807897}\\ {1.16173872226805}\\ {0.657935821701862}\\ {-}{0.327074004343760}\\ {-}{0.925459311625894}\\ {-}{0.622468092555446}\\ {0.285154308626976}\\ {0.950410920700385}\\ {0.754272623177268}\end{array}\right]$ (6)