In this article, we'll delve into the concept of statistical Rarity, a newly introduced feature aimed at helping you understand the rarity of your NFT during early collecting after a mint. We'll explain what statistical Rarity is, how it works, and why it matters to you.

# What is statistical rarity?

Statistical rarity is a simple math equation which ranks NFTs based on the number of times a trait appears in a collection. Statistical rarity is calculated by multiplying all of an NFT's trait percentages. NFTs with lower scores would be considered rarer than those with high scores. On Magic Eden, we will provide users with instant rarity scores for newly minted NFT collections.

# How does statistical rarity work?

When a new collection is minted out or a mint is closed on Magic Eden, users will see a rarity score using the statistical rarity calculation. This score reflects the uniqueness and scarcity of each NFT within the collection based on their traits, helping users assess the desirability of individual items.

# Key features of statistical rarity on Magic Eden

**Instant rarity scores:**Users can quickly view the rarity of NFTs as soon as a collection is minted out, enabling swift decision-making.**Transparency:**Statistical Rarity operates on a standard mathematical calculation without any additional logic; eliminating subjective biases and ensuring fairness for all users.**Seamless integration:**Rarity scores are seamlessly integrated into the Magic Eden platform, visible on collection pages, profile pages, item details, and the AMM interface.

# Statistical rarity details

To provide clarity on how statistical rarity is determined, we utilize a calculation akin to **MoonRank’s statistical algorithm**. Here’s a step-by-step breakdown:

## Determining collection shape

First, we determine the “shape” of a collection. The shape is a mapping of each “trait_type” present within the collection to the maximum number of times the trait is present in a single member of the collection. Consider the attributes of the following two NFTs in a collection:

NFT 1:

`[{trait_type: “armor”, value: 1}, {trait_type: “armor”, value: 2}, {trait_type: “weapon”, value: 1}]`

NFT 2:

`[{trait_type: “armor”, value: 1}, {trait_type: “weapon”, value: 2}]`

In this case, the shape of the collection is {“armor”: 2, “weapon”: 1} because “armor” appears twice on NFT 1 and “weapon” only appears once on either NFT.

## Normalizing attributes

Next, we “normalize” the attributes of each NFT in the collection by adding markers for each “missing” trait (where the occurrence of a trait on an NFT is less than that trait’s size in the collection shape). Returning to the prior example, the NFTs become:

NFT 1:

`[{trait_type: “armor”, value: 1}, {trait_type: “armor”, value: 2}, {trait_type: “weapon”, value: 1}]`

NFT 2:

`[{trait_type: “armor”, value: 1}, {trait_type: “armor”, value: MISSING_1}, {trait_type: “weapon”, value: 2}]`

Two important notes:

`null`

is treated as a deliberate value, distinct from “unset”.

In the event of multiple unset values for a trait, each “unset” is unique. If there was a third NFT in the collection with no “armor” traits at all, it would be normalized to have two “armor” traits: MISSING_1 and MISSING_2.

## Generating weight map

Then, we generate a “weight map” for the collection, which tracks the occurrence of each value, for each trait in a collection. In the prior 2-NFT collection, the weights would be:

`{`

`“armor”: {1: 2, 2: 1, MISSING_1: 1}, // Two NFTs with value “1”, one each of value “2” and MISSING_1`

`“weapon”: {1: 1, 2: 1} // One NFT with each value of “weapon”`

`}`

## Determining scores

Next, we iterate through the entire collection and determine scores for each NFT. The score of an NFT is the product of the subscores of its traits. The trait subscore is simply the occurrence of that trait value (from the weight map) divided by the size of the collection.

With the example NFTs, looking at NFT 1, its {“armor”: 1} trait has a subscore of (2/2 = 1). {“armor”: 2} has a subscore of (1/2) and {“weapon”: 1} has a subscore of (1/2). Multiplying these together gets (1 * 1/2 * 1/2 = 0.25), the final score of the NFT. Lower scores are more rare.

## Ranking NFTs

Finally, we rank the NFTs based on their score, with lower numbers having lower rank numbers. NFTs with the same score will have the same rank. For example, scores of [0.25, 0.25, 0.5] would correspond to ranks of [1, 1, 3].

# Why does rarity during early collecting matter?

Instant rarity helps users make informed decisions based on the rarity of their NFTs. By providing instant access to rarity scores, Magic Eden ensures transparency and fairness in the collecting process, powered by a standard mathematical equation with no additional logic or calculations added.

We understand some users prefer MoonRank or HowRare’s rarity scores. And that is completely fine! Once additional rarity providers are available for any collection, users can change their rarity filter from their settings menu to whatever they want.

# How to access statistical rarity

Statistical rarity will only be activated for new mints. Existing collections will not have statistical rarity applied because some collections may have modifications to their supply since they minted out.

To access statistical Rarity scores for collections that have it, simply navigate to the desired collection, profile, or item page on Magic Eden. Rarity scores will be displayed alongside other relevant information, providing valuable insights into the uniqueness of each NFT.

If you are a creator and would like statistical rarity added to your collection on Magic Eden, just reach out to Magic Eden support to request for it.

# Moonrank and HowRare rarity

Once Magic Eden detects MoonRank and HowRare rarity scores, users can change their rarity filter from their settings menu to whatever they want. Statistical rarity will remain an option for users indefinitely for a collection.

If you have any questions or need assistance, reach out to our support team by clicking on the purple chat widget.