Measures how much the posterior \(W\) improves alignment with the
sectoral signal \(L\) relative to the prior \(P\). We compute the
correlation increment \(\Delta\rho = \max(0,\rho(W,L)-\rho(P,L))\) using
robust_cor (chooses Pearson/Spearman by larger absolute value), then
map it to \([0,1]\) with mult and const:
$$\mathrm{score}=\min\{1,\ \mathrm{const}+\mathrm{mult}\cdot\Delta\rho\}.$$
Usage
coherence_score(P, W, L, mult = 3, const = 0.5)
Value
Scalar coherence score in \([0,1]\).
Arguments
P
Prior matrix (\(T \times K\)); rows should sum to 1 (approximately).
W
Posterior matrix (\(T \times K\)); rows should sum to 1 (approximately).
L
Likelihood vector (length \(K\)), non-negative and summing to 1.
mult
Non-negative multiplier applied to the correlation increment (default 3.0).
T <- 6; K <- 4
P <- matrix(runif(T*K), T); P <- P/rowSums(P)
W <- matrix(runif(T*K), T); W <- W/rowSums(W)
L <- runif(K); L <- L/sum(L)
coherence_score(P, W, L)