store.model function

Store residuals from a model