# How Do I detect window of X corresponding to Y (nonlinearly)?

I have two continuous variables that may have nonlinear relationship. The dataset contains multiple recordings of X, each corresponding to multiple recordings of Y. The exact matching is unknown.

How Do I detect window of X corresponding to each Y?
Should I use distance correlation tests with sliding window of X?

UPDATE: X are EEG recordings. Y are sound recordings. Each EEG recording corresponds to multiple sound recordings. I want to process EEG and corresponding sound in parallel.

• This terse, abstract description makes it difficult to understand your problem. Could you perhaps supply a small example of the data and what you intend to accomplish?
– whuber
Feb 23 '21 at 14:51

If I understood correctly you have observations $$(x_i, y_i)_i$$ from the joint distribution $$p_{X,Y}$$. It seems you are asking about the quantity $$\mathrm{Supp}(p_{X\mid y}) = \{ x\mid p_{X\mid Y}(x\!\mid\!y) > 0 \}$$
You should be able to estimate the joint pdf $$p_{X,Y}$$ of your data. This can be done via a good ol' KDE estimation or via the use of copulas. Both methods have implementations in R and python.
This however goes against Vapnik's Principle, so there must be a simpler way to estimate the support of $$X\mid Y=y$$ without the estimation of the entire pdf.