bayesplain.core.dirichlet_multinomial.cohens_w

bayesplain.core.dirichlet_multinomial.cohens_w(share_draws, expected_shares)[source]

Cohen’s w for one or many vectors of category shares.

\[w = \sqrt{\sum_j (p_j - p_{0j})^2 / p_{0j}}\]

The goodness-of-fit counterpart of Cramer’s V: zero when the shares match the expected ones exactly, with 0.1, 0.3 and 0.5 the conventional bars for small, medium and large departures.

Parameters:
share_draws : array_like

Shares, shape (K,) or (draws, K).

expected_shares : array_like

Expected shares, length K. Normalised to sum to one.

Returns:

One value per row of share_draws.

Return type:

ndarray