# GSEA: Computing an Enrichment Score (as described in the original paper)

The following paragraph comes from the GSEA paper that explains how to obtain an enrichment score for a gene set. Note that the enrichment score is computed up to a position i in L. There are 2 things I don’t understand about this:

1- first, the following image illustrating the method seems to suggest that that we score a gene set across the whole list of ranked genes, which conflicts with the idea of “up to a position i” in L

2- second, if we’re only considering genes up to a position i, then how are we going to capture the genes that are underexpressed (appear at the bottom of the ranked list) for phenotype A?

Actually I believe I get it now. i is not a constant. We vary it from i=1 to N and consider the i for which $$P_{hit} - P_{miss}$$ is largest in magnitude