One-pass filter using signal::filter, with two additions: 1) We impute internal missing values for the purposes of filtering, then replace them with NAs again after filtering 2) We pad the end of the time series with the last observed value instead of zeros. Based on very informal plotting, this seems to give better values at the end of the time series, which will be important for prediction
1 | one_pass_signal_filter(filt, x, impute_fn)
|
x |
vector of data to be filtered |
filter |
vector of filter coefficients for a FIR filter |
method |
method for a call to stats::filter – see the documentation at stats::filter |
sides |
sides for a call to stats::filter – see the documentation at stats::filter |
circular |
circular for a call to stats::filter – see the documentation at stats::filter |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.