Skip to content

QQ plot

4 messages · nandan amar, Rolf Turner

#
On 17/02/12 21:32, nandan amar wrote:
To start with, you are missing telling us that the function qq() is
from the *lattice* package.

Secondly you are missing reading the error message.  What
does it *say*?  Think about it.

It says that (rather strangely, it seems to me) that the left hand
side of the formula must be a factor with two levels.  Obviously
then you must combine your observations into a single vector
and create a factor indicating to which of the two samples each
entry of that vector belongs.  Something like:

     y <- c(original,predicted)
     f <- factor(rep(c("o","p"),c(length(original),length(predicted))))
     require(lattice)
     print(qq(f ~ y))

Alternatively you could save hassle and use base graphics:

     qqplot(original,predicted)

     cheers,

         Rolf Turner
#
On 18/02/12 00:15, nandan amar wrote:
The error is that you didn't look at the code of qqplot() to see what
it's actually doing.  (Type:    "qqplot" without the quote marks.)

It's not doing what you did, so naturally the results are different.

I have not the time nor the inclination to think through the implications
of what you did and what qqplot() does in respect of the information
content of the two approaches.  I suspect that they will usually, if not
always, give *similar* results.

     cheers,

         Rolf Turner