Description Usage Arguments Value See Also Examples
View source: R/multi_peak_features.R
Smooth by rolling mean and perform linear regression. Rolling mean is extended at extremeties by linear extrapolation, see ?rollex. Aims at giving an estimation of long-term trend in multi-peak signals.
1 | MPFeatTrend_rollmean(x, window.size, robust = FALSE)
|
x |
a numerical vector. |
window.size |
integer, width of window for rolling mean. |
robust |
logical. If TRUE perform robusts linear regression. Median-Based Linear Models are used, see ?mblm::mblm |
A list of 2: $model, the full linear model; $trend, slope of the linear model.
MPFeatTrend_extrema
1 2 3 4 5 6 7 8 9 | width <- 30
x <- sim_phase_shifted_with_fixed_trend(n = 1, noise = 0, slope = 0.1)
# Rolling mean extended by linear extrapolation.
# This is also performed in MPFeatTrend_rollmean.
x.roll <- rollex(x$value, width)
plot(x$value, type = "b")
lines(x.roll, col ="red", lwd = 2, lty = "dashed")
x.trend <- MPFeatTrend_rollmean(x = x$value, window.size = width)
abline(x.trend$model, col = "blue", lwd = 2, lty = "dashed")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.