dw.filter(robfilter)
dw.filter()所属R语言包:robfilter
Robust Double Window Filtering Methods for Univariate Time Series
强大的双窗口单变量时间序列的滤波方法
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Procedures for robust (online) extraction of low frequency components (the signal) from a univariate time series based on a moving window technique using two nested time windows in each step.
鲁棒(在线)提取的低频分量(信号)从单变量的时间序列基础上的移动窗口技术使用两个嵌套的时间窗中的每个步骤的程序。
用法----------Usage----------
dw.filter(y, outer.width, inner.width, method = "all",
scale = "MAD", d = 2,
minNonNAs = 5, online = FALSE, extrapolate = TRUE)
参数----------Arguments----------
参数:y
a numeric vector or (univariate) time series object.
一个数值向量或单变量时间序列对象。
参数:outer.width
a positive integer specifying the window width of the outer window used for determining the final estimate. <br> If online=FALSE (see below) this needs to be an odd integer.
一个正整数,指定用于确定最终估计的外窗口的窗口宽度。 <br>如果online=FALSE(见下文),这需要一个奇数。
参数:inner.width
a positive integer (not larger than outer.width) specifying the window width of the inner window used for determining the initial estimate and trimming features.<br> If online=FALSE (see below) this needs to be an odd integer.
一个正整数(不大于outer.width)指定的窗口宽度内的窗口,用于确定初步估计和修剪功能。<BR>如果online=FALSE(见下文),这需要有一个奇怪的整数。
参数:method
a (vector of) character string(s) containing the method(s) to be used for the estimation of the signal level.<br> It is possible to specify any combination of "MED", "RM", "MTM", "TRM", "MRM", "DWRM", "DWMTM", "DWTRM", "DWMRM" and "all" (for all of the above). Default is method="all". For a detailed description see the section "Methods" below.
字符串(矢量)()含有(s)到用于估计的信号电平的方法。参考指定的任何组合"MED","RM",它是可能的"MTM","TRM","MRM","DWRM","DWMTM","DWTRM","DWMRM"和"all"(适用于所有上述)。默认是method="all"。的详细说明,请参阅“一节中方法”。
参数:scale
a character string specifying the method to be used for robust estimation of the local variability (within one time window). Possible values are:
一个字符的字符串指定的方法被用于本地变异(一个时间窗口内)的鲁棒估计。可能的值有:
"MAD"Median absolute deviation about the median (default)
"MAD"的中位数绝对偏差的中位数(默认)
"QN"Rousseeuw's and Croux' (1993) Q_n scale estimator
“"QN"的Rousseeuw的和克鲁”(1993年)Q_n规模估计
"SN"Rousseeuw's and Croux' (1993) S_n scale estimator
“"SN"的Rousseeuw的和克鲁”(1993年)S_n规模估计
参数:d
a positive integer defining factor the current scale estimate is multiplied with for determining the trimming boundaries for outlier detection.<br> Observations deviating more than d*σ_t from the current level approximation μ_t are replaced by μ_t where σ_t denotes the current scale estimate. Default is d = 2 meaning a 2 σ rule for outlier detection.
一个正整数的决定性因素,目前的规模估计乘以确定剪裁边界的孤立点检测。<BR>观察偏离超过d*σ_t“”从目前的水平近似μ_t被替换μ_t的σ_t表示目前的规模估计。默认是d = 2意思是2 σ规则的孤立点检测。
参数:minNonNAs
a positive integer defining the minimum number of non-missing observations within each window which is required for a "sensible" estimation. Default: if windows contain less than minNonNAs = 5 observations NAs are returned.
明智估计这是需要的每个窗口内定义非缺失观测的最小数目的一个正整数。默认值:如果Windows包含小于minNonNAs = 5观察NA的返回。
参数:online
a logical indicating whether the current level and scale estimates are evaluated at the most recent time within each (inner and outer) window (TRUE) or centred within the windows (FALSE). Setting online=FALSE requires odd inner.width and outer.width. Default is online=FALSE.
一个逻辑指示目前的水平和规模估计是否是在最近的时间内每个窗口(内和外)(TRUE)或内居中的窗户(FALSE)评价。设置online=FALSE要求奇inner.width和outer.width。默认是online=FALSE。
参数:extrapolate
a logical indicating whether the level estimations should be extrapolated to the edges of the time series. <br> If online=FALSE the extrapolation consists of the fitted values within the first half of the first window and the last half of the last window; if online=TRUE the extrapolation consists of the all fitted values within the first time window.
一个逻辑指示的水平估计是否应当推断的时间序列的边缘。 <br>如果online=FALSE外推由上半年的第一个窗口和后半段的最后一个窗口内的拟合值;如果online=TRUE外推的拟合值在第一时间窗口。
Details
详细信息----------Details----------
dw.filter is suitable for extracting low frequency components (the signal) from a time series which may be contaminated with outliers and can contain level shifts. For this, moving window techniques are applied.
dw.filter是适合于从时间序列中提取的低频分量(信号)与离群值可能被污染,并且可以包含电平漂移。对于这一点,移动窗口技术被应用。
A short inner window of length inner.width is used in each step for calculating an initial level estimate (by using either the median or a robust regression fit) and a robust estimate of the local standard deviation. Observations deviating strongly from this initial fit are trimmed from an outer time window of length outer.width, and the signal level is estimated from the remaining observations (by using either a location or regression estimator). Values specified in method determine which combination of estimation methods should be applied to the inner and outer window (see section "Methods" below).
一个短期内的窗口的长度inner.width是用在每一步计算初始水平估计(用中位数或一个强大的回归拟合)和一个强大的地方标准偏差估计。观测从该初始配合强烈偏离的修剪长度outer.width从外时间窗口,并从剩余的观测(通过使用一个位置或回归估计)估计的信号电平。 method确定组合估算方法应适用于内层和外层的窗口(见节“方法”下面)中指定的值。
The applied method should be chosen based on an a-priori guess of the underlying signal and the data quality: Location based method (MED / MTM) are recommended in case of a locally (piecewise) constant signal, regression based approaches (RM / DWRM / TRM / MRM) in case of locally linear, monotone trends.
所施加的method应选择基于先验猜底层信号和数据质量:基于位置的方法(MED/MTM)都是在一个本地的情况下推荐的(分段)恒定的信号,回归基础的方法(RM/DWRM/TRM/MRM)的情况下局部线性的,单调的趋势。
Since no big differences have been reported between TRM and MRM, the quicker and somewhat more efficient TRM option might be preferred. DWRM is the quickest of all regression based methods and performs better than the ordinary RM at shifts, but it is the least robust and least efficient method.
由于已没有什么大的差异之间TRM和MRM,更快,某种程度上更高效的TRM选项可能是首选。 DWRM的所有回归的方法是最快的,性能更好,比普通RM在变化的,但它是最不稳定的,至少有效的方法。
If location based methods are used, the inner.width should be chosen at least twice the length of expected patches of subsequent outliers in the time series; if regression based methods are used, the inner.width should be at least three times that length, otherwise outlier patches can influence the estimations strongly. To increase the efficiency of the final estimates, outer.width can then be chosen rather large - provided that it is smaller than the time between subsequent level shifts.
如果使用基于位置的方法,inner.width应被选择的至少两倍的长度在时间序列中的后续离群值的预期补丁;如果回归为基础的方法被使用时,inner.width应该是至少有三个倍,长度,否则离群的补丁可以影响强烈的估计。最终的估计,以提高效率,outer.width然后可以选择相当大的 - ,只要它是在随后的电平移相之间的时间小于。
For robust scale estimation, MAD is the classical choice; SN is a somewhat more efficient and almost equally robust alternative, while QN is much more efficient if the window widths are not too small, and it performs very well at the occurrence of level shifts.
强大的规模估算,MAD是经典的选择,“SN是一个较为有效的,而且几乎同样强大的替代品,而QN是更有效的,如果窗口宽度不能太小,它有很好的表现在发生的电平漂移。
The factor d, specifying the trimming boundaries as a multiple of the estimated scale, can be chosen similarly to classical rules for detecting unusual observations in a Gaussian sample. Choosing d=3 instead of d=2 increases efficiency, but decreases robustness; d=2.5 might be seen
该因子d,指定作为估计规模的倍数修剪边界,可以选择古典的规则同样用于检测高斯样品的不寻常的观测。选择d=3,而不是d=2提高了效率,但会降低鲁棒性; d=2.5可能会看到
值----------Value----------
dw.filter returns an object of class dw.filter. An object of class dw.filter is a list containing the following components:
dw.filter返回一个对象类dw.filter。一个对象的类dw.filter的是一个列表,其中包含以下组件:
参数:level
a data frame containing the corresponding signal level extracted by the filter(s) specified in method.
一个数据框由过滤器()中指定的method提取含有相应的信号电平。
参数:slope
a data frame containing the corresponding slope within each time window.
的数据框,在每个时间窗口中含有相应的斜坡。
参数:sigma
a data frame containing inner.loc.sigma, inner.reg.sigma, outer.loc.sigma and outer.reg.sigma, the scale estimated from the observations (loc) or the residuals from the Repeated Median regression (reg) within the inner window of length inner.width or the outer window of length outer.width, respectively.<br> MTM uses outer.loc.sigma for trimming outliers, MRM and TRM use outer.reg.sigma for trimming outliers,<br> DWMTM uses inner.loc.sigma for trimming outliers, DWMRM and DWTRM use inner.reg.sigma for trimming outliers;<br> MED, RM and RM require no scale estimation.<br> The function only returns values for inner.loc.sigma, inner.reg.sigma, outer.loc.sigma or outer.reg.sigma if any specified method requires their estimation; otherwise NAs are returned.
一个数据框包含inner.loc.sigma,inner.reg.sigma,outer.loc.sigma和outer.reg.sigma,从观测的规模估计(loc)或重复的中位数回归的残差( reg),内内窗口的长度,分别inner.width或外窗的长度outer.width。<BR> MTM使用outer.loc.sigma修剪异常值, MRM和TRM使用outer.reg.sigma微调的异常值,参考DWMTM使用inner.loc.sigma微调离群,DWMRM和DWTRM使用inner.reg.sigma微调异常值; <BR>MED,RM和RM不需要任何规模的估计。<BR>函数仅返回值inner.loc.sigma, inner.reg.sigma,outer.loc.sigma或outer.reg.sigma,如果任何指定的method要求他们估计;否则NA的都回来了。
In addition, the original input time series is returned as list member y, and the settings used for the analysis are returned as the list members outer.width, inner.width, method, scale, d, minNonNAs, online and extrapolate.
此外,返回原来的输入时间序列返回列表成员列表成员y,用于分析和设置outer.width,inner.width,method, scale,d,minNonNAs,online和extrapolate。
Application of the function plot to an object of class dw.filter returns a plot showing the original time series with the filtered output.
应用的功能plot对象的类dw.filter返回一个图,显示的原始时间序列的过滤输出。
方法----------Methods----------
The following methods are available as method for signal extraction, whereby the prefix DW denotes the fact that different window widths are used in the first and second step of the calculations within one window (i.e. inner.width<outer.width) while for the methods MED, RM, MTM, TRM and MRM the first and second step take place in a window of fixed length outer.width.
下面的方法是可以作为method信号提取,由此前缀DW表示一个事实,即使用不同的窗口宽度在第一和第二步骤,计算在一个窗口内(即inner.width outer.width)而为的方法MED,RM,MTM,TRM和MRM的第一步和第二步发生在的固定长度的outer.width一个窗口。
MED ordinary running median filter. <br> The simple median is applied to the observations within a moving time window of length outer.width.
MED普通运行中值滤波器。 <br>该简单的中值被施加到的观察范围内的移动的时间窗口的长度outer.width。
RM ordinary repeated median filter. <br> Repeated median regression is applied to the observations within a moving time window of length outer.width.
RM普通的重复中值滤波器。参考重复位数回归被施加到内的移动时间窗口的长度outer.width观测。
MTM, DWMTM modified trimmed mean filters. <br> In a first step the median is applied to (MTM): the whole window with outer.width or (DWMTM): the inner window with inner.width; in a second step the mean is applied to the (trimmed) observations in the whole window (with outer.width).
MTM,DWMTM修改截尾均值滤波器。 <br>在第一步骤中被施加到该中位数(MTM):用outer.width或(DWMTM):用inner.width;在内部窗口的整个窗口第二步骤的平均被施加到(修剪),在整个窗的观察(用outer.width)。
TRM, DWTRM trimmed repeated median filters. <br> In a first step repeated median regression is applied to (TRM): the whole window with outer.width or (DWTRM): the inner window with inner.width; in a second step least squares regression is applied to the (trimmed) observations in the whole window (with outer.width).
TRM,DWTRM修剪重复中值滤波器。 <br>在重复第一个步骤中位数回归(TRM)outer.width(DWTRM):内窗口inner.width;在整个窗口第二步骤最小二乘回归被施加到(修剪),在整个窗的观察(用outer.width)。
MRM, DWMRM modified repeated median filters. <br> In a first step repeated median regression is applied to (MRM): the whole window with outer.width or (DWMRM): the inner window with inner.width; in a second step another repeated median regression is applied to the (trimmed) observations in the whole window (with outer.width).
MRM,DWMRM修改的重复中值滤波器。 <br>在重复第一个步骤中位数回归(MRM)outer.width(DWMRM):内窗口inner.width;在整个窗口另一个重复第二个步骤中位数回归(修剪),观察在整个窗口(用outer.width)。
DWRM double window repeated median filter. <br> In a first step repeated median regression is applied to the inner window with inner.width to determine the trend (slope); in a second step the median is applied to the trend corrected observations in the whole window with outer.width (without trimming).
重复DWRM双窗口中值滤波器。重复第一步骤中位数回归<br>在被施加到内部窗口用inner.width的来确定的趋势(斜率),在第二步骤中的中位数被施加到的趋势,在整个窗<校正观测X>(不切边)。
注意----------Note----------
Missing values are treated by omitting them and thus by reducing the corresponding window width. <br> MED, RM, MTM, TRM and MRM require at least minNonNAs non-missing observations in each outer window; DWRM, DWMTM, DWTRM and DWMRM require at least minNonNAs non-missing observations in each inner window. Otherwise NAs are returned for level, slope and sigma.
缺少的值被视为通过省略他们的,从而通过降低相应的窗口宽度。参考MED,RM,MTM,TRM和MRM至少需要minNonNAs非缺失的观察,在每个外窗; DWRM,DWMTM,DWTRM和DWMRM至少需要“minNonNAs不可缺失的观测在每个内部窗口。否则NAs的返回level,slope和sigma。
(作者)----------Author(s)----------
Roland Fried and Karen Schettlinger
参考文献----------References----------
Modified Repeated Median Filters, Statistics and Computing 16, 177-192.<br> (earlier version: http://www.sfb475.uni-dortmund.de/berichte/tr46-04.ps)
Robust Filters for Intensive Care Monitoring: Beyond the Running Median, Biomedizinische Technik 51(2), 49-56.
参见----------See Also----------
robreg.filter, robust.filter, hybrid.filter, wrm.filter.
robreg.filter,robust.filter,hybrid.filter,wrm.filter。
实例----------Examples----------
# Generate random time series:[生成随机时间序列:]
y <- cumsum(runif(500)) - .5*(1:500)
# Add jumps:[添加跳转:]
y[200:500] <- y[200:500] + 5
y[400:500] <- y[400:500] - 7
# Add noise:[添加噪声:]
n <- sample(1:500, 30)
y[n] <- y[n] + rnorm(30)
# Filtering with all methods:[过滤用一切手段:]
y.dw <- dw.filter(y, outer.width=31, inner.width=11, method="all")
# Plot:[图:]
plot(y.dw)
# Filtering with trimmed RM and double window TRM only:[只过滤提供修剪RM和双窗口TRM:]
y2.dw <- dw.filter(y, outer.width=31, inner.width=11, method=c("TRM","DWTRM"))
plot(y2.dw)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|