simpler compute_hat