merged numerical and categorical models code