Skip to contents

Compute summary statistics for a vector of PageRank scores. These metrics help characterize how concentrated or dispersed the PageRank distribution is, which is useful when comparing different models or parameter configurations.

Usage

pr_gini(x)

pr_entropy(x)

pr_top_k_share(x, k = 0.1)

Arguments

x

Numeric vector of non-negative values (typically PageRank scores).

k

Fraction of nodes to consider (0 < k <= 1). Default `0.1` (top 10 percent).

Value

A single numeric value.

A single numeric value (in nats). Returns `NA` for empty or all-zero inputs.

A single numeric value between 0 and 1 representing the cumulative share.

Functions

  • pr_gini(): Gini coefficient (0 = perfectly equal, 1 = maximally concentrated).

  • pr_entropy(): Shannon entropy (higher = more uniform distribution).

  • pr_top_k_share(): Share of total PageRank held by the top-k fraction of nodes (e.g., top 10 percent).

Examples

pr_gini(c(0.5, 0.3, 0.2))
#> [1] 0.2
pr_gini(c(1, 0, 0))
#> [1] 0.6666667
pr_entropy(c(1 / 3, 1 / 3, 1 / 3)) # maximum entropy for 3 nodes
#> [1] 1.098612
pr_entropy(c(1, 0, 0)) # minimum entropy
#> [1] 0
pr_top_k_share(c(0.5, 0.3, 0.1, 0.05, 0.05))
#> [1] 0.5
pr_top_k_share(c(0.5, 0.3, 0.1, 0.05, 0.05), k = 0.4)
#> [1] 0.8