This function essentially uses the running.mean
function from the igraph package. However, adjustments
are made to ensure that the output is always the same length
as the input (by fiddling at the boundaries).
Usage
runmean(x, binwidth)
Value
The running mean of the input at the given bandwidth.
Arguments
x
Vector that you wish to smooth using a running mean.
binwidth
Number of ordinates over which you wish to average
Author
Guy Nason.
Details
For example, if binwidth=2 and x=1:6 then
the function averages each pair to get 1.5, 2.5, 3.5, 4.5, 5.5.
However, this is only 5 numbers and the input had 6. So, in this
case the function arranges for the output to be extended (in this
case 1 gets padded onto the front. For vectors of length > 3
the padding depends on whether the vector is even or odd.
References
Nason, G.P. (2013) A test for second-order stationarity and
approximate confidence intervals for localized autocovariances
for locally stationary time series. J. R. Statist. Soc. B,
75, 879-904.
tools:::Rd_expr_doi("10.1111/rssb.12015")