using matrix models to fit LM