"multivariate" option for matrix and week; refactoring