Closed-form Strasser-Weber permutation mean and covariance
Source:R/moments.R
riposte_sw_moments.RdComputes the exact permutation mean vector and covariance matrix of the
representation linear statistics T_c = sum_i z_i * s_{c,i}, from the scores
and the design, without re-randomizing. The permutation fixes each block's
treated count, so within block z is a simple random sample of size m_b
from n_b units. For that sampling, with p_b = m_b / n_b,
E[T_c] = sum_b p_b * sum_{i in b} s_{c,i}, andCov(T_a, T_b) = sum_b w_b * sum_{i in b} (s_{a,i} - sbar_a)(s_{b,i} - sbar_b), wherew_b = m_b (n_b - m_b) / (n_b (n_b - 1))andsbaris the within-block mean.
The covariance uses within-block-centred cross products, so it is the same
whether scores are already centred (as from riposte_score_matrix()) or
not; the function centres internally. When scores are centred, the mean is
zero, as riposte's combinations assume.