Extract coordinates from QQ Plot

Hi to all,

I would like to flag potential outliers in a QQ Plot. The check box ‘Display Data Labels’ isn’t very helpful, but at least I could conform that PHX calculates correctly. :wink:
My first idea was to split the data and overlay the ‘normal’ ones with the ‘potential oulier’. Unfortunately adding plots are nor possible (and in Box Plots as well)…

Are there any means to extract the x-coordinates? If yes; I could go with an XY Plot. I don’t want to go with R, since not everybody has a Connect license. :wink:
Example code in R what I would like to achieve:

StdRes <- c(+0.1751, +0.0538, +1.4321, +0.3130, +0.3558, -1.5904,
            -0.9096, -0.9735, -0.7815, +1.2935, -0.3438, -0.4224,
            +0.7162, +0.3140, -1.0118, +1.3558, -0.2965, -0.5263,
            +1.3903, +0.3488, +2.2361, -0.5805, -0.8683, -1.6799)
QQdata <- qqnorm(StdRes, plot.it=FALSE)
PO     <- which(QQdata$y >= 1.96) # potential outliers
plot(QQdata, main="Q-Q Plot", las=1,
  xlab="Standard Normal Quantiles",
  ylab="Studentized Residuals", cex=1.5, pch=21,
  col="blue", bg="lightblue")
qqline(StdRes, col="blue", lwd=2)
points(QQdata$x[[PO]], QQdata$y[[PO]], cex=1.5, pch=21,
  col="red", bg="gold")

OK, I’ll reply to myself. It’s similar to pre-6.4 when the inverse Chi-distribution was not available in a custom transformation. This time we would need the inverse standard normal. It’s available deep in the guts of Phoenix (otherwise the QQ Plots would not be possible) but not accessible to us mere mortals.

I setup a (clumsy) workflow. First we need the p-values. Easy. Next a numeric approximation. I found one by Peter J. Acklam: An algorithm for computing the inverse normal cumulative distribution function (http://home.online.no/~pjacklam/notes/invnorm/index.html). I compared it to R and bloody Excel. Not that bad. Since I only want it for a plot, I didn’t care too much.

See the attached project. In my “annotated QQ Plot” I rounded the normal quantiles in order to get ‘pretty’ data labels. If you are more interested in accuracy, switch them off and map ‘x’ instead of ‘Rounded_x’.

InvStandNorm.phxproj (987 KB)

thanks Helmut, for your work here - looks interesting and I’ll discuss with the Product team what enhancements we can implement to improve i.e.

  1. Add inverse standard normal

  2. Display possible outliers in QQ plot

Simon.

Hi Simon,

I think #1 is more important. #2 would require adding a second graph to QQ Plot. Might be not that easy.