# How to test if two samples are distributed from the same Gaussian process

Given a sequence $\mathbf{x} = (x_1,x_2,\dots,x_n)$ which is sampled from some Gaussian process $GP(\mu_1,\Sigma_1)$ and a "target" sequence $\mathbf{y} = (y_1,y_2,\dots,y_n)$ sampled from another Gaussian process $GP(\mu_2,\Sigma_2)$, does anyone know of a test of whether $\mathbf{x}$ and $\mathbf{y}$ come from the same distribution? I guess I'd like to know the probability $\mathbf{x}$ and $\mathbf{y}$ are from the same distribution (is that even well posed?).

I am not assuming any of $\mu_1,\mu_2,\Sigma_1$ or $\Sigma_2$ are known. Also, I'm okay with assuming the GPs are stationary (but not centered) if that helps.

• Are you sampling both GP's at the same points of the index set? I mean, are you fixing $t_1,\dots,t_n$ and observing the values of the random vectors $(X(t_1),\dots,X(t_n))$ and $(Y(t_1),\dots,Y(t_n))$? – Zen May 29 '13 at 13:52

## 2 Answers

This sounds like an application for the two-sample KS test, which evaluates whether two samples were taken from the same continuous probability distribution. For more information, you might want to start here, which explains it in some detail: http://www.itl.nist.gov/div898/handbook/eda/section3/eda35g.htm.

• One might add that he indicated the distribution parameters are unknown, in which case a KS might no work – IMA May 9 '13 at 20:46
• That's why a two-sample KS test is the tool to use here. Instead of comparing a single sample to a fully-specified model, it compares the two samples to each other. – Sycorax May 9 '13 at 20:48
• The two sample KS assumes independence. That doesn't seem to be the case here. – Glen_b May 9 '13 at 23:19
• I agree with Glen_b, computing the ECDF requires independence of the sample points, which is not true in a sample sequence from a GP. I guess you can view the whole vector as a single sample from a high dimensional distribution, but then we only have a sample size of 1. – MarkV May 10 '13 at 16:08

Let the null hypothesis be that $\mathbf x$ and $\mathbf y$ have the same distribution. Let $\mathbf z = \mathbf x - \mathbf y.$ Under the null, $\mathbf z$ will have a mean of zero and be symmetric. Test the hypothesis that $\mathbf z = \mathbf 0$ using the traditional test. If you reject, you are done.

If you fail to reject, then divide the $x_i - y_i$ into two subsets: those realizations less than zero and those greater than zero. Now use the two-sample KS test on the two halves of your data.

You will need to use your judgment for high dimensions since you are performing a multitude of tests, but at least this deals with the potential dependence.