MPFeatTrend_extrema: MPFeatTrend_extrema

Description Usage Arguments Value See Also Examples

View source: R/multi_peak_features.R

Description

Isolate local extrema and perform a linear regression. Aims at giving an estimation of long-term trend in multi-peak signals.

Usage

1
MPFeatTrend_extrema(x, window.size, what, robust = FALSE)

Arguments

x

a numerical vector.

window.size

integer, width of window for maxima detection. See ?detect.peak.

what

character, one of "minima" or "maxima". Define whether regression should be performed on maxima or minima of peaks.

robust

logical. If TRUE perform robusts linear regression. Median-Based Linear Models are used, see ?mblm::mblm

Value

A list of 4. $trend, slope of the linear model

$model, the full linear model

$extremes, x extrema values and their index

$type, type of extrema, "mini" or "maxi"

See Also

MPFeatTrend_rollmean

Examples

1
2
3
4
x <- sim_phase_shifted_with_fixed_trend(n = 1, noise = 0, slope = 0.1)
x.trend <- MPFeatTrend_extrema(x = x$value, window.size = 5, what = "maxi")
plot(x$value, type = "b")
abline(x.trend$model, col = "blue", lwd = 2, lty = "dashed")

majpark21/TSexploreR documentation built on Oct. 16, 2019, 2:46 p.m.