[R] overlaying qqnorm plots...

Jeff D. Hamann jeff_hamann at hamanndonald.com
Tue Nov 27 20:28:59 CET 2001

```Perfect!

Thanks,
Jeff.

----- Original Message -----
From: "Paul Murrell" <p.murrell at auckland.ac.nz>
To: "Jeff D. Hamann" <jeff_hamann at hamanndonald.com>;
<r-help at stat.math.ethz.ch>
Sent: Tuesday, November 27, 2001 11:40 AM
Subject: Re: [R] overlaying qqnorm plots...

> Hi
>
>
> > I know this topic has had plenty of discussion in the last couple of
days,
> > but....
> >
> > I've been trying to compare the effects of different fitted methods for
> > systems of equations (OLS, SUR, 2SLS, 3SLS ) and would like to compare
the
> > residual plots (easy) and the qqnorm/qqplot of the fits for the
different
> > fitted methdos. For example,
> >
> > qqnorm( residuals( lm( q ~ p + f + a ) ) )
> > par( new = TRUE )
> > qqnorm( residuals( tsls( q ~ p + d, ~ d + f + a ) ) )
> >
> > The resulting plot contains the two qqnorm plots, and the x axis stays
the
> > same. The y axis ("Sample Quantiles") scales for the different plots. I
> > would to fix the y axis (fix the quantiles values?) and plot the
different
> > plots in different colors. Is that possible?
>
>
> Yep, ylim can be specified as usual ...
>
>     y1 <- rnorm(100)
>     y2 <- rexp(100)
>     qqnorm(y1, ylim=range(y1, y2), col="blue")
>     par(new=T)
>     qqnorm(y2, ylim=range(y1, y2), col="red")
>
> ... NOTE that this does a lot of unnecessary drawing;  an alternative is
to
> get qqnorm to just tell you what x- and y-values it would plot and then
use
> points() to add the new points rather than draw a whole new plot ...
>
>     y1 <- rnorm(100)
>     y2 <- rexp(100)
>     qqnorm(y1, ylim=range(y1, y2), col="blue")
>     secondpts <- qqnorm(y2, plot.it=FALSE)
>     points(secondpts, col="red")
>
> Hope that helps.
>
> Paul
>

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```