Linear-by-linear association test (source code)

= Linear-by-linear association test

For a two-way <contingency table> whose row and column variables are <ordinal categorical variables>, assign row scores $u_i$ and column scores $v_j$. The linear-by-linear association statistic measures the weighted covariance
$$
\sum_{i,j}y_{ij}(u_i-\bar u)(v_j-\bar v).
$$
After normalization, its square is asymptotically $\chi^2_1$ under independence. A signed, one-sided version tests a specified direction of ordinal association and can have greater <statistical power> than an omnibus independence test against a monotone alternative.