Code for calculating MSEs of all types for C.d.