# Regression on $(X,Y)$ observations with correlated errors between observations

• I have a set of $N$ observations $(X_i,Y_i)$, with known heteroskedastic normal errors $(\epsilon_{Xi},\epsilon_{Yi})$.
• Errors in $X$ and $Y$ are independent: $cov(\epsilon_{Xi},\epsilon_{Yj}) = 0$
• Errors in X are correlated between observations: $cov(\epsilon_{Xi},\epsilon_{Xj}) ≠ 0$
• Errors in Y are correlated between observations: $cov(\epsilon_{Yi},\epsilon_{Yj}) ≠ 0$

I'm looking for a method and/or software package which will perform a regression model of the form $Y + \epsilon_{Y} = a(X+\epsilon_{X})+b$ on this kind of data set. I know of ODRPACK but it does not seem to account for error correlations between different observations. I also know of generalized least squares but I believe it does not account for errors in $X$.

If no such method exists, I'd still be happy to find something that would account for uncorrelated heteroskedastic normal errors in $X$ ($cov(\epsilon_{Xi},\epsilon_{Xj})=0$ if $i≠j$, and $cov(\epsilon_{Xi},\epsilon_{Xi})=\sigma^2_{Xi}$), but errors in $Y$ remaining correlated.

• If you are using the model $Y = aX + b$ and $X$ and $Y$ are indendent (as you say) you get: $0 = \operatorname{Cov} (X,Y) = \operatorname{Cov}(X, aX + b) = a\operatorname{Cov} (X)$. Thus $X$ has zero variance and ist therefore constant, so this is probably the wrong model to use here. If $X$ and $Y$ are independent, roughly speaking, $X$ given you no information about $Y$ so $a$ will be $0$. Or is your notation implying $i \neq j$ ? – Stefan Aug 3 '18 at 11:23
• I think the author means that the errors of X,Y are uncorrelated, not that X and Y are uncorrelated, although that is what cov(X,Y)=0 means. – dbwilson Aug 3 '18 at 12:13
• Do you have a variable, such as a person ID, that defines the non-independence? If so, standard mixed-effects regression models or robust standard error models would be workable solutions. – dbwilson Aug 3 '18 at 12:14
• My bad, I used ambiguous notations. X and Y are correlated, but the errors in X are independent from those in Y. I edited the text accordingly. – Mathieu Aug 3 '18 at 12:19
• Re: "a variable [...] that defines the non-independence". I'm not sure I understand. What I have is a set of $N$ physical objects. I measure property $X$ for each object (e.g., temperature), with measurements errors defined by a $(N,N)$ covariance matrix. I also measure property $Y$ (e.g., length) for each object, with distinct measurement errors with their own $(N,N)$ covariance matrix. Now I want to perform a regression of $Y$ versus $X$. Does this answer your question? Should I read up on standard mixed-effects regression models and robust standard error models? – Mathieu Aug 3 '18 at 12:28