Changepoint analysis/ findchangepts: How does it work?

72 views (last 30 days)
I am using the function findchangepts and use 'linear' which detects changes in mean and slope. How does it note a change? Is it by consecutive points until the next point has a different mean and slope?
Mathworks has the following explanation:
If x is a vector with N elements, then findchangepts partitions x into two regions, x(1:ipt-1) and x(ipt:N), that minimize the sum of the residual (squared) error of each region from its local mean.
How does the function get ipt?
Thanks in advance!
I am working with a single vector with N elements.

Answers (1)

Manvi Goel
Manvi Goel on 29 Oct 2020
The funtion findchangepts partitions the vector x into two regions and calculates sum of the residual (squared) error of each region from its local mean for both a and b (mean squared error).
It will finally return the index pt such that the error calculated previously is minimum for both.
Consider x a vector with N elements as
x = [1, 3, 5, 6, 7, 8]
a = x(1:i - 1), b = x(i:n) where i ranges from 2 through n
a = [1], b = [3, 5, 6, 7, 8] where i = 2, residual sum for a = 0, b = 14.8
a = [1, 3], b = [5, 6, 7, 8] where i = 3, residual sum for a = 2, b = 5
a = [1, 3, 5], b = [6, 7, 8] where i = 4, residual sum for a = 8, b = 2
a = [1, 3, 5, 6], b = [7, 8] where i = 5, residual sum for a = 14.75, b = 0.5
a = [1, 3, 5, 6, 7], b = [8] where i = 6, residual sum for a = 23.2, b = 0
Here the function findchangepts will return pt = 3, since error is minimum for i = 3 which is 2 and 5 resp.
You can also refer to the MATLAB documentation here https://in.mathworks.com/help/signal/ref/findchangepts.html

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!