getTrendChangePoints: Return the change points of the trend for the given time...

Description Usage Arguments Details Value

View source: R/getTrendChangePoints.r

Description

Change points are transition points that optionally exceed a certain magnitude and/or continue in a certain direction for a specified length of time.

Usage

1
tsData.cp <- getTrendChangePoints(tsData, minPctChange, nPeriods)

Arguments

tsData

A time series object.

minPctChange

The optional lower bound a magnitude must exceed

nPeriods

An optional number of periods the transition must continue into the future

Details

Transition points are defined as indices at which the time series changes direction. We can think of the trend of a univariate time series as analogous to a smooth function f(t) defined over a given interval of real numbers, [a,b]. We know that for t in [a,b], f is increasing on [a,b] if f'(t) > 0, f is decreasing on [a,b] if f'(t) < 0 and f is constant on [a,b] if f'(t) = 0. Similarly, we can examine the sign of the difference of a time series at two subsequent points in time, to determine if the time series is increasing, decreasing, or constant from one point in time to the next. Additionally, if we think of the time series as moving through space, a geometric interpretation would allow us to treat the time series as a vector with a direction (increasing, decreasing, or constant) and magnitude (the percent change of the time series from one period of time to the next). This perspective allows one to adapt what is considered a change point. Thus, a change point can merely be a transition point, or it can be a transition point whose percent change from the previous value exceeds some threshold, or it can be a transition point that causes the time series to continue in the new direction for a specified period of time.

Value

A vector of integers corresponding to indices of change points in the given time series trend


OHDSI/Castor documentation built on March 20, 2021, 6:09 p.m.