Rize S. answered 03/23/23
Master's in MISM, 25 yrs Exp: SPSS Expert
To calculate AUC with confidence interval for multiple numerical groups, you can use the following steps in SPSS:
- Open your dataset in SPSS and go to Analyze -> ROC Curve.
- In the ROC Curve dialog box, select the variable that represents the outcome (dependent variable) and the variable that represents the predictor (independent variable) for the first group.
- Click on the Options button and check the boxes for "Display confidence intervals" and "Display multiple ROC curves." Click on Continue.
- Click on the Add button to add more groups and repeat step 2 and 3 for each group.
- Click on OK to generate the ROC curves with confidence intervals for all the groups.
- You can also export the results to a file by clicking on the Paste button and selecting "Paste SPSS Syntax" or "Paste SPSS Output."
Alternatively, you can use other software such as R or Python to calculate AUC with confidence interval for multiple groups. Here is an example code in R using the pROC package:
# Load the pROC package
library(pROC)
# Create a list of data frames for each group
group1 <- data.frame(outcome, predictor_group1)
group2 <- data.frame(outcome, predictor_group2)
group3 <- data.frame(outcome, predictor_group3)
group4 <- data.frame(outcome, predictor_group4)
group5 <- data.frame(outcome, predictor_group5)
# Calculate AUC and confidence interval for each group
auc1 <- roc(group1$outcome, group1$predictor_group1)
auc2 <- roc(group2$outcome, group2$predictor_group2)
auc3 <- roc(group3$outcome, group3$predictor_group3)
auc4 <- roc(group4$outcome, group4$predictor_group4)
auc5 <- roc(group5$outcome, group5$predictor_group5)
# Print the AUC and confidence interval for each group
print(auc1)
print(auc2)
print(auc3)
print(auc4)
print(auc5)
This will output the AUC and confidence interval for each group separately. You can also compare the AUC between groups using the roc.test function in the pROC package.