A structured multivariate approach for removal of latent batch effects