cox_model function

Internal function to calculate Cox-PH model and related metrics.