How to calculate normal score in R? [duplicate]

This question already has an answer here:

I use the qqnorm function to calculate normal scores in R:

x <- 1:10
y <- qqnorm(x)$x How are these kind of normal scores calculated? marked as duplicate by Glen_b normal-distribution StackExchange.ready(function() { if (StackExchange.options.isMobile) return;$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var $hover =$(this).addClass('hover-bound'), $msg =$hover.siblings('.dupe-hammer-message'); $hover.hover( function() {$hover.showInfoMessage('', { messageElement: \$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Mar 8 '17 at 16:43

• You would be better on an R-specific site. You could also try reading the documentation for qqnorm right to the end which gives you a clue. – mdewey Mar 8 '17 at 10:28
• As well as the indicated duplicate, additional details are discussed here. – Glen_b Mar 8 '17 at 16:53

You can look at the exact calculation used by functions in R by combing a number of calls. You can follow some easy steps to "get at" most. This is outlined below, with skipped code lines (for brevity) indicated with ... on their own lines.

First, try to call up the function without parentheses, as such: qqnorm. This yields the following:

> qqnorm
function (y, ...)
UseMethod("qqnorm")
<bytecode: 0x00000000094f9250>
<environment: namespace:stats>

This tells us that qqnorm uses a method. To look at what methods are available, we can use methods().

> methods(qqnorm)
 qqnorm.default*
see '?methods' for accessing help and source code

Having identified the method, we can then use getAnywhere() to examine the source code.

> getAnywhere(qqnorm.default)
A single object matching ‘qqnorm.default’ was found
It was found in the following places
registered S3 method for qqnorm from namespace stats
namespace:stats
with value

function (y, ylim, main = "Normal Q-Q Plot", xlab = "Theoretical Quantiles",
ylab = "Sample Quantiles", plot.it = TRUE, datax = FALSE,
...)
{
if (has.na <- any(ina <- is.na(y))) {
yN <- y
...