-1

My data was modelled with a Cox-regression, using R, however I would like to use this model into a python GUI. As my knowledge of R is very limited. This way non-coders would be able to 'predict' survival rates based on our model.

What is the best way that I could use this model (combination of 3 different regressions) in python?

Laurens
  • 19
  • 2
  • can you help specify the problem? what does "use this model" mean? what do you want the users to do? – flies Dec 11 '18 at 15:42
  • The model is used to predict relapse after bariatric surgery. Hence pre-operative patient variables were modeled to predict 'survival'. We used an Markov model to model, thus have 1 Cox-regression for 'success' after surgery (losing more weight than our treshold), 1 Cox-regression to model the survival of remaining successful vs regaining too much weight ('relapse') and one regression for the hazards of death occuring (you can progress to death from each group: our initial group, successful group, relapsed group). We combined these three transition into 1 regression as this is easier. – Laurens Dec 11 '18 at 15:53
  • 1
    With our model we can predict the probabilities of a patient being in 1 of the 4 groups and plot this. This gives us a very interpretable image of the predicted progression. However want to make this available for use in daily life. So doctors can predict patients progression easily. – Laurens Dec 11 '18 at 15:56
  • So then, you want the users to input an individual patient's data so that your model can classify it, then you present that information as a web page. Is that correct? – flies Dec 11 '18 at 16:28
  • Yes, that is correct! :) – Laurens Dec 11 '18 at 16:53
  • SAFEX's answer is correct. You either output the parameters of your model so that you can do your computation in python, or you find a way to call R from within python. I'd try and find the correct python package that can do the former. If you can't find it, ask another, more specific question, something like, "How can I use these Cox regression parameters in python". – flies Dec 11 '18 at 17:05
  • 1
    Ok, that's clear. Thank you for your help! – Laurens Dec 11 '18 at 21:27

1 Answers1

1

Do you want to predict values based on your estimates?

In this case you can just copy the R outputs into python and apply to respective procedures.

Do you want the user to be able to run "your R regression pipeline" from within Python?

There are python libraries that help with that. I find this source a useful start.

safex
  • 2,398
  • 17
  • 40