Our News

More News»

PACES Blog

Stata Tutorial: Receiver Operating Curves with Multiple Predictors

A colleague recently asked me about a native solution in Stata to create a graph of the ROCs for multiple predictors (e.g., independent variables, covariates, right-hand side variables, etc…).  I thought it might be helpful to provide a post to illustrate how to do this using data from the Strategic Data Project’s College Going Toolkit.

ROCexample

Note: This can take a decent amount of time to execute, but if you’re patient you will get the ROC graph that you are interested in. Using Stata 14 MP8 on a MacBook Pro with a 2.8Ghz i7 Quad Core and 16GB RAM took

Overall total time = 230.850 (sec)

There were also a few other background programs running, but this should give you some general idea about the length of time it would take with a similar system.

Although it is answering a different question, it may be equally – if not more useful – to consider instead estimating the marginal effects of the variable(s) of interest with the added benefit of specifying values of continuous indicators of interest for the individual groups.

margins-simple

Things start to get crowded a bit quickly as the number of marginal effects grows, but there are alternatives to generating similar graphs using subplots (e.g., lattice style plots/graphs).

margins-interaction

If you were interested in timing of the script overall, you can use the code below to time your script and get a better idea of how long it would take to execute the code on your system:

 

 

 

Contact

83 Power Road, Pawtucket, RI 02860
12313 33rd Ave. NE #202, Seattle, WA 98125
P: 401.499.9719
F: 206.906.9493
E: Info@paces-consulting.org