AI Glossary / Statistics and probability / Intermediate

Analysis of similarities

Definition

Analysis of similarities, or ANOSIM, is a permutation-based statistical method for comparing predefined groups using ranked pairwise dissimilarities. It asks whether observations from different groups tend to be more dissimilar than observations within the same group. It is widely associated with multivariate community data in ecology.

What it means

The method begins with a dissimilarity matrix rather than requiring a separate test for each measured variable. Ranking the dissimilarities focuses on their ordering. The grouping labels identify the comparison being evaluated; they are not discovered automatically by ANOSIM.

A positive ANOSIM statistic indicates that between-group dissimilarities tend to have larger ranks than within-group dissimilarities. However, the method can respond to differences in within-group dispersion as well as differences in group location or composition. A significant result therefore requires investigation rather than an automatic interpretation as a pure difference between group centers.

How it works

Choose a dissimilarity measure suitable for the data and apply justified preprocessing, such as transformations or scaling. Rank the pairwise dissimilarities, handling ties appropriately. Calculate the mean rank for between-group pairs and the mean rank for within-group pairs.

The usual statistic is R = (mean between-group rank - mean within-group rank) divided by N(N - 1)/4, where N is the number of observations. Large positive values indicate greater separation in the ranked dissimilarities. R is not an R-squared statistic or a proportion of explained variance.

Assess significance by permuting group labels according to an exchangeability scheme justified by the design. Repeated measures, blocks or temporal dependence may require restricted permutations. The pairwise distances are not independent observations simply because there are many of them. Examine within-group dissimilarity distributions and suitable visualizations, and consider whether another method better matches the desired question about location, dispersion or covariates.

Three practical examples

1. An ecologist compares species-composition profiles across predefined habitat groups using an appropriate community dissimilarity measure.

2. A researcher examines whether multivariate sample profiles differ across experimental conditions, with permutations restricted to respect the study design.

3. An analyst uses ANOSIM as a group-separation summary while checking whether unequal within-group variability could explain the result.

Think of it this way

Think of comparing how far apart items are within labeled boxes and between boxes. If items in different boxes are consistently farther apart, the labels organize the items meaningfully in that distance sense. But a very scattered box can also affect the comparison, so the reason for the distance pattern still needs examination.

Worked example

Consider an original one-dimensional example with observations 0 and 1 in group A and 10 and 12 in group B. Use absolute distance. The two within-group distances are 1 and 2. The four between-group distances are 10, 12, 9 and 11.

Ranking all six distances from smallest to largest gives within-group ranks 1 and 2 and between-group ranks 4, 6, 3 and 5. The mean within rank is 1.5; the mean between rank is 4.5. With N = 4, the denominator is 4 times 3 divided by 4 = 3, so R = (4.5 - 1.5)/3 = 1.

Despite perfect rank separation, there are only six ways to assign two of the four observations to labeled group A, leaving two in B. Two assignments, including the observed labeling and its complete label reversal, yield R = 1. The other four yield R = -0.5. An exact upper-tail permutation p-value is therefore 2/6 = 1/3. This demonstrates why a large separation statistic does not guarantee a small p-value in a tiny sample.

Illustrative case study

Fictional case study: Similaris compares multivariate environmental samples from two site categories. ANOSIM produces a positive statistic, but inspection shows that one category has much more variable samples than the other. The analysts investigate sampling consistency and dispersion before explaining the group difference.

They also restrict permutations to respect matched sampling periods and compare the result with methods addressing the specific ecological question. Their report states the dissimilarity measure, preprocessing and permutation design rather than providing only a p-value.

This fictional case illustrates interpretation beyond a significance label. It does not claim that a dispersion difference is unimportant or that switching methods automatically removes every limitation.

Common misconceptions and mistakes

ANOSIM is not analysis of variance on raw measurements, and its R is not a Pearson correlation or explained-variance percentage. Ranking does not make the analysis assumption-free. The permutation scheme must still be valid for the sampling design.

A small p-value does not identify which variables caused the separation. A near-zero statistic does not prove groups are identical in every respect. Also, calculating groups from the same dissimilarity matrix and then treating those labels as independently prespecified can make the testing question circular unless the selection process is addressed.

Business use

ANOSIM can provide a compact assessment of group structure in multivariate data when a defensible dissimilarity measure is available. It is useful for exploratory comparisons and some designed studies, but the reason for any detected difference must be understood.

Record the unit of observation, group definitions, transformations, distance measure, R statistic and permutation method. Retain sample-level plots and dispersion checks. For AI applications involving embeddings, the distance representation itself strongly influences the result, so evaluate whether it captures the intended concept. Do not interpret group separation in embedding space as proof of causal differences, fairness or predictive usefulness without additional evidence.

People also ask

Can ANOSIM compare more than two groups?

Yes. An overall analysis can compare several predefined groups, though follow-up pairwise comparisons introduce additional testing considerations.

Does R = 1 mean the result is statistically significant?

Not necessarily. The permutation distribution and sample size determine the p-value, as the worked example shows.

Why examine dispersion?

Differences in within-group spread can influence ANOSIM, making a result difficult to interpret as a pure location or composition difference.

Check your understanding

Mean between-group rank is 7, mean within-group rank is 4 and N = 6. What is R?

Answer: The denominator is 6 times 5 divided by 4 = 7.5, so R = (7 - 4)/7.5 = 0.4. This alone does not supply a p-value.

Related terms

  • Rank
  • Permutation test
  • dissimilarity matrix
  • exchangeability
  • multivariate dispersion
  • PERMANOVA
  • ordination and community composition
  • test mechanism and possible explanations of group differences

Learn next

calculate ANOSIM ranks for a tiny dataset and enumerate all valid label permutations. Then increase one group's spread without changing its center and observe how the statistic can respond.

More in Statistics and probability

  • Analysis of covariance - Analysis of covariance, or ANCOVA, is a regression-based method for comparing groups while including one or more quantitative covariates.
  • Analysis of manufacturing variance - Analysis of manufacturing variance, or AMV, is a computer-experiment approach that decomposes projected manufacturing-process variation into contributions...
  • Analysis of rhythmic variance - Analysis of rhythmic variance, abbreviated ANORVA, is a method proposed by Peter Celec for detecting periodic patterns in biological time series.
  • Analysis of variance - Analysis of variance, or ANOVA, is a family of statistical methods that partitions variation in an outcome into components associated with modeled factors...
  • Analytic survey - An analytic survey is a sample survey designed primarily to compare sectors or subgroups within the sampled population.
  • Ancestral graph - An ancestral graph is a mixed graph used to represent conditional independence relationships, allowing directed, bidirected and undirected edges under...

Sources

Primary sources: Oksanen and collaborators, vegan documentation, Analysis of Similarities: https://vegandevs.github.io/vegan/reference/anosim.html

Clarke, Non-parametric multivariate analyses of changes in community structure, 1993: https://www.pelagicos.net/MARS6300/readings/Clarke_1993.pdf

Previous: Analysis of rhythmic variance Next: Analysis of variance

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer