Ken Kleinman

Biostatistician

  • Increase font size
  • Default font size
  • Decrease font size

Quartplot Macro

E-mail Print PDF

I often work with colleagues who want to use some continuous predictor in a logistic regression.  Sometimes my colleagues want to divide the continuous variable into four categories, dividing at the observed quartiles.  The rationale for this is that interpreting the odds ratio for one quartile vs. another is easier than interpreting the odds ratio associated with a one-unit increase in the continuous predictor.  (This doesn't make sense to me, but this is what my colleagues say.)

I wrote a little SAS macro as a diagnostic to help evaluate this notion.  More plausible if you see some suggestion of a step function in the relationship between the two variables, I would say.  The macro plots the two variables in a scatterplot, adding jitter to the 0-1 outcome to help show where the data are, and adding a smoothed curve and the quartiles of the continous variable.  Here's an example of the output, with simulated data; the simulated relationship is a linear logistic regression.

quartplot macro output

Here's the quartplot macro code.

Occasionally my colleagues will break into four categories at the quartiles, then attempt to infer linearity across the estimated odds ratios.  This strikes me as unwise.

 

 

 

 

Contents