An agglomerative pattern analysis algorithm is presented that groups objects using ordinal-invariant pattern clustering, with the
goal of maximizing the coefficient of determination. Key stages are described: constructing initial pattern pattern by grouping
objects according to permutations of feature values; computing centroids and variances; and defining a merge criterion based on
the maximal increase in R2. Algorithmic details include incremental updates of cumulative statistics, enabling constant-time updates
per merge. A complexity analysis shows that the basic implementation is cubic in the number of initial clusters, but filtering and
priority queues can reduce the practical running time. Experimental evaluation on a synthetic dataset and on the red wine quality
dataset from the UCI Machine Learning Repository compares the proposed.