Modeling Heterogeneity within and between Matrices and Arrays