Reuse function for forming design matrices