withReplicates function

Compute variances by replicate weighting