Dear developer,
I' have been working with the R package of gfoRmula for some time. I would like to report what I deem to be a "deficiency" of the package.
To give you a little more context, I'm working with survival outcomes in Intensive Care Units (ICUs). I have also a competing event, which is the discharge from the ICU and also acts as a censoring event, as I have no information on patients after they are discharged.
After quite some work and tuning, I got to realize that the task I'm working on requires a custom model for the outcome, and I was able to set it up and run things smoothly as gfoRmula allows ymodel_fit_custom and ymodel_predict_custom parameters.
The model for the outcome has been obtained (trained and tested) separately, prior to using gfoRmula for simulations. Specifcially, my ymodel_fit_custom is just an empty function
ymodel_fit_custom <- function(obs_data){
return ()
}
and in the predict function I load my pre-trained model and use it to predict
ymodel_predict_custom <- function(fit, newdf){
library(glmnet)
load(<path_to_trained_model.rdata>) # this contains a glmnet model called `cv_fit`
stringFormula <- "<my formula, way too long to be written here, written in string format" # same formula used when training `cv_fit`
formula <- as.formula(stringFormula)
X <- model.matrix(formula, data = newdf)[, -1]
probabilities <- predict(cv_fit, newx = X, type = "response", s = "lambda.min")
return(probabilities)
}
I'm not sure it's the cleanest way to do what I want, but I'm happy with it.
It would be great to add the possibility of doing something similar for the prediction of the competing event. As of last released version, no compevent_fit_custom and compevent_predict_custom are allowed.
Thank you in advance for the answer!
Best regards,
Demetrio
Dear developer,
I' have been working with the
Rpackage ofgfoRmulafor some time. I would like to report what I deem to be a "deficiency" of the package.To give you a little more context, I'm working with survival outcomes in Intensive Care Units (ICUs). I have also a competing event, which is the discharge from the ICU and also acts as a censoring event, as I have no information on patients after they are discharged.
After quite some work and tuning, I got to realize that the task I'm working on requires a custom model for the outcome, and I was able to set it up and run things smoothly as
gfoRmulaallowsymodel_fit_customandymodel_predict_customparameters.The model for the outcome has been obtained (trained and tested) separately, prior to using
gfoRmulafor simulations. Specifcially, myymodel_fit_customis just an empty functionand in the predict function I load my pre-trained model and use it to predict
I'm not sure it's the cleanest way to do what I want, but I'm happy with it.
It would be great to add the possibility of doing something similar for the prediction of the competing event. As of last released version, no
compevent_fit_customandcompevent_predict_customare allowed.Thank you in advance for the answer!
Best regards,
Demetrio