PatientLevelPrediction
PatientLevelPrediction copied to clipboard
Error when training a COX PLP model
Hey,
We are trying to train a COX PLP model to predict the risk of recurrence within 3 years of colorectal cancer surgery. We have designed the cohorts in ATLAS, but need to design the remaining parts in R, as, for now, the COX model is not a part of the ATLAS prediction module.
However, when running the model in R we get an error, that we hoped you could help us with.
We have taken screenshots(export of actual scripts and log was not possible at the time of this post) of our model definition, the error log and R session info.
Please let us know if you need more information.
Thanks, Mikail
It looks like the model fits but there are multiple issues during the evaluation. I've seen the issue before when the evaluation is trying to evaluate something (i.e., net benefit) at a predicted risk value that is never observed. However, the errors that are not breaking the code happen because the netbenfit is wrapped in a tryCatch. The fatal error must be due to the calibration summary or the demographic summary (which are not in tryCatches) - it most likely is caused by trying to create a data.frame with a null value for a column where the other columns are vectors of length 31 .
You seem to be using PLP version 4.3.7. In the latest version of PLP everything is in a tryCatch in the evaluation - so the code won't break while doing the evaluation, but you are likely to see similar error messages. Updating to the latest PLP should fix the fatal issue. Note: in the latest PLP there are some slight differences to the inputs (things are more modular so you can reuse settings) - e.g., you use populationSettings as an input into runPlp rather than creating the study population and using that as input (see https://github.com/OHDSI/PatientLevelPrediction/blob/main/inst/doc/BuildingPredictiveModels.pdf).