Hi,
I've been making ROC curves in Stata using a gold standard (true_value), and several predictors (pred_1, pred_2, pred_3, AI_pred) - for this, I've been using the following code, which works perfectly:
However, I now want to make the same graph, but by the predictors' experience (value from 1-3), which I'm having a lot of trouble with.
I've tried focusing on just one of the predictors, using the by() option:
But I get the following error:
I've also tried generating new variables like this:
And then using the following code for roccomp:
But I then get the following error:
However, even if I could get that to work, it is still not exactly what I want, since I would like a graph with a curve for:
1) pred_1 experience=1
2) pred_1 experience=2
3) pred_1 experience=3
4) pred_2 experience=1
...
9) pred_3 experience=3
10) AI_pred
Example of data:
I can´t really wrap my head around if this can be done using another code, or if I have to rearrange my data, or how (/if) this can be done. I really hope someone is able to help
I've been making ROC curves in Stata using a gold standard (true_value), and several predictors (pred_1, pred_2, pred_3, AI_pred) - for this, I've been using the following code, which works perfectly:
Code:
roccomp true_value pred_1 pred_2 pred_3 AI_pred, graph summary
I've tried focusing on just one of the predictors, using the by() option:
Code:
roccomp true_value pred_1, by(pred_1_exp) graph summary
insufficient observations
Code:
g pred1_exp1 = pred_1 if pred_1_exp==1 g pred1_exp2 = pred_1 if pred_1_exp==2 g pred1_exp3 = pred_1 if pred_1_exp==3
Code:
roccomp true_value pred1_exp1 pred1_exp2 pred1_exp3 AI_pred, graph summary
variable pred_1_exp1 does not vary
However, even if I could get that to work, it is still not exactly what I want, since I would like a graph with a curve for:
1) pred_1 experience=1
2) pred_1 experience=2
3) pred_1 experience=3
4) pred_2 experience=1
...
9) pred_3 experience=3
10) AI_pred
Example of data:
Code:
id true_value pred_1 pred_2 pred_3 pred_1_exp pred_2_exp pred_3_exp AI_pred 1 0 0 0 0 1 1 3 0 2 1 0 1 0 3 1 2 0 3 1 0 1 0 2 1 2 1 ... 150000 0 1 0 0 3 2 1 1
I can´t really wrap my head around if this can be done using another code, or if I have to rearrange my data, or how (/if) this can be done. I really hope someone is able to help

Comment