0
$\begingroup$

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?

$\endgroup$

marked as duplicate by Glen_b normal-distribution Mar 8 '17 at 16:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ 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. $\endgroup$ – mdewey Mar 8 '17 at 10:28
  • $\begingroup$ As well as the indicated duplicate, additional details are discussed here. $\endgroup$ – Glen_b Mar 8 '17 at 16:53
1
$\begingroup$

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)
[1] 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
...
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.