# Equivalent of AUC (area under the ROC curve) for two variables

I was wondering if there is a way to compute AUC using two variables instead of one as predictors.

I got two populations after a follow-up, divided in Cases and Controls according to whether they had developed or not a pathology during the follow-up. There are also two independent variables in the data and now I would like to find a way to combine these two to see if any combination of them could enhance predictability.

I've already tried combining many variables (a total of 39, including the two I am asking this question about) with principle component analysis (PCA), but it did not improve the predictability, so I want to try something else. I know that some use C-index, but I know nothing about it.

Clarification. Suppose that the two variables I have are: a measure of the length of an heartbeat, also called RR, and a measure of the quantity of the blood ejected at every heartbeat, also called LVEF. I know that these two variables yield AUCs of 0.61 and 0.65, respectively, when used separately. Is there a way I could combine these two AUCs for RR and LVEF?

• There are votes to close this question as unclear. However, I think it is pretty clear, and I edited it to improve readability. Commented Mar 23, 2015 at 15:23
• One sentence that is unclear is the one about PCA. I still don't understand it, even after your edit. Commented Mar 23, 2015 at 15:29
• I'll try to explain. I know that a way to combine different independent parameters on a data set is PCA, thus i've tried PCA for some indipendent parameters (a total of 39) i have on the data set, which include the two parameters for which i asked the question. However, i found no improvement of predicitivity using PCA, thus i'm searching some other methods to combine two or more parameters. I hope to have clarified the statement. Commented Mar 23, 2015 at 15:40
• When you say "parameters" I think you mean variables, but even if that's right what do you mean by combining variables? There are any number of ways of doing it; for all we know $\ln x_1/x_2$ or $(x_1 - x_2) / (x_1 + x_2)$ could be what you want. Without specifics how could I combine variables is no less general than what calculations could I do? (Mentioning that you are interested in something pathological doesn't tie this down statistically.) Commented Mar 23, 2015 at 16:59
• Statistically, those are variables, not parameters. A parameter in statistics is a constant you are estimating. I am guessing that something like QT-interval varies between people or for a person over time, etc. That would make QT-interval a variable, not a parameter. My larger comment remains: any kind of combination could make sense, so your question is, so far as I can see, completely open. Commented Mar 23, 2015 at 18:54

## 1 Answer

If you want to compute the AUC for the combination of two variables, you can include both as predictors in a logistic regression model and compute the AUC using the predictions from the model. See some sample code:

library(pROC)
data(infert)
auc(case ~ age, data=infert)   #Compute AUC for predicting case with the variable age
mod1<-glm(case ~ age + parity, data=infert, family="binomial")  #Logistic regression model
auc(case ~ predict(mod1), data=infert)  #Compute AUC for predicting case with your model

• what's the code for? Commented Mar 23, 2015 at 23:42
• It's an example of computing the AUC for a logistic regression model including two variables (age and parity) as predictors. You are using both variables to predict a third one (case), as you stated in your question. Commented Mar 23, 2015 at 23:48
• hmmm, i'm not sure i've understood what you've done, but i'll try something according, maybe trying will help me. Thanks for the answers. Commented Mar 23, 2015 at 23:54
• +1. It is a reasonable approach, @Ciochi. Perhaps I can add that the AUC is a measure that (by definition) only makes sense if you have one variable. So if you have several variables and still want to use AUC, then the question is how to combine these several variables into one variable. Of course you want to combine them such that the difference between groups becomes as high as possible. There are various ways to find such "optimal" combinations, and logistic regression is one good way. Another way is linear discriminant analysis. Commented Mar 23, 2015 at 23:58
• First i'll try the linear regression model. But i need to be sure that i work fine. Take this function in matlab: it.mathworks.com/help/stats/glmfit.html which is defined like this: b = glmfit(X,y,distr) [..] X is an n-by-p matrix of p predictors at each of n observations[..] y is an n-by-1 vector of observed responses. In my case, given N1 as the dimension of Controls and N2 the dimension of Cases, X may be a (N1+N2)x 2, with the two columns being the two variables, and y a vector of 0 or 1 according to Nth observation being a Control or a subject. Commented Mar 24, 2015 at 0:02