added interaction matrix function