I have ~100 variables on a spreadsheet that I would need to determine the best ROC cutoff and the AUC for 2-year OS, using the survivalROC package. To clarify, I need to determine the best ROC cutoff/AUC for each variable individually.
I'm using the code below to run ROC for one variable, but I'm not sure how to use a loop or something similar to run this for all 100 variables without copying and pasting the code 100x. Would anyone be able to help me? Thank you so much!
And it's already imported into the data frame data? (BTW: naming user objects after built-ins like data and df will sooner or later throw an error because namespace precedence will try to subset the function, rather than the data frame and yield the mysterious "cannot subset a closure" error.
@technocrat. Yes, the variable list is already imported into the data frame "data" as a column. Sorry, the dataframe is actually named something else, but I changed the name for privacy reasons when posting the question to this forum.
Hi @technocrat . Thank you so much for helping me out! I'm confused by your question. Each variable is a separate column so it's more accurate to say that I want to run this function over columns Variable_1 to Variable_4. I'm trying to determine the best ROC cutoff point with Variable_1, the best ROC cutoff point with Variable_2, etc. I also capitalized "Variable_1" in my original code blow to keep the capitalizations consistent. I think that was probably throwing the error.
@technocrat. I'm trying to find the best ROC cutoff over all the patients for Variable_1, the best ROC cutoff over all the patients for Variable_2, etc. So would like to iterate through columns Variable_1 to Variable_4.
Also, I think that was throwing an error because I didn't capitalize "Variable_1" in my original code while I did in the data set. Thanks again for all the help!