1
$\begingroup$

Imagine I have two large arrays of 0's and 1's representing locations along a one-dimensional spatial domain, where: $$ X = \text{Locations where the error is high},\\ Y = \text{Locations where data quality is poor}. $$ These paired arrays are boolean, with each entry indicating whether an error is high or data quality is poor at that location. The locations are ordered spatially, meaning that adjacent locations are closer than non-adjacent ones.

I want to understand whether high-error regions tend to correlate with poor data quality regions. Given the binary nature of the data, would the Chi-squared test or phi coefficient be appropriate to test this correlation, or would there be a better statistical approach to account for the spatial structure?

$\endgroup$
6
  • $\begingroup$ Why do you need to check the relationship between the two variables eventually? I ask because you use the word "location", which hints to you having spatial data (e.g. you have coordinates associated to each location, not only information about error and data quality). If it's the case, people might be able to suggest you more elaborate methods, that could be useful to answer your actual research question. $\endgroup$
    – J-J-J
    Commented Oct 4 at 6:25
  • $\begingroup$ Also, It would be quite useful to explain how the variables have been measured or constructed. You mention that your data is binary, but do you have access to a version of the data that isn't binary (e.g. ordinal)? "Error is high" and "data is poor" hints to you having such data, i.e. a more detailed level of error and data quality than just "yes/no". If you do have this original, non-dichotomized data, you could use that to conduct a more fruitful analysis. $\endgroup$
    – J-J-J
    Commented Oct 4 at 6:33
  • 1
    $\begingroup$ By location I mean over a 1-dimensional spatial domain. Essentially these are lists of booleans, in entries where some error is high/data is poor. I want to understand whether high error tens to correlate, or not, with regions where data quality is poor. $\endgroup$
    – sam wolfe
    Commented Oct 4 at 8:37
  • $\begingroup$ So for example, the first location is spatially closer to the second one than it is to the third one, i.e. the order of the locations is not arbitrary. Am I correct? You can edit your question to clarify that (people tend to overlook comments, so it will limit the risk of someone asking you that again). // If you only have access to binary data and not more granular data, it would be helpful to mention that too. (But that would be a shame, as you could miss interesting effects relative to high errors/poor data quality. I think you can find numerous threads about that on this website). $\endgroup$
    – J-J-J
    Commented Oct 4 at 9:28
  • $\begingroup$ Precisely. I have edited que question accordingly. Would phi coefficient be sufficient, for example? $\endgroup$
    – sam wolfe
    Commented Oct 4 at 11:46

1 Answer 1

1
$\begingroup$

Well, there are many ways to skin this cat.
Of course, you should always start by plotting your data. Use a scatter plot (use jitter, for x & y, as there will be only 4 possible points on the plot); that should tell you if they are positively correlated (preponderance of (0,0) and (1,1) points), or negatively correlated (preponderance of (0,1) and (1,0) points), or neither...
Now, you will want to "quantify" this correlation (or lack thereof).

First, yes you could use the $\phi$ coefficient, which in the case of 2 binary variables, is exactly the same as the Pearson coefficient $r$, or the Spearman coefficient $\rho$. Be careful with these coefficients, as they can give misleading results, as detailed here (hence the need to first look at the plot, to see what your data looks like). I am not quite sure what the OP meant by $\chi^2$, so I will not comment.
What you also have in your case is a 2x2 confusion matrix. So you can compute sensitivity, specificity, accuracy, and all these good statistics.
Last, you can try a binary logistic regression between your 2 variables You may also want to look at vaious posts here on CV; e.g. here, here, or here. They all expand on what I briefly described here. And beyond this, you may be interested in this paper.

$\endgroup$
12
  • 2
    $\begingroup$ Plotting paired binary data, even with jittering, usually is ineffective. What's the matter with the textbook default of examining the $2\times 2$ contingency matrix? $\endgroup$
    – whuber
    Commented Oct 3 at 19:58
  • $\begingroup$ A good first reflex is to always plot your data; it usually will tell you a lot. After that, you can pick the test/method which allows you to quantify what your eyes saw, and lets you better interpret the results. A $\chi^2$ test on a contingency matrix assumes that X and Y are independent. But correlation implies that the data is paired. A perfect correlation would give you give you a non significant $\chi^2$ on a contingency matrix (because the proportions of 0/1 would be identical), but would give you 100% accuracy (e.g.) from a confusion matrix. $\endgroup$
    – jginestet
    Commented Oct 3 at 20:51
  • $\begingroup$ Agreed about plotting -- but in such a simple case as a $2\times 2$ contingency table it gets in the way. Even Ed Tufte (especially Ed Tufte!) makes the point that when there are small amounts of data, simply listing or tabulating them usually is the best approach. $\endgroup$
    – whuber
    Commented Oct 3 at 20:53
  • 1
    $\begingroup$ I think we must be interpreting the question differently. If the data are not paired, what exactly is going on? Assuming they are paired, a sufficient statistic is the set of counts of distinct pairs, of which there are only four: that's the $2\times 2$ table. $\endgroup$
    – whuber
    Commented Oct 3 at 21:11
  • 1
    $\begingroup$ I still don't get what you're trying to claim here, because this table is a sufficient statistic: anything one can say about the "correlation" between $X$ and $Y$ can be derived from the table, assuming the probabilistic relationship between the variables is assumed not to vary from one location to another. $\endgroup$
    – whuber
    Commented Oct 3 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.