code for fitting composition models across the entire domain