# How can I chose the Threshold value, in change point detection for a set of data with unknown number of changepoints

21 views (last 30 days)
Mohamad Shukfa on 8 Jan 2021
Commented: Mohamad Shukfa on 4 Apr 2021
A = [zeros(1,100) 1:100 99:-1:50 50*ones(1,250)] + 10*rand(1,500);
[TF,S1,S2] = ischange(A,'linear','Threshold',200);
segline = S1.*(1:500) + S2;
plot(1:500,A,1:500,segline)
legend('Data','Linear Regime')
this is a code given in MATTLAB Help center,Ducumentaion
https://uk.mathworks.com/help/matlab/ref/ischange.html?lang=en

Pranav Verma on 11 Jan 2021
Edited: Pranav Verma on 11 Jan 2021
From your question I understand that you are trying change point detection for the data sample. You can try using the findchangepts function in MATLAB. In this function, there exists a Name,Value pair for setting the minimum threshold : MinThreshold.
In the documentation of the findchangepts, ity is explained how to decide upon the threshold value:
• The proportionality constant, denoted by β and specified in 'MinThreshold', corresponds to a fixed penalty added for each changepoint. findchangepts rejects adding additional changepoints if the decrease in residual error does not meet the threshold. Set 'MinThreshold' to zero to return all possible changes.
• If you do not know what threshold to use or have a rough idea of the number of changepoints in the signal, specify 'MaxNumChanges' instead. This option gradually increases the threshold until the function finds fewer changes than the specified value.
You can find the mathematical analysis of changepoint detection and the above mentioned points in the documentation.
Also you can refer to the below thread explaning findchangepts:
Thanks
Mohamad Shukfa on 4 Apr 2021
Thanks