# Hypothesis testing if two random variables come from a related underlying function

I have observations of two random variables $S_1(t)$ and $S_2(t)$ and I'm trying to build a test to see if they are related. In other words I'm trying to test if unknown functions $F_1(t)$ and $F_2(t)$ are the same function. The parameters $r$ and $b$ are constants with $r \geq 0$ and $n_1$ and $n_2$ are Gaussian noise.

$$S_1(t) = F_1(t) + n_1$$ $$S_2(t) = rF_2(t) + b + n_2$$

It's been a while since I've taken a statistics class and I'm having issues remembering how to build a test for this. I want to set $H_0: F_1(t) \neq F_2(t)$ and $H_1 : F_1(t) = F_2(t)$ but after that I'm getting lost.

• What type of observations do you have? – user99680 Jul 10 '14 at 17:00
• @user99680 I have a sensor which give me updates at a fixed time interval on the order of 10 seconds. For each variable (S_1, S_2) I have on the order of 100 to 10,000 observations. – Ryan F Jul 10 '14 at 17:13
• It would help to provide information about what the alternative hypothesis would be: precisely how could the $S_i$ fail to be related like this? For instance, is it possible that $F_1=F_2$ everywhere except for one particular time $t_0$ where $F_1(t_0)\ne F_2(t_0)$? Also, do you wish simultaneously to test the assumption that the $n_i$ are Gaussian noise processes (presumably independent of each other) or are you willing to stipulate this is the case? – whuber Jul 11 '14 at 12:23
• For the problem I'm trying to solve $F_1$ and $F_2$ will be different for most if not all $t_i$ but for blocks of t the signal ($F_1$ and $F_2$) will be lost in the noise. Also for the time being I'm willing to assume the noise is gaussian and independent. – Ryan F Jul 11 '14 at 18:08

This is for if you flipped your hypothesis. (i.e. $H_{o}: F_{1}(t)=F_{2}(t)$) so maybe you can go off of this.

You would use the Two Sample Kolmogorv_Smirnov Test. Which pretty much looks at the empirical cdfs of both samples and statistic is $D\dfrac{n_{1}+n_{2}}{n_{1}n_{2}}$ where $D$ is maximum distance between the two empirical cdfs (which will occur at one of the "jumps" of cdf) and $n_{i}$ is sample size for sample $i$. From this you would have to look at table of for distribution of this statistic and find pvalue from that. Here is more about it in detail including what distribution you would use to find pvalue for this test

http://en.wikipedia.org/wiki/Kolmogorov–Smirnov_test#Two-sample_Kolmogorov.E2.80.93Smirnov_test

(Copy whole link and look at two sample)

• This answer seems to forget that the $F_i$ are functions: by relying solely on the CDFs of the $F_i(t)$ it examines only the unordered values $F_i(t)$ and ignores the times $t$ at which they were obtained. It cannot succeed. – whuber Jul 11 '14 at 12:17
• You are completely right, I misinterpreted the question I thought it was more of asking if they came from same distribtuion – Kamster Jul 11 '14 at 16:33

I'm not sure this is a well-posed problem if the two functions are allowed to be arbitrary. I'm guessing from your notation that you actually know something about the form of $F_1$ and $F_2$ (for instance, why include $r$ and $b$, they could just be lumped in with $F_2$)?

So let's assume your functions $F$ take the same form, but are parameterized by parameters $\mu_1$ and $\mu_2$; in this case one way (not the only way, just one way) to test this hypothesis is by using a Lagrange multiplier test; specifically maximizing the joint likelihood of $S_1$ and $S_2$, subject to the constraint that $(\mu_1 - \mu_2)^2 > e$, for some suitably small $e$.

Obviously if the functions don't take the same form, this wouldn't work, strictly speaking. However, if they're not the same form, they also can't possibly be the same function...

• I do not see why this problem is not well posed nor why it would be necessary to parameterize the $F_i$. Could you elaborate on your reasons for drawing these conclusions? It seems another way to put the question is to say that $\{(S_1(t_i),S_2(t_i))\}$ is a sample obtained in a two step process wherein (1) points along the line $(y,ry+b)$ are selected arbitrarily in $\mathbb{R}^2$ and then (2) displaced by iid bivariate Normal vectors of mean zero (and possibly correlation zero, too). That takes the question of identifying the $F_i$ out of the picture. – whuber Jul 11 '14 at 17:53
• I rather assumed that observations were not in pairs; if the observation times for the $S_i$ are different, and the $F_i$ are allowed to be arbitrary, then the problem is not really identifiable. The parameterization was a lazy attempt at some kind of smoothness constraint. If the observations are in pairs, isn't this just linear regression? – cycle_cycle_cycle Jul 16 '14 at 20:10