comparing similarity between stock changepoints I am wondering what statistical measure could be used to find how similar two sets of changepoints are to each other.
For instance. let's say I have financial data of two stocks for one whole year. A total of 261 observations each.
Stocks A and B are very strongly correlated. However , I want to also test how similar their changepoints are to each other. Using R , I could easily use the e-divisive method in the ecp package to find the estimates for changepoints. This method will return , a list of numbers that correspond to the location of each changepoint.
If the null hypothesis is changepoints are similar , what test should be used to reject or accept that hypothesis.
I could extract each changepoint list for each stock. where
Stock A      Stock B
2               6
40             40
56             56
74             85
220            218
where each number corresponds to the number of period where a changepoint occured.
 A: What statistical measure could be used to find how similar two sets of changepoints are to each other?
Assuming that the number of changepoints in each set is not fixed beforehand, the number of changepoints in each set would be my first step. Then you could compare the positions of the changepoints. Choose some sensible value $x$ that is small relative to the number of data points (this value will depend on the context of the changepoint detection) and say that two changepoints in different sets represent the same change if they are within $x$ units of each other. You could then check what proportion of changes in the two sets match up. This technique is used in Section 6 of (Bodenham & Adams, 2016) to test whether two techniques for detecting changepoints are detecting the same changepoints. In your case, I could set $x$ to be 5 units and then we would see that 4/5 of the changes in the two sets match up (assuming I'm reading your data output correctly).
If the null hypothesis is changepoints are similar, what test should be used to reject or accept that hypothesis?
The e-divisive method doesn't make any assumptions about the model that generated the data; it is a non-parametric method. If you made a parametric assumption about how the data were generated then you could perform Bayesian inference of the two models: Let $M_0$ be the model for the data where the changepoints for the two processes occur simultaneously and let $M_1$ be the alternative. If you had prior beliefs $P(M_0)$ and $P(M_1)$ for these hypotheses, then you could calculate the ratio of the posterior probabilities of the models given data $D$ using Bayes' Theorem:
$$
\frac{p(M_1 | D)}{p(M_0 | D)} = \frac{p(D | M_1)}{p(D | M_0)} \frac{p(M_1)}{p(M_0)}.
$$
The $p(M_0 | D), p(M_1 | D)$ terms are the likelihood of the data given the model. You could also use a statistic based on the likelihood ratio test
$$
\frac{p(D | M_1)}{p(D | M_0)}
$$
but the usual $\chi^2$ approximation won't hold here because you're using different parameters in each model.
I suppose that since you've already performed hypothesis tests to get the two sets of change points, your hypothesis test could just be whether all the changepoints in the sets are detecting the same changes. So in this case, the changepoint for A at 74 and the changepoint at 85 for stock B that don't match up would be evidence that the two processes don't undergo the exact same changes, but it depends how lenient you want to be. Without a parametric model for how changepoints and data are generated, it is not possible to quantify how unlikely the changepoint observations are under $M_0$ and $M_1$.
