# Statistical test to measure enrichment compared to expected

I have a list of loci of interest across genomic data. I also have various subsections of the genome I'm studying that have been established independantly, and for each subsection I run a certain algorithm on it which gives me a certain score.

Here's a diagram to represent the situation (in reality, I have several thousand subsections and tens of thousands of loci):

What statistical test do I need to use to study the relationship between subsection score and number of loci in the subsection? A colleague suggestion Poisson, but I'm struggle to see how to apply it.

For example, I suspect that a high number of loci in a subsection will result in a lower score. I think a good way to represent this would be to divide the subsections into deciles of increasing score, and measure enrichment per decile. Have another diagram:

• Your colleague might be unto something. Score is your y variable, number of locii is your x variable (and subsections). A Poisson regression model will model this relationship, that is whether the number of locii affects the score. Commented Dec 7, 2022 at 14:21
• @user2974951 and so how would I be able to get a pval of significance from that model? Would it be "probability of finding this many hotspots in subsections with this accuracy"? Commented Dec 8, 2022 at 10:07

Binning continuous variables as you propose to do is generally not a good strategy. It's best to do an analysis as close as possible to the original data, in a way that gets most directly at the question you are trying to answer.

When you say you want "to study the relationship between subsection score and number of loci in the subsection," you imply that the score is an outcome variable of some type and numberOfLoci is a predictor variable that is characteristic of each subsection. That suggests regression of some type of score against numberOfLoci.

Start by plotting score against numberOfLoci for all subsections, along with a simple smoothed, non-parametric fit like a loess curve. That should quickly show the outline of the relationship.

For more detailed analysis, the type of regression depends on the nature of the score (outcome) variable--is it continuous, a count value, or a proportion? You could choose linear regression, Poisson (or other count) regression, or a binomial regression, respectively.

If there is more than a handful of distinct values of numberOfLoci among the subsections, then you can treat it as a continuous predictor but model it flexibly. Regression splines or generalized additive models are good ways to do this if you don't have any theoretical basis for the association between score and numberOfLoci.

One warning: from your last image, it looks like your score is some type of p-value. That type of score can be fraught with difficulty, as (1) it can be very dependent on the particular data sample at hand and (2) p-values are closely related to the number of cases evaluated. For example, if the score for a particular subsection is determined by the p-value of some test on the loci enumerated by numberOfLoci, then you will typically find lower score values when the numberOfLoci is higher. But that could just be due to the way that p-values are calculated and have no further biological significance.

• Wouldn't the (genomic) length of subsections be relevant as well? Commented Dec 10, 2022 at 15:27
• @dipetkov it might. It depends on the specific nature of the score, how the subsections are defined, and how the loci are chosen within subsections. Those details aren't clear from the question.
– EdM
Commented Dec 10, 2022 at 15:46